Files
integration/luprex/core/cpp/gui.cpp

29 lines
698 B
C++
Raw Normal View History

2021-02-07 13:38:29 -05:00
#include "gui.hpp"
LuaDefineType(Gui);
2021-02-16 13:31:34 -05:00
void Gui::menu_item(const std::string &action, const std::string &label) {
2021-02-07 13:38:29 -05:00
GuiElt elt;
elt.type_ = GuiElt::TYPE_MENU_ITEM;
2021-02-16 13:31:34 -05:00
elt.action_ = action;
2021-02-07 13:38:29 -05:00
elt.label_ = label;
elts_.push_back(elt);
}
2021-02-07 15:35:31 -05:00
LuaDefine(gui_create, "c") {
LuaRet lgui;
LuaStack LS(L, lgui);
LS.newpointer<Gui>(lgui, new Gui, true);
return LS.result();
}
2021-02-10 16:22:24 -05:00
LuaDefine(gui_menu_item, "c") {
2021-02-16 13:31:34 -05:00
LuaArg lgui, laction, llabel;
LuaStack LS(L, lgui, laction, llabel);
2021-02-07 15:35:31 -05:00
Gui *gui = LS.ckuserdata<Gui>(lgui);
2021-02-16 13:31:34 -05:00
std::string action = LS.ckstring(laction);
std::string label = LS.ckstring(llabel);
gui->menu_item(action, label);
2021-02-07 15:35:31 -05:00
return LS.result();
}