[Orxonox-commit 7182] r11799 - in code/branches/cegui0.8_ogre1.9/data/gui: layouts scripts
landauf at orxonox.net
landauf at orxonox.net
Fri Feb 23 00:20:36 CET 2018
Author: landauf
Date: 2018-02-23 00:20:35 +0100 (Fri, 23 Feb 2018)
New Revision: 11799
Modified:
code/branches/cegui0.8_ogre1.9/data/gui/layouts/HostMenu.layout
code/branches/cegui0.8_ogre1.9/data/gui/scripts/GUITools.lua
code/branches/cegui0.8_ogre1.9/data/gui/scripts/HostMenu.lua
code/branches/cegui0.8_ogre1.9/data/gui/scripts/MultiplayerMenu.lua
code/branches/cegui0.8_ogre1.9/data/gui/scripts/ShipSelectionMenu.lua
code/branches/cegui0.8_ogre1.9/data/gui/scripts/SingleplayerConfigMenu.lua
Log:
updated HostMenu.lua, MultiplayerMenu.lua, ShipSelectionMenu.lua, SingleplayerConfigMenu.lua to cegui 0.8
Modified: code/branches/cegui0.8_ogre1.9/data/gui/layouts/HostMenu.layout
===================================================================
--- code/branches/cegui0.8_ogre1.9/data/gui/layouts/HostMenu.layout 2018-02-22 11:20:34 UTC (rev 11798)
+++ code/branches/cegui0.8_ogre1.9/data/gui/layouts/HostMenu.layout 2018-02-22 23:20:35 UTC (rev 11799)
@@ -34,7 +34,7 @@
<Property name="Text" value="show all" />
<Property name="MaxSize" value="{{1,0},{1,0}}" />
<Property name="Area" value="{{0.8,0},{0.87,0},{1,0},{.97,0}}" />
- <Event function="HostMenu.MultiplayerShowAll_clicked" name="CheckStateChanged" />
+ <Event function="HostMenu.MultiplayerShowAll_clicked" name="SelectStateChanged" />
</Window>
</Window>
<Window name="HostMenuStartButton" type="MenuWidgets/Button">
Modified: code/branches/cegui0.8_ogre1.9/data/gui/scripts/GUITools.lua
===================================================================
--- code/branches/cegui0.8_ogre1.9/data/gui/scripts/GUITools.lua 2018-02-22 11:20:34 UTC (rev 11798)
+++ code/branches/cegui0.8_ogre1.9/data/gui/scripts/GUITools.lua 2018-02-22 23:20:35 UTC (rev 11799)
@@ -30,8 +30,8 @@
local size = {}
local lookAndFeel = CEGUI.WidgetLookManager:getSingleton():getWidgetLook(window:getLookNFeel())
- local height = window:getFont():getLineSpacing() + window:getUnclippedOuterRect():getHeight() - lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window):getHeight()
- local width = window:getFont():getTextExtent(window:getText()) + window:getUnclippedOuterRect():getWidth() - lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window):getWidth()
+ local height = window:getFont():getLineSpacing() + window:getUnclippedOuterRect():get():getHeight() - lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window):getHeight()
+ local width = window:getFont():getTextExtent(window:getText()) + window:getUnclippedOuterRect():get():getWidth() - lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window):getWidth()
table.insert(size, height)
table.insert(size, width)
@@ -39,8 +39,8 @@
end
function getScrollingStepSize(window)
- local height = window:getUnclippedOuterRect():getHeight()
- local maxHeight = CEGUI.System:getSingleton():getGUISheet():getUnclippedOuterRect():getHeight()
+ local height = window:getUnclippedOuterRect():get():getHeight()
+ local maxHeight = window:getRootWindow():getUnclippedOuterRect():get():getHeight()
local ratio = height/maxHeight
return 0.008*ratio/0.3204
end
Modified: code/branches/cegui0.8_ogre1.9/data/gui/scripts/HostMenu.lua
===================================================================
--- code/branches/cegui0.8_ogre1.9/data/gui/scripts/HostMenu.lua 2018-02-22 11:20:34 UTC (rev 11798)
+++ code/branches/cegui0.8_ogre1.9/data/gui/scripts/HostMenu.lua 2018-02-22 23:20:35 UTC (rev 11799)
@@ -10,18 +10,18 @@
function P.onLoad()
P.multiplayerMode = "startServer"
- local window = winMgr:getWindow("orxonox/MultiplayerShowAllCheckbox")
- local button = tolua.cast(window,"CEGUI::Checkbox")
+ local window = P.window:getChild("HostMenuWindow/MultiplayerShowAllCheckbox")
+ local button = tolua.cast(window,"CEGUI::ToggleButton")
button:setSelected(false)
P.createLevelList()
P:setButton(1, 1, {
- ["button"] = winMgr:getWindow("orxonox/HostMenuStartButton"),
+ ["button"] = P.window:getChild("HostMenuStartButton"),
["callback"] = P.HostMenuStartButton_clicked
})
P:setButton(1, 2, {
- ["button"] = winMgr:getWindow("orxonox/HostMenuBackButton"),
+ ["button"] = P.window:getChild("HostMenuBackButton"),
["callback"] = P.HostMenuBackButton_clicked
})
end
@@ -28,14 +28,14 @@
function P.onShow()
if P.showAll ~= orxonox.GUIManager:inDevMode() then
- local window = winMgr:getWindow("orxonox/MultiplayerShowAllCheckbox")
- local button = tolua.cast(window,"CEGUI::Checkbox")
+ local window = P.window:getChild("HostMenuWindow/MultiplayerShowAllCheckbox")
+ local button = tolua.cast(window,"CEGUI::ToggleButton")
P.showAll = not P.showAll
button:setSelected(P.showAll)
end
if P.multiplayerMode == "startServer" then
- local window = winMgr:getWindow("orxonox/HostMenuHostButton")
+ local window = P.window:getChild("HostMenuWindow/HostMenuHostButton")
local button = tolua.cast(window,"CEGUI::RadioButton")
button:setSelected(true)
P.createLevelList()
@@ -42,7 +42,7 @@
end
if P.multiplayerMode == "startDedicated" then
- local window = winMgr:getWindow("orxonox/HostMenuDedicatedButton")
+ local window = P.window:getChild("HostMenuWindow/HostMenuDedicatedButton")
local button = tolua.cast(window,"CEGUI::RadioButton")
button:setSelected(true)
P.createLevelList()
@@ -52,7 +52,7 @@
function P.createLevelList()
P.levelList = {}
P.itemList = {}
- local listbox = CEGUI.toListbox(winMgr:getWindow("orxonox/HostMenuListbox"))
+ local listbox = CEGUI.toListbox(P.window:getChild("HostMenuWindow/HostMenuListbox"))
listbox:resetList()
orxonox.GUIManager:setItemTooltipsEnabledHelper(listbox, true)
local preselect = orxonox.LevelManager:getInstance():getDefaultLevel()
@@ -97,7 +97,7 @@
end
function P.HostMenuStartButton_clicked(e)
- local listbox = CEGUI.toListbox(winMgr:getWindow("orxonox/HostMenuListbox"))
+ local listbox = CEGUI.toListbox(P.window:getChild("HostMenuWindow/HostMenuListbox"))
local choice = listbox:getFirstSelectedItem()
if choice ~= nil then
local index = listbox:getItemIndex(choice)
@@ -110,7 +110,7 @@
end
function P.MultiplayerShowAll_clicked(e)
- local checkbox = tolua.cast(winMgr:getWindow("orxonox/MultiplayerShowAllCheckbox"), "CEGUI::Checkbox")
+ local checkbox = tolua.cast(P.window:getChild("HostMenuWindow/MultiplayerShowAllCheckbox"), "CEGUI::ToggleButton")
local show = checkbox:isSelected()
if show ~= P.showAll then
P.showAll = show
Modified: code/branches/cegui0.8_ogre1.9/data/gui/scripts/MultiplayerMenu.lua
===================================================================
--- code/branches/cegui0.8_ogre1.9/data/gui/scripts/MultiplayerMenu.lua 2018-02-22 11:20:34 UTC (rev 11798)
+++ code/branches/cegui0.8_ogre1.9/data/gui/scripts/MultiplayerMenu.lua 2018-02-22 23:20:35 UTC (rev 11799)
@@ -11,17 +11,17 @@
--button are arranged in a 3x2 matrix, Join and Host buttons are in the upper left and middle, the back button in the lower right of the table
P:setButton(1, 1, {
- ["button"] = winMgr:getWindow("orxonox/MultiplayerJoinButton"),
+ ["button"] = P.window:getChild("MultiplayerJoinButton"),
["callback"] = P.MultiplayerJoinButton_clicked
})
P:setButton(1, 2, {
- ["button"] = winMgr:getWindow("orxonox/MultiplayerHostButton"),
+ ["button"] = P.window:getChild("MultiplayerHostButton"),
["callback"] = P.MultiplayerHostButton_clicked
})
P:setButton(2, 3, {
- ["button"] = winMgr:getWindow("orxonox/MultiplayerBackButton"),
+ ["button"] = P.window:getChild("MultiplayerBackButton"),
["callback"] = P.MultiplayerBackButton_clicked
})
end
@@ -30,12 +30,12 @@
--P.showServerList()
if P.joinMode == 1 then
- local window = winMgr:getWindow("orxonox/MultiplayerLanButton")
+ local window = P.window:getChild("MultiplayerWindow/MultiplayerLanButton")
local button = tolua.cast(window,"CEGUI::RadioButton")
button:setSelected(true)
end
if P.joinMode == 2 then
- local window = winMgr:getWindow("orxonox/MultiplayerInternetButton")
+ local window = P.window:getChild("MultiplayerWindow/MultiplayerInternetButton")
local button = tolua.cast(window,"CEGUI::RadioButton")
button:setSelected(true)
end
@@ -65,7 +65,7 @@
function P.MultiplayerJoinButton_clicked(e)
- local choice = winMgr:getWindow("orxonox/MultiplayerListbox"):getFirstSelectedItem()
+ local choice = P.window:getChild("MultiplayerWindow/MultiplayerListbox"):getFirstSelectedItem()
local destination = nil
if choice then
local index = tolua.cast(choice, "CEGUI::ListboxItem"):getID()
@@ -84,7 +84,7 @@
function P.showServerList()
-- LAN Discovery
if P.joinMode == 1 then
- local listbox = winMgr:getWindow("orxonox/MultiplayerListbox")
+ local listbox = P.window:getChild("MultiplayerWindow/MultiplayerListbox")
CEGUI.toListbox(listbox):resetList()
local discovery = orxonox.LANDiscovery:getInstance()
discovery:discover()
@@ -119,7 +119,7 @@
end
-- WAN Discovery
elseif P.joinMode == 2 then
- local listbox = winMgr:getWindow("orxonox/MultiplayerListbox")
+ local listbox = P.window:getChild("MultiplayerWindow/MultiplayerListbox")
CEGUI.toListbox(listbox):resetList()
local discovery = orxonox.WANDiscovery()
orxout("discovering." )
Modified: code/branches/cegui0.8_ogre1.9/data/gui/scripts/ShipSelectionMenu.lua
===================================================================
--- code/branches/cegui0.8_ogre1.9/data/gui/scripts/ShipSelectionMenu.lua 2018-02-22 11:20:34 UTC (rev 11798)
+++ code/branches/cegui0.8_ogre1.9/data/gui/scripts/ShipSelectionMenu.lua 2018-02-22 23:20:35 UTC (rev 11799)
@@ -43,28 +43,28 @@
end
function P.createFilterTab(name) -- generates filter tab and list box, sets handler for selection changes
- tabName = "orxonox/ShipSelectionLevelTab"
+ tabName = "ShipSelectionLevelTab"
-- create new tab window with desired name
listbox = CEGUI.toListbox(winMgr:createWindow("MenuWidgets/Listbox", tabName))
listbox:setText(name)
- listbox:setProperty("UnifiedMaxSize", "{{1,0},{1,0}}")
+ listbox:setProperty("MaxSize", "{{1,0},{1,0}}")
--[[TODO: smaller list if image and description is implemented.
- listbox:setProperty("UnifiedAreaRect", "{{0.05,0},{0.1,0},{0.5,0},{0.675,0}}") --]]
- listbox:setProperty("UnifiedAreaRect", "{{0,0},{0,0},{1,0},{1,0}}")
+ listbox:setProperty("Area", "{{0.05,0},{0.1,0},{0.5,0},{0.675,0}}") --]]
+ listbox:setProperty("Area", "{{0,0},{0,0},{1,0},{1,0}}")
-- fill listbox with items
P.update()
-- listen to selection changes
- orxonox.GUIManager:subscribeEventHelper(listbox, "ItemSelectionChanged", P.name..".ShipSelectionSelectionChanged")
- local tabControl = winMgr:getWindow("orxonox/ShipSelectionTabControl")
- orxonox.GUIManager:subscribeEventHelper(tabControl, "TabSelectionChanged", P.name..".ShipSelectionSelectionChanged")
+ orxonox.GUIManager:subscribeEventHelper(listbox, "SelectionChanged", P.name..".ShipSelectionSelectionChanged")
+ local tabControl = P.window:getChild("ShipSelectionWindow/ShipSelectionTabControl")
+ orxonox.GUIManager:subscribeEventHelper(tabControl, "SelectionChanged", P.name..".ShipSelectionSelectionChanged")
if listbox:getItemCount() > 0 then
- tabControl:addChildWindow(tabName)
+ tabControl:addChild(listbox)
end
end
function P.ShipSelectionGetSelectedModel() --returns selected model, if available.
-- choose the active listbox
- local tabControl = CEGUI.toTabControl(winMgr:getWindow("orxonox/ShipSelectionTabControl"))
+ local tabControl = CEGUI.toTabControl(P.window:getChild("ShipSelectionWindow/ShipSelectionTabControl"))
local listbox = CEGUI.toListbox(tabControl:getTabContentsAtIndex(tabControl:getSelectedTabIndex()))
local choice = listbox:getFirstSelectedItem()
if choice ~= nil then
@@ -79,9 +79,9 @@
function P.ShipSelectionSelectionChanged(e)
--[[ TODO: Get image and description from template file
- local levelImage = winMgr:getWindow("orxonox/ShipSelectionLevelImage")
- local levelDescription = winMgr:getWindow("orxonox/ShipSelectionLevelDescription")
- local configButton = winMgr:getWindow("orxonox/ShipSelectionConfigButton")
+ local levelImage = P.window:getChild("orxonox/ShipSelectionLevelImage")
+ local levelDescription = P.window:getChild("orxonox/ShipSelectionLevelDescription")
+ local configButton = P.window:getChild("orxonox/ShipSelectionConfigButton")
local level = P.ShipSelectionGetSelectedModel()
if level ~= nil then
--local levelXMLFilename = selectedlevel:getXMLFilename()
Modified: code/branches/cegui0.8_ogre1.9/data/gui/scripts/SingleplayerConfigMenu.lua
===================================================================
--- code/branches/cegui0.8_ogre1.9/data/gui/scripts/SingleplayerConfigMenu.lua 2018-02-22 11:20:34 UTC (rev 11798)
+++ code/branches/cegui0.8_ogre1.9/data/gui/scripts/SingleplayerConfigMenu.lua 2018-02-22 23:20:35 UTC (rev 11799)
@@ -15,16 +15,16 @@
P.spaceWidth = 0
function P.onLoad()
- P.sampleWindow = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/SingleplayerConfigMenu/MiscConfigPane/SampleWindow")
+ P.sampleWindow = winMgr:createWindow("MenuWidgets/StaticText", "ConfigWindow/Wrapper/MiscConfigPane/SampleWindow")
P.sampleWindow:setText("SampleText")
P:setButton(1, 1, {
- ["button"] = winMgr:getWindow("orxonox/SingleplayerConfigMenu/CancelButton"),
+ ["button"] = P.window:getChild("CancelButton"),
["callback"] = P.SingleplayerConfigCancelButton_clicked
})
P:setButton(1, 2, {
- ["button"] = winMgr:getWindow("orxonox/SingleplayerConfigMenu/OKButton"),
+ ["button"] = P.window:getChild("OKButton"),
["callback"] = P.SingleplayerConfigOKButton_clicked
})
end
@@ -87,7 +87,7 @@
P.spaceWidth = 10
- local pane = tolua.cast(winMgr:getWindow("orxonox/SingleplayerConfigMenu/MiscConfigPane"), "CEGUI::ScrollablePane")
+ local pane = tolua.cast(P.window:getChild("ConfigWindow/Wrapper/MiscConfigPane"), "CEGUI::ScrollablePane")
size = pane:getViewableArea()
P.editboxWidth = size:getWidth() - P.commandWidth - P.resetWidth - 5*P.spaceWidth
@@ -97,41 +97,42 @@
function P.createLine(k)
local offset = 0
-- destroy config line, if it already exists (otherwise would cause an error)
- if winMgr:isWindowPresent("orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k) then
- winMgr:destroyWindow("orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k)
+ local oldLine = P.window:getChildRecursive("ConfigCommand" .. k)
+ if oldLine ~= nil then
+ winMgr:destroyWindow(oldLine)
end
-- content window for the entire line
- local line = winMgr:createWindow("DefaultWindow", "orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k)
+ local line = winMgr:createWindow("DefaultWindow", "ConfigCommand" .. k)
line:setHeight(CEGUI.UDim(0, P.lineHeight))
line:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, P.lineHeight*(k-1))))
-- config name
- local command = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Command")
+ local command = winMgr:createWindow("MenuWidgets/StaticText", "Command")
command:setText(P.nameList[k])
- command:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.commandWidth), CEGUI.UDim(1, 0)))
+ command:setSize(CEGUI.USize(CEGUI.UDim(0, P.commandWidth), CEGUI.UDim(1, 0)))
command:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0, 0)))
- line:addChildWindow(command)
+ line:addChild(command)
offset = offset + P.commandWidth + P.spaceWidth
-- config value (editable)
- local configvalue = winMgr:createWindow("MenuWidgets/Editbox", "orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Configvalue")
+ local configvalue = winMgr:createWindow("MenuWidgets/Editbox", "Configvalue")
configvalue:setProperty("ReadOnly", "set:False")
local value = orxonox.CommandExecutor:query("getConfig " .. P.commandList[k])
configvalue:setText(value)
- configvalue:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.editboxWidth), CEGUI.UDim(0.9, 0)))
+ configvalue:setSize(CEGUI.USize(CEGUI.UDim(0, P.editboxWidth), CEGUI.UDim(0.9, 0)))
configvalue:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.05, 0)))
-- enable the reset button if the value changed
orxonox.GUIManager:subscribeEventHelper(configvalue, "TextAccepted", P.name .. ".SingleplayerConfigEditbox_textAccepted")
- line:addChildWindow(configvalue)
+ line:addChild(configvalue)
offset = offset + P.editboxWidth + P.spaceWidth
-- reset button (only available when value changed)
- local reset = winMgr:createWindow("MenuWidgets/Button", "orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Reset")
- reset:setSize(CEGUI.UVector2(CEGUI.UDim(0, P.resetWidth), CEGUI.UDim(0.9, 0)))
+ local reset = winMgr:createWindow("MenuWidgets/Button", "Reset")
+ reset:setSize(CEGUI.USize(CEGUI.UDim(0, P.resetWidth), CEGUI.UDim(0.9, 0)))
reset:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.05, 0)))
reset:setText("reset")
orxonox.GUIManager:subscribeEventHelper(reset, "Clicked", P.name .. ".SingleplayerConfigResetButton_clicked")
- line:addChildWindow(reset)
+ line:addChild(reset)
reset:setEnabled(false)
offset = offset + P.resetWidth + P.spaceWidth
@@ -141,12 +142,12 @@
end
function P.createLines()
- local window = winMgr:getWindow("orxonox/SingleplayerConfigMenu/MiscConfigPane")
+ local window = P.window:getChild("ConfigWindow/Wrapper/MiscConfigPane")
for k,v in pairs(P.commandList) do
local line = P.createLine(k)
table.insert(P.linesList, line)
- window:addChildWindow(line)
+ window:addChild(line)
end
local pane = tolua.cast(window, "CEGUI::ScrollablePane")
@@ -156,9 +157,9 @@
function P.SingleplayerConfigOKButton_clicked(e)
for k,v in pairs(P.commandList) do
-- save the changes
- local editbox = winMgr:getWindow("orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Configvalue")
+ local editbox = P.window:getChild("ConfigWindow/Wrapper/MiscConfigPane/ConfigCommand" .. k .. "/Configvalue")
orxonox.CommandExecutor:execute("config " .. P.commandList[k] .. " " .. editbox:getText())
- local resetButton = winMgr:getWindow("orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Reset")
+ local resetButton = P.window:getChild("ConfigWindow/Wrapper/MiscConfigPane/ConfigCommand" .. k .. "/Reset")
resetButton:setEnabled(false)
end
@@ -171,24 +172,24 @@
function P.SingleplayerConfigEditbox_textAccepted(e)
local we = CEGUI.toWindowEventArgs(e)
- local name = we.window:getName()
+ local name = we.window:getNamePath()
local match = string.gmatch(name, "%d+")
local commandNr = tonumber(match())
- local resetButton = winMgr:getWindow("orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. commandNr .. "/Reset")
+ local resetButton = P.window:getChild("ConfigWindow/Wrapper/MiscConfigPane/ConfigCommand" .. commandNr .. "/Reset")
resetButton:setEnabled(true)
end
function P.SingleplayerConfigResetButton_clicked(e)
local we = CEGUI.toWindowEventArgs(e)
- local name = we.window:getName()
+ local name = we.window:getNamePath()
local match = string.gmatch(name, "%d+")
local commandNr = tonumber(match())
-- reload the old value
- local editbox = winMgr:getWindow("orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. commandNr .. "/Configvalue")
+ local editbox = P.window:getChild("ConfigWindow/Wrapper/MiscConfigPane/ConfigCommand" .. commandNr .. "/Configvalue")
local value = orxonox.CommandExecutor:query("getConfig " .. P.commandList[commandNr])
editbox:setText(value)
More information about the Orxonox-commit
mailing list