diff --git a/GGELUA/Release64/lua/IMGUI/IMGUI.lua b/GGELUA/Release64/lua/IMGUI/IMGUI.lua index 1ca1765..c8fa352 100644 --- a/GGELUA/Release64/lua/IMGUI/IMGUI.lua +++ b/GGELUA/Release64/lua/IMGUI/IMGUI.lua @@ -1,10 +1,12 @@ --[[ @Author : GGELUA @Date : 2021-04-24 16:49:40 - @LastEditTime : 2021-04-25 12:02:12 + @LastEditTime : 2021-05-08 01:47:26 --]] local SDL = require("SDL") local im = require"gimgui" +require("IMGUI.按钮") +require("IMGUI.菜单") im.Init(引擎:取对象()) im._ev = SDL.AddEventHook(function (ev) diff --git a/GGELUA/Release64/lua/IMGUI/基类.lua b/GGELUA/Release64/lua/IMGUI/基类.lua index 880f3c2..d633462 100644 --- a/GGELUA/Release64/lua/IMGUI/基类.lua +++ b/GGELUA/Release64/lua/IMGUI/基类.lua @@ -1,7 +1,7 @@ --[[ @Author : GGELUA @Date : 2021-04-24 17:08:13 - @LastEditTime : 2021-04-24 20:09:17 + @LastEditTime : 2021-05-08 01:35:51 --]] local im = require"gimgui" @@ -41,4 +41,12 @@ end function IMBase:提示(t) return im.SetTooltip(t) end + +function IMBase:是否选中() + return self[1] +end + +function IMBase:取值() + return self[1] +end return IMBase \ No newline at end of file diff --git a/GGELUA/Release64/lua/IMGUI/按钮.lua b/GGELUA/Release64/lua/IMGUI/按钮.lua index 0832a64..0187175 100644 --- a/GGELUA/Release64/lua/IMGUI/按钮.lua +++ b/GGELUA/Release64/lua/IMGUI/按钮.lua @@ -1,7 +1,7 @@ --[[ @Author : GGELUA @Date : 2021-04-24 16:36:37 - @LastEditTime : 2021-04-24 19:01:47 + @LastEditTime : 2021-05-08 01:50:47 --]] local im = require"gimgui" local IMBase = require"IMGUI.基类" @@ -13,19 +13,45 @@ function IM按钮:初始化(name,def) self[1] = def==true end -function IM按钮:按钮() +function IM按钮:显示(x,y) return im.Button(self._name) end +--===================================================== +local IM单选按钮 = class('IM单选按钮',"IMBase") +package.loaded["IMGUI.单选按钮"] = IM单选按钮 -function IM按钮:复选按钮() +function IM单选按钮:初始化(name,def) + self._name = name + self[1] = def==true +end + +function IM单选按钮:显示(x,y) + return im.RadioButton(self._name,self) +end +--===================================================== +local IM复选按钮 = class('IM复选按钮',"IMBase") +package.loaded["IMGUI.复选按钮"] = IM复选按钮 + +function IM复选按钮:初始化(name,def) + self._name = name + self[1] = def==true +end + +function IM复选按钮:显示(x,y) return im.Checkbox(self._name,self) end -function IM按钮:单选按钮() - return im.RadioButton(self._name,self) +--===================================================== +local IM纹理按钮 = class('IM纹理按钮',"IMBase") +package.loaded["IMGUI.纹理按钮"] = IM纹理按钮 + +function IM纹理按钮:初始化(tex,def) + self._tex = tex end -function IM按钮:是否选中() - return self[1] +function IM纹理按钮:显示(x,y) + local ptr = self._tex:取对象():GetTexturePointer() + return im.ImageButton(ptr) end + return IM按钮 \ No newline at end of file diff --git a/GGELUA/Release64/lua/IMGUI/纹理.lua b/GGELUA/Release64/lua/IMGUI/纹理.lua new file mode 100644 index 0000000..46cb21d --- /dev/null +++ b/GGELUA/Release64/lua/IMGUI/纹理.lua @@ -0,0 +1,20 @@ +--[[ + @Author : GGELUA + @Date : 2021-05-08 01:11:14 + @LastEditTime : 2021-05-08 01:49:43 +--]] +local im = require"gimgui" +local IMBase = require"IMGUI.基类" + +local IM纹理 = class('IM纹理',"IMBase") + +function IM纹理:初始化(t) + self._tex = t +end + +function IM纹理:显示(x,y) + local ptr = self._tex:取对象():GetTexturePointer() + im.Image(ptr) +end + +return IM纹理 \ No newline at end of file diff --git a/GGELUA/Release64/lua/IMGUI/菜单.lua b/GGELUA/Release64/lua/IMGUI/菜单.lua index e195a46..2e06f77 100644 --- a/GGELUA/Release64/lua/IMGUI/菜单.lua +++ b/GGELUA/Release64/lua/IMGUI/菜单.lua @@ -1,44 +1,66 @@ --[[ @Author : GGELUA @Date : 2021-04-24 17:17:10 - @LastEditTime : 2021-04-25 11:37:41 + @LastEditTime : 2021-05-08 02:03:11 --]] local im = require"gimgui" local IMBase = require"IMGUI.基类" -local IM菜单 = class('IM菜单') +local IM菜单 = class('IM菜单',"IMBase") -function IM菜单:初始化(name,shortcut) +function IM菜单:初始化(name,enabled) + self._name = name + self._enabled = enabled +end + +function IM菜单:开始() + return im.BeginMenu(self._name,self._enabled) +end + +function IM菜单:结束() + return im.EndMenu() +end + +function IM菜单:置禁止(enabled) + self._enabled = enabled + return self +end + +--===================================================== +local IM顶部菜单 = class('IM顶部菜单',"IMBase") +package.loaded["IMGUI.顶部菜单"] = IM顶部菜单 + +function IM顶部菜单:开始() + return im.BeginMainMenuBar() +end + +function IM顶部菜单:结束() + return im.EndMainMenuBar() +end + +--===================================================== +local IM窗口菜单 = class('IM窗口菜单',"IMBase") +package.loaded["IMGUI.窗口菜单"] = IM窗口菜单 + +function IM窗口菜单:开始() + return im.BeginMenuBar() +end + +function IM窗口菜单:结束() + return im.EndMenuBar() +end + +--===================================================== +local IM菜单选项 = class('IM菜单选项',"IMBase") +package.loaded["IMGUI.菜单选项"] = IM菜单选项 + +function IM菜单选项:初始化(name,shortcut) self._name = name self._shortcut = shortcut end -function IM菜单:主菜单栏开始() - return im.BeginMainMenuBar() -end - -function IM菜单:主菜单栏结束() - return im.EndMainMenuBar() -end - -function IM菜单:窗口菜单栏开始() - return im.BeginMenuBar() -end - -function IM菜单:窗口菜单栏结束() - return im.EndMenuBar() -end - -function IM菜单:菜单开始() - return im.BeginMenu(self._name,self._enabled) -end - -function IM菜单:菜单结束() - return im.EndMenu() -end - -function IM菜单:菜单项目() +function IM菜单选项:显示() if self._selected~=nil then self._selected = im.MenuItem(self._name,self._shortcut,self._selected,self._enabled) else @@ -47,17 +69,18 @@ function IM菜单:菜单项目() return self._selected end -function IM菜单:置禁止(enabled) +function IM菜单选项:置禁止(enabled) self._enabled = enabled return self end -function IM菜单:置选中(selected) +function IM菜单选项:置选中(selected) self._selected = selected return self end -function IM菜单:是否选中() +function IM菜单选项:是否选中() return self._selected end + return IM菜单 \ No newline at end of file diff --git a/GGELUA/Release64/lua/IMGUI/输入.lua b/GGELUA/Release64/lua/IMGUI/输入.lua index a6593a1..cc04c16 100644 --- a/GGELUA/Release64/lua/IMGUI/输入.lua +++ b/GGELUA/Release64/lua/IMGUI/输入.lua @@ -1,7 +1,7 @@ --[[ @Author : GGELUA @Date : 2021-04-24 16:25:27 - @LastEditTime : 2021-04-24 18:44:01 + @LastEditTime : 2021-05-08 01:36:10 --]] local im = require"gimgui" local IMBase = require"IMGUI.基类" @@ -26,7 +26,7 @@ function IM输入:初始化(name,def,len) end end -function IM输入:更新() +function IM输入:显示() IMBase.更新(self) if self._tp == 1 then return im.InputText(self._name,self) @@ -37,8 +37,5 @@ function IM输入:更新() end end -function IM输入:取值() - return self[1] -end return IM输入 \ No newline at end of file