Dynamic Font
TreeView 测试

UI编辑器测试

lyo posted @ 2013年5月04日 01:15 in Hybrid with tags mac ios Hybrid , 1146 阅读

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

登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter