local guiSystem = CEGUI.System:getSingleton() local schemeMgr = CEGUI.SchemeManager:getSingleton() local winMgr = CEGUI.WindowManager:getSingleton() -- load our demo8 scheme schemeMgr:create("Demo8.scheme"); -- load our demo8 window layout local root = winMgr:loadWindowLayout("Demo8.layout") -- set the layout as the root guiSystem:setGUISheet(root) -- set default mouse cursor guiSystem:setDefaultMouseCursor("TaharezLook", "MouseArrow") -- set the Tooltip type guiSystem:setDefaultTooltip("TaharezLook/Tooltip")
这里获取了 CEGUI的 System, SchemeManager, WindowManager 的对象
分别载入了scheme,layout 文件
最后设置了default Mouse cursor 和 default tool tip
这些东西显然在lua里面做比较方便 不用去修改CPP 然后去编译
UI事件提交:
-- subscribe required events
winMgr:getWindow("Demo8/Window1/Controls/Add"):subscribeEvent("Clicked", "EventDBClickButton")
"EventDBClickButton" 对应了一个lua函数
function EventDBClickButton(args)
local we = CEGUI.toWindowEventArgs(args)
we.window:setText("what a fucking day!");
end