Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-lysiuk committed Jan 3, 2024
1 parent 867a10f commit 3eaa766
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 5 additions & 3 deletions Misc/qs_pak/scripts/qimgui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ function qimgui.updatetools()
local _, isopen = imgui.Checkbox(tool.title, wasopen)

if wasopen and not isopen then
tool:onclose()
qimgui.windows[title] = nil
tool:onclose()
elseif not wasopen and isopen then
tool:onopen()
qimgui.windows[title] = tool
Expand Down Expand Up @@ -37,11 +37,13 @@ function qimgui.scratchpad()

local onupdate = function (self)
imgui.Begin(title)

_, self.text = imgui.InputTextMultiline('##text', self.text, 1024 * 1024)
imgui.End()
end

return qimgui.basictool(title, onupdate)
local scratchpad = qimgui.basictool(title, onupdate)
scratchpad.text = ''
return scratchpad
end

table.insert(qimgui.tools, qimgui.scratchpad())
6 changes: 2 additions & 4 deletions Quake/ig_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ static void* ig_eventuserdata;
#ifdef USE_LUA_SCRIPTING

static const char* ls_qimgui_name = "qimgui";
static const char* ls_windows_name = "windows";
static const char* ls_tools_name = "tools";

void LS_InitImGuiModule(lua_State* state)
{
Expand All @@ -65,9 +63,9 @@ void LS_InitImGuiModule(lua_State* state)
lua_pushvalue(state, -1); // copy for lua_setfield()
lua_setglobal(state, ls_qimgui_name);
lua_createtable(state, 0, 16);
lua_setfield(state, -2, ls_windows_name);
lua_setfield(state, -2, "windows");
lua_createtable(state, 0, 16);
lua_setfield(state, -2, ls_tools_name);
lua_setfield(state, -2, "tools");
lua_pop(state, 1); // remove qimgui global table

LS_LoadScript(state, "scripts/qimgui.lua");
Expand Down

0 comments on commit 3eaa766

Please sign in to comment.