not dealing with SOL2 problem now
This commit is contained in:
parent
46eff44297
commit
e8be36243d
2 changed files with 17 additions and 2 deletions
|
@ -53,8 +53,7 @@ add_library (lualib STATIC
|
||||||
${libsrc}
|
${libsrc}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
target_compile_definitions(lualib PRIVATE LUA_USE_POSIX)
|
||||||
|
|
||||||
|
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
target_link_libraries( lualib m )
|
target_link_libraries( lualib m )
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
namespace pw {
|
namespace pw {
|
||||||
|
|
||||||
|
#if defined(__clang)
|
||||||
struct window_lua : public window {
|
struct window_lua : public window {
|
||||||
// overridable function
|
// overridable function
|
||||||
sol::function lua_update;
|
sol::function lua_update;
|
||||||
|
@ -23,10 +24,13 @@ struct window_lua : public window {
|
||||||
_on_update = [this](window&){this->lua_update();};
|
_on_update = [this](window&){this->lua_update();};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void script_system::load(sol::table &ns)
|
void script_system::load(sol::table &ns)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#if defined(__clang)
|
||||||
ns.new_usertype<window_lua>("window",
|
ns.new_usertype<window_lua>("window",
|
||||||
sol::constructors<window_lua(sol::this_state)>(),
|
sol::constructors<window_lua(sol::this_state)>(),
|
||||||
"on_update",&window_lua::lua_update,
|
"on_update",&window_lua::lua_update,
|
||||||
|
@ -36,6 +40,18 @@ void script_system::load(sol::table &ns)
|
||||||
"position",sol::property(&window::position,&window::set_position),
|
"position",sol::property(&window::position,&window::set_position),
|
||||||
"fullscreen",sol::property(&window::fullscreen,&window::set_fullscreen)
|
"fullscreen",sol::property(&window::fullscreen,&window::set_fullscreen)
|
||||||
);
|
);
|
||||||
|
#else
|
||||||
|
|
||||||
|
|
||||||
|
ns.new_usertype<window>("window",
|
||||||
|
"update",&window::update,
|
||||||
|
"title",sol::writeonly_property(&window::set_title),
|
||||||
|
"size",sol::property(&window::size,&window::set_size),
|
||||||
|
"position",sol::property(&window::position,&window::set_position),
|
||||||
|
"fullscreen",sol::property(&window::fullscreen,&window::set_fullscreen)
|
||||||
|
);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
ns.new_usertype<input>("input",
|
ns.new_usertype<input>("input",
|
||||||
"new", sol::no_constructor,
|
"new", sol::no_constructor,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue