forked from jwcpp/jwEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLua_EventLoop.cpp
More file actions
39 lines (31 loc) · 733 Bytes
/
Copy pathLua_EventLoop.cpp
File metadata and controls
39 lines (31 loc) · 733 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "EventLoop.h"
#include "sol/sol.hpp"
/*
class EventLoop : public Singleton<EventLoop>
{
public:
void init();
int run();
void stop();
void exit();
uv_loop_t* getLoop();
private:
uv_loop_t* mLoop;
};
*/
class Lua_EventLoop
{
public:
static void init() { EventLoop::Instance()->init(); }
static void run() { EventLoop::Instance()->run(); }
static void stop() { EventLoop::Instance()->stop(); }
static void exit() { EventLoop::Instance()->exit(); }
};
void luabind_eventloop(sol::state & lua)
{
//lua["eventobj"] = EventLoop::Instance();
lua["event_init"] = &Lua_EventLoop::init;
lua["event_run"] = &Lua_EventLoop::run;
lua["event_stop"] = &Lua_EventLoop::stop;
lua["event_exit"] = &Lua_EventLoop::exit;
}