-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRegularTile.cpp
41 lines (30 loc) · 942 Bytes
/
RegularTile.cpp
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
#include "stdafx.h"
#include "RegularTile.h"
RegularTile::RegularTile(short type, int grid_x, int grid_y, float gridSizeF, const sf::Texture& texture, const sf::IntRect& texture_rect, bool collision = false)
: Tile(type, grid_x, grid_y, gridSizeF, texture, texture_rect, collision)
{
}
RegularTile::~RegularTile()
{
}
// Functions
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();
}
void RegularTile::update()
{
}
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);
}
}