-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRegularTile.cpp
More file actions
56 lines (40 loc) · 968 Bytes
/
RegularTile.cpp
File metadata and controls
56 lines (40 loc) · 968 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include "stdafx.h"
#include "RegularTile.h"
//Constructor and Destructor:
RegularTile::RegularTile
(
int type, int grid_x, int grid_y, float grid_size_f,
const sf::Texture& texture, const sf::IntRect& texture_rect,
bool collision
)
: Tile(type, grid_x, grid_y, grid_size_f, texture, texture_rect, collision)
{
}
RegularTile::~RegularTile()
{
}
//Accessors:
const std::string RegularTile::getAsString() const
{
std::stringstream ss;
ss << this->type << " " << this->shape.getTextureRect().left << " " << this->shape.getTextureRect().top
<< " " << this->collision;
return ss.str();
}
//Functions:
void RegularTile::update(const float& dt)
{
}
void RegularTile::render(sf::RenderTarget& target, sf::Shader* shader, const sf::Vector2f player_position)
{
if (shader)
{
shader->setUniform("hasTexture", true);
shader->setUniform("lightPos", player_position);
target.draw(this->shape, shader);
}
else
{
target.draw(this->shape);
}
}