feat: created node base class
parent
67ae79d73b
commit
9140081f53
|
@ -0,0 +1,4 @@
|
||||||
|
#include "node.hpp"
|
||||||
|
|
||||||
|
namespace ce {
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
#ifndef CANVAS_NODE_HPP
|
||||||
|
#define CANVAS_NODE_HPP
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <map>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace ce {
|
||||||
|
class Node {
|
||||||
|
private:
|
||||||
|
std::string name{};
|
||||||
|
std::map<std::string, std::unique_ptr<Node>> nodes{};
|
||||||
|
public:
|
||||||
|
Node() = default;
|
||||||
|
virtual ~Node() = default;
|
||||||
|
virtual void on_added(Node *parent) = 0;
|
||||||
|
virtual void on_tick(double delta_time) = 0;
|
||||||
|
virtual void on_removed(Node *former_parent) = 0;
|
||||||
|
|
||||||
|
void add_child(Node *child);
|
||||||
|
void remove_child(Node *child);
|
||||||
|
Node *get_child(char const *find_name);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // !CANVAS_NODE_HPP
|
Loading…
Reference in New Issue