43 lines
803 B
C++
43 lines
803 B
C++
#ifndef LUA_DATA_H
|
|
#define LUA_DATA_H
|
|
#include "lua.hpp"
|
|
#include <iostream>
|
|
#include <Ogre.h>
|
|
#include <OgreSerializer.h>
|
|
#include <flecs.h>
|
|
namespace ECS
|
|
{
|
|
struct LuaData {
|
|
lua_State *L;
|
|
std::vector<int> setup_handlers;
|
|
int setup_handler();
|
|
int call_handler(const Ogre::String &event);
|
|
int call_handler(const Ogre::String &event, flecs::entity e,
|
|
flecs::entity o);
|
|
|
|
LuaData();
|
|
virtual ~LuaData();
|
|
void lateSetup();
|
|
};
|
|
struct LuaBase {
|
|
LuaData *mLua;
|
|
bool setup_called;
|
|
bool startup_called;
|
|
};
|
|
struct LuaModule {
|
|
LuaModule(flecs::world &ecs);
|
|
};
|
|
struct LuaEvent {
|
|
struct Event {
|
|
Ogre::String event;
|
|
flecs::entity e1, e2;
|
|
};
|
|
std::list<Event> events;
|
|
void add(const Ogre::String &event, flecs::entity e1, flecs::entity e2)
|
|
{
|
|
events.push_back({ event, e1, e2 });
|
|
}
|
|
};
|
|
}
|
|
#endif
|