You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.2 KiB

3 years ago
#include "command.h"
#include <vector>
#include <memory>
#include <SFML/Graphics.hpp>
class SceneNode;
using SceneNodeUPtr = std::unique_ptr<SceneNode>;
using SceneNodeSPtr = std::shared_ptr<SceneNode>;
using SceneNodeConstSPtr = std::shared_ptr<const SceneNode>;
class SceneNode : public std::enable_shared_from_this<SceneNode>,
public sf::Transformable,
public sf::Drawable,
private sf::NonCopyable
explicit SceneNode();
virtual ~SceneNode();
bool attachChild(const SceneNodeSPtr &child);
SceneNodeSPtr detachChild(const SceneNode& node);
sf::Transform getWorldTransform() const;
sf::Vector2f getWorldPosition() const;
void update(const sf::Time& dt);
void onCommand(const Command& command, const sf::Time& dt);
virtual Category::Type category() const;
std::vector<SceneNodeSPtr> vec_children;
SceneNodeSPtr parent;
virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const override final;
virtual void drawCurrent(sf::RenderTarget& target, sf::RenderStates states) const;
virtual void updateCurrent(const sf::Time& dt);
void updateChildren(const sf::Time& dt);
#endif // SCENENODE_H