-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSceneNode.h
58 lines (38 loc) · 1.23 KB
/
SceneNode.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <SFML/Graphics.hpp>
#include <list>
#include "Command.h"
#ifndef _SCENENODE_H_
#define _SCENENODE_H_
class SceneNode:
public sf::Drawable,
public sf::Transformable,
public sf::NonCopyable
{
public:
using SceneNodePtr = std::unique_ptr<SceneNode>;
using container_t = std::list<SceneNodePtr>;
using categoryType = unsigned int;
using CommandType = Command;
virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const final override;
virtual void drawCurrent(sf::RenderTarget& target, sf::RenderStates states) const;
void attachChild(SceneNodePtr child);
SceneNodePtr detachChild(SceneNode& node);
int getSize() const;
void setName(const std::string& name);
void setName(std::string&& name);
std::string getName() const;
categoryType getCategory() const;
void setCategory(const categoryType& category);
sf::Transform getWorldTransform() const;
sf::Vector2f getWorldPosition() const;
sf::Transform getParentTransform() const;
void onCommand(const CommandType& command, const sf::Time& dt);
void update(const sf::Time& dt);
virtual void updateCurrent(const sf::Time& dt);
protected:
SceneNode* parent;
container_t childs;
categoryType category;
std::string name;
};
#endif // !_SCENENODE_H_