-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgameEntity.cpp
62 lines (49 loc) · 926 Bytes
/
gameEntity.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
* gameEntity.cpp
*
* Created on: Dec 31, 2015
* Author: alexander
*/
#include "gameEntity.hpp"
gameEntity::gameEntity() : isLoaded(false){
}
gameEntity::~gameEntity(){
}
void gameEntity::onLoad(std::string filename){
if( !(entityTexture.loadFromFile(filename)) ){
fileName = "";
isLoaded = false;
}else{
fileName = filename;
entitySprite.setTexture(entityTexture);
}
}
void gameEntity::onLoop(){
}
void gameEntity::onRender(sf::RenderWindow& mainWindow){
if(isLoaded){
mainWindow.draw(entitySprite);
}
}
void gameEntity::onCleanup(){
}
void gameEntity::setPosition(float x,float y){
if(isLoaded){
entitySprite.setPosition(x,y);
}
}
sf::Vector2f gameEntity::getPosition() const
{
if(isLoaded){
entitySprite.getPosition();
}
return sf::Vector2f();
}
sf::Sprite& gameEntity::getSprite()
{
return entitySprite;
}
bool gameEntity::IsLoaded() const
{
return isLoaded;
}