30 lines
579 B
C++
30 lines
579 B
C++
|
#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
|