This repository has been archived on 2021-04-24. You can view files and clone it, but cannot push or open issues or pull requests.
game/include/Components/TopLevel/GameObject.hpp

30 lines
579 B
C++
Raw Normal View History

2021-02-25 23:13:05 +02:00
#ifndef _GAMEOBJECT_H
#define _GAMEOBJECT_H
#include <iostream>
#include <vector>
#include <map>
#include <functional>
extern "C" {
#include <lua.h>
#include <lauxlib.h>
}
struct GameObject {
GameObject(std::string name) : name(name) {}
std::string name;
std::string type;
GameObject* parent;
std::vector<GameObject*> children;
std::map<std::string, std::function<void()>> handlers;
GameObject& Get(std::string name);
void Add(GameObject* obj);
std::vector<GameObject*>& GetChildren();
};
void registerGameObject(lua_State* L);
#endif