-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEyes.cpp
34 lines (28 loc) · 905 Bytes
/
Eyes.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
#include "Eyes.hpp"
#include "Resources.hpp"
#include "utils.hpp"
Eyes::Eyes() {
setTexture();
}
void Eyes::setTexture(){
sprite.setTexture(Resources::eyes);
sprite.setOrigin(sprite.getLocalBounds().width/2, sprite.getLocalBounds().height/2);
//print("init eyes");
}
void Eyes::setSize(float sizeX, float sizeY){
sprite.setScale(sizeX/sprite.getLocalBounds().width, sizeY/sprite.getLocalBounds().height);
sprite.setOrigin(sprite.getLocalBounds().width/2, sprite.getLocalBounds().height/2);
// print("setsizeeyes");
}
void Eyes::draw(sf::RenderTarget * window){
window->draw(sprite);
//print("drawingeyes");
}
void Eyes::setPosition(sf::Vector2f pos){
sprite.setPosition(pos);
//print("setpositioneyes");
}
sf::Vector2f Eyes::getSize(){
//print("getsizeeyes");
return sf::Vector2f(sprite.getGlobalBounds().width, sprite.getGlobalBounds().height);
}