-
Notifications
You must be signed in to change notification settings - Fork 0
/
Box.h
36 lines (31 loc) · 1010 Bytes
/
Box.h
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
#ifndef SFMLSET_BOX_H
#define SFMLSET_BOX_H
#include <SFML/Graphics.hpp>
#include <iostream>
class Box : public sf::Transformable, public sf::Drawable{
private:
sf::Sprite sprite;
sf::Texture texture;
public:
Box(){
texture.create(500,500);
texture.loadFromFile("White.png");
sprite.setTexture(texture);
sprite.setPosition(500.f, 1500.f);
sprite.setColor(sf::Color::White);
sprite.setTextureRect(sf::IntRect(100, 100, 500, 100));
}
virtual void draw(sf::RenderTarget& window, sf::RenderStates states) const{
window.draw(sprite, states);
}
sf::FloatRect Size(){
return sprite.getGlobalBounds();
}
void SetPosition(sf::Vector2f Position){
sprite.setPosition(Position);
}
sf::Vector2f GetPosition(){return sprite.getPosition();}
float getHeight(){return sprite.getLocalBounds().height;}
void SetHeight(int height){sprite.setTextureRect(sf::IntRect(100, 100, 500, height));}
};
#endif