Last active
January 29, 2017 01:32
-
-
Save PoetaKodu/2b28e48f033a854106026105e6d7c23b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class IActor | |
{ | |
public: | |
/* Konstruktor aktora. | |
*/ | |
inline IActor() | |
: m_rotation(0) | |
{ | |
} | |
/* Destruktor aktora. | |
*/ | |
inline virtual ~IActor() {} | |
/* Ustawia pozycje aktora na podaną w [location] | |
*/ | |
inline virtual void SetLocation(const grim::Vector2 &location) { m_location = location; } | |
/* Ustawia rotację aktora na podaną w [rotation] | |
*/ | |
inline virtual void SetRotation(const float &rotation) { m_rotation = rotation; } | |
/* Porusza obiekt względem aktualnej pozycji o [delta] jednostek. | |
*/ | |
inline void Move(const grim::Vector2 &delta) { this->SetLocation(m_location + delta); } | |
/* Obraca obiekt względem aktualnego obrotu o [delta] stopni | |
*/ | |
inline void Rotate(const float &delta) { this->SetRotation(m_rotation + delta); } | |
/* Metoda służąca do uaktualniania obiektu. Sam aktor nie jest jeszcze kompletnym obiektem | |
dlatego ta metoda jest tutaj pusta. | |
*/ | |
inline virtual void Update(const float &deltaTime) {} | |
/* Metoda służąca do wyswietlania aktora. Początkowo aktor nie posiada nic do wyświetlenia, | |
klasy pochodne mają tutaj dowolność, jednak muszą mieć zdefiniowaną tą funkcję, gdyż jest | |
ona czysto wirtualna. | |
*/ | |
virtual void Draw() = 0; | |
/* Pobiera aktualną pozycję aktora. */ | |
inline grim::Vector2 GetLocation() const { return m_location; } | |
/* Pobiera aktualny obrót aktora. */ | |
inline float GetRotation() const { return m_rotation; } | |
protected: | |
grim::Vector2 m_location; // Zawiera informację, gdzie aktor aktualnie się znajduje. | |
float m_rotation; // Zawiera informację o obrocie aktora. | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment