UI编辑器测试
Hybrid封装,纯Lua实现,继续完善

iOS同样效果,自适应窗口

require "editor/BaseControl"
--------------------------------------------
DebugInfoControl = class("DebugInfoControl", function(parent)
return BaseControl.create("DebugInfo.layout", parent)
end)
DebugInfoControl.__index = DebugInfoControl
function DebugInfoControl.create(parent)
local control = DebugInfoControl.new(parent)
control.textbox= GUICast:toTextBox(control:getWidget("_Main"))
control.frames = 0
control.timer = 0
control:registerEvent("Event_Update", control.update)
return control
end
function DebugInfoControl:update(delta)
self.frames = self.frames+1
self.timer = self.timer+delta
if self.timer > 0.5 then
self.textbox:setCaption(string.format("FPS:%d", self.frames / self.timer))
self.frames = 0
self.timer = 0
end
end
2023年4月13日 02:40
The net worth of a person expresses how rich and popular they are, let's see who is the #1 at the present in celeb networth