-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEntity.h
32 lines (25 loc) · 1 KB
/
Entity.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
#pragma once
#include <SFML/Graphics.hpp>
/// ENTITY
/// T H I S will take care of position, physics, movements, textures, sprites, collisions(todo)
///
/// maybe handle rotation from here? Asteroids could have one common texture and we could rotate that to give an illusion of many different asteroids
/// ENTITY
class Entity {
protected:
sf::Vector2f position; // (x, y) position coordinates of the entity
sf::Vector2f velocity; // (x, y) velocity of the entity
sf::Sprite spr;
private:
public:
Entity();
Entity(sf::Texture& in_tex);
Entity(sf::Texture& in_tex, sf::Vector2f in_position);
sf::Vector2f get_position() const { return position; }
sf::Vector2f get_velocity() const { return velocity; }
sf::Sprite get_spr() const { return spr; }
void set_position(sf::Vector2f in_position) { position = in_position; spr.setPosition(position); };
void set_velocity(sf::Vector2f in_velocity) { velocity = in_velocity; }
void set_tex(sf::Texture& in_tex) { spr.setTexture(in_tex); }
void update(float dt);
};