spacebox/src/Node.hpp

59 lines
1.0 KiB
C++

#ifndef Node_h_
#define Node_h_
#include <iostream>
#include "glm/vec2.hpp"
#include "json/json.hpp"
#include "SDL.h"
#include "filesystem.hpp"
struct Game;
struct Delegate;
struct Display;
struct Node
{
Node *parent;
bool active = true;
Node();
Node(Node*);
void set_parent(Node*);
void activate();
void deactivate();
virtual void reset() { deactivate(); };
bool is_active() const;
nlohmann::json& get_configuration();
Delegate& get_delegate();
Display& get_display();
SDL_Renderer* get_renderer();
SDL_Window* get_window();
void suppress_input_temporarily(int = 0);
void print_branch();
virtual std::string get_class_name() { return "Node"; };
virtual ~Node();
template<typename T = Game>
T* get_root()
{
if (parent == NULL)
{
return static_cast<T*>(this);
}
else
{
return parent->get_root<T>();
}
}
};
#include "Configuration.hpp"
#include "Delegate.hpp"
#include "Display.hpp"
#endif