Add game.ui.obj
This commit is contained in:
parent
943601bc3a
commit
96da001734
12
src/luaapi.c
12
src/luaapi.c
@ -1332,6 +1332,7 @@ static int game_camfocus(lua_State *L) {
|
|||||||
#define MENUITEM_LABEL 1
|
#define MENUITEM_LABEL 1
|
||||||
#define MENUITEM_TEXTBUTTON 2
|
#define MENUITEM_TEXTBUTTON 2
|
||||||
#define MENUITEM_TEXTINPUT 3
|
#define MENUITEM_TEXTINPUT 3
|
||||||
|
#define MENUITEM_OBJ 4
|
||||||
struct menuitem {
|
struct menuitem {
|
||||||
int type;
|
int type;
|
||||||
struct k3MObj *ptr;
|
struct k3MObj *ptr;
|
||||||
@ -2021,6 +2022,14 @@ static int dagame_send(lua_State *L) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int dagame_ui_obj(lua_State *L) {
|
||||||
|
struct menuitem *item = lua_newuserdata(L, sizeof(*item));
|
||||||
|
item->type = MENUITEM_OBJ;
|
||||||
|
item->ptr = (void*) k3MObj();
|
||||||
|
luaL_setmetatable(L, "k3menuitem");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static int dagame_ui_screen(lua_State *L) {
|
static int dagame_ui_screen(lua_State *L) {
|
||||||
struct menuitem *item = lua_newuserdata(L, sizeof(*item));
|
struct menuitem *item = lua_newuserdata(L, sizeof(*item));
|
||||||
item->type = MENUITEM_SCREEN;
|
item->type = MENUITEM_SCREEN;
|
||||||
@ -2923,6 +2932,9 @@ void luaapi_init() {
|
|||||||
|
|
||||||
k3Log(k3_DEBUG, "Creating table game.ui");
|
k3Log(k3_DEBUG, "Creating table game.ui");
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
|
lua_pushcfunction(L, dagame_ui_obj);
|
||||||
|
lua_setfield(L, -2, "obj");
|
||||||
|
|
||||||
lua_pushcfunction(L, dagame_ui_screen);
|
lua_pushcfunction(L, dagame_ui_screen);
|
||||||
lua_setfield(L, -2, "screen");
|
lua_setfield(L, -2, "screen");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user