This commit is contained in:
baidwwy 2021-05-08 02:30:20 +08:00
parent 517b8faeaf
commit 78a85d4a67
6 changed files with 121 additions and 45 deletions

View File

@ -1,10 +1,12 @@
--[[ --[[
@Author : GGELUA @Author : GGELUA
@Date : 2021-04-24 16:49:40 @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 SDL = require("SDL")
local im = require"gimgui" local im = require"gimgui"
require("IMGUI.按钮")
require("IMGUI.菜单")
im.Init(:()) im.Init(:())
im._ev = SDL.AddEventHook(function (ev) im._ev = SDL.AddEventHook(function (ev)

View File

@ -1,7 +1,7 @@
--[[ --[[
@Author : GGELUA @Author : GGELUA
@Date : 2021-04-24 17:08:13 @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" local im = require"gimgui"
@ -41,4 +41,12 @@ end
function IMBase:提示(t) function IMBase:提示(t)
return im.SetTooltip(t) return im.SetTooltip(t)
end end
function IMBase:是否选中()
return self[1]
end
function IMBase:取值()
return self[1]
end
return IMBase return IMBase

View File

@ -1,7 +1,7 @@
--[[ --[[
@Author : GGELUA @Author : GGELUA
@Date : 2021-04-24 16:36:37 @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 im = require"gimgui"
local IMBase = require"IMGUI.基类" local IMBase = require"IMGUI.基类"
@ -13,19 +13,45 @@ function IM按钮:初始化(name,def)
self[1] = def==true self[1] = def==true
end end
function IM按钮:按钮() function IM按钮:显示(x,y)
return im.Button(self._name) return im.Button(self._name)
end 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) return im.Checkbox(self._name,self)
end 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 end
function IM按钮:是否选中() function IM纹理按钮:显示(x,y)
return self[1] local ptr = self._tex:():GetTexturePointer()
return im.ImageButton(ptr)
end end
return IM按钮 return IM按钮

View File

@ -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纹理

View File

@ -1,44 +1,66 @@
--[[ --[[
@Author : GGELUA @Author : GGELUA
@Date : 2021-04-24 17:17:10 @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 im = require"gimgui"
local IMBase = require"IMGUI.基类" 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._name = name
self._shortcut = shortcut self._shortcut = shortcut
end end
function IM菜单:主菜单栏开始() 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菜单:菜单项目()
if self._selected~=nil then if self._selected~=nil then
self._selected = im.MenuItem(self._name,self._shortcut,self._selected,self._enabled) self._selected = im.MenuItem(self._name,self._shortcut,self._selected,self._enabled)
else else
@ -47,17 +69,18 @@ function IM菜单:菜单项目()
return self._selected return self._selected
end end
function IM菜单:置禁止(enabled) function IM菜单选项:置禁止(enabled)
self._enabled = enabled self._enabled = enabled
return self return self
end end
function IM菜单:置选中(selected) function IM菜单选项:置选中(selected)
self._selected = selected self._selected = selected
return self return self
end end
function IM菜单:是否选中() function IM菜单选项:是否选中()
return self._selected return self._selected
end end
return IM菜单 return IM菜单

View File

@ -1,7 +1,7 @@
--[[ --[[
@Author : GGELUA @Author : GGELUA
@Date : 2021-04-24 16:25:27 @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 im = require"gimgui"
local IMBase = require"IMGUI.基类" local IMBase = require"IMGUI.基类"
@ -26,7 +26,7 @@ function IM输入:初始化(name,def,len)
end end
end end
function IM输入:更新() function IM输入:显示()
IMBase.(self) IMBase.(self)
if self._tp == 1 then if self._tp == 1 then
return im.InputText(self._name,self) return im.InputText(self._name,self)
@ -37,8 +37,5 @@ function IM输入:更新()
end end
end end
function IM输入:取值()
return self[1]
end
return IM输入 return IM输入