Changeset 11799
- Timestamp:
- Feb 23, 2018, 12:20:35 AM (7 years ago)
- Location:
- code/branches/cegui0.8_ogre1.9/data/gui
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cegui0.8_ogre1.9/data/gui/layouts/HostMenu.layout
r11793 r11799 35 35 <Property name="MaxSize" value="{{1,0},{1,0}}" /> 36 36 <Property name="Area" value="{{0.8,0},{0.87,0},{1,0},{.97,0}}" /> 37 <Event function="HostMenu.MultiplayerShowAll_clicked" name=" CheckStateChanged" />37 <Event function="HostMenu.MultiplayerShowAll_clicked" name="SelectStateChanged" /> 38 38 </Window> 39 39 </Window> -
code/branches/cegui0.8_ogre1.9/data/gui/scripts/GUITools.lua
r11797 r11799 31 31 32 32 local lookAndFeel = CEGUI.WidgetLookManager:getSingleton():getWidgetLook(window:getLookNFeel()) 33 local height = window:getFont():getLineSpacing() + window:getUnclippedOuterRect():get Height() - lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window):getHeight()34 local width = window:getFont():getTextExtent(window:getText()) + window:getUnclippedOuterRect():get Width() - lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window):getWidth()33 local height = window:getFont():getLineSpacing() + window:getUnclippedOuterRect():get():getHeight() - lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window):getHeight() 34 local width = window:getFont():getTextExtent(window:getText()) + window:getUnclippedOuterRect():get():getWidth() - lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window):getWidth() 35 35 36 36 table.insert(size, height) … … 40 40 41 41 function getScrollingStepSize(window) 42 local height = window:getUnclippedOuterRect():get Height()43 local maxHeight = CEGUI.System:getSingleton():getGUISheet():getUnclippedOuterRect():getHeight()42 local height = window:getUnclippedOuterRect():get():getHeight() 43 local maxHeight = window:getRootWindow():getUnclippedOuterRect():get():getHeight() 44 44 local ratio = height/maxHeight 45 45 return 0.008*ratio/0.3204 -
code/branches/cegui0.8_ogre1.9/data/gui/scripts/HostMenu.lua
r11795 r11799 11 11 function P.onLoad() 12 12 P.multiplayerMode = "startServer" 13 local window = winMgr:getWindow("orxonox/MultiplayerShowAllCheckbox")14 local button = tolua.cast(window,"CEGUI:: Checkbox")13 local window = P.window:getChild("HostMenuWindow/MultiplayerShowAllCheckbox") 14 local button = tolua.cast(window,"CEGUI::ToggleButton") 15 15 button:setSelected(false) 16 16 P.createLevelList() 17 17 18 18 P:setButton(1, 1, { 19 ["button"] = winMgr:getWindow("orxonox/HostMenuStartButton"),19 ["button"] = P.window:getChild("HostMenuStartButton"), 20 20 ["callback"] = P.HostMenuStartButton_clicked 21 21 }) 22 22 23 23 P:setButton(1, 2, { 24 ["button"] = winMgr:getWindow("orxonox/HostMenuBackButton"),24 ["button"] = P.window:getChild("HostMenuBackButton"), 25 25 ["callback"] = P.HostMenuBackButton_clicked 26 26 }) … … 29 29 function P.onShow() 30 30 if P.showAll ~= orxonox.GUIManager:inDevMode() then 31 local window = winMgr:getWindow("orxonox/MultiplayerShowAllCheckbox")32 local button = tolua.cast(window,"CEGUI:: Checkbox")31 local window = P.window:getChild("HostMenuWindow/MultiplayerShowAllCheckbox") 32 local button = tolua.cast(window,"CEGUI::ToggleButton") 33 33 P.showAll = not P.showAll 34 34 button:setSelected(P.showAll) … … 36 36 37 37 if P.multiplayerMode == "startServer" then 38 local window = winMgr:getWindow("orxonox/HostMenuHostButton")38 local window = P.window:getChild("HostMenuWindow/HostMenuHostButton") 39 39 local button = tolua.cast(window,"CEGUI::RadioButton") 40 40 button:setSelected(true) … … 43 43 44 44 if P.multiplayerMode == "startDedicated" then 45 local window = winMgr:getWindow("orxonox/HostMenuDedicatedButton")45 local window = P.window:getChild("HostMenuWindow/HostMenuDedicatedButton") 46 46 local button = tolua.cast(window,"CEGUI::RadioButton") 47 47 button:setSelected(true) … … 53 53 P.levelList = {} 54 54 P.itemList = {} 55 local listbox = CEGUI.toListbox( winMgr:getWindow("orxonox/HostMenuListbox"))55 local listbox = CEGUI.toListbox(P.window:getChild("HostMenuWindow/HostMenuListbox")) 56 56 listbox:resetList() 57 57 orxonox.GUIManager:setItemTooltipsEnabledHelper(listbox, true) … … 98 98 99 99 function P.HostMenuStartButton_clicked(e) 100 local listbox = CEGUI.toListbox( winMgr:getWindow("orxonox/HostMenuListbox"))100 local listbox = CEGUI.toListbox(P.window:getChild("HostMenuWindow/HostMenuListbox")) 101 101 local choice = listbox:getFirstSelectedItem() 102 102 if choice ~= nil then … … 111 111 112 112 function P.MultiplayerShowAll_clicked(e) 113 local checkbox = tolua.cast( winMgr:getWindow("orxonox/MultiplayerShowAllCheckbox"), "CEGUI::Checkbox")113 local checkbox = tolua.cast(P.window:getChild("HostMenuWindow/MultiplayerShowAllCheckbox"), "CEGUI::ToggleButton") 114 114 local show = checkbox:isSelected() 115 115 if show ~= P.showAll then -
code/branches/cegui0.8_ogre1.9/data/gui/scripts/MultiplayerMenu.lua
r11795 r11799 12 12 --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 13 13 P:setButton(1, 1, { 14 ["button"] = winMgr:getWindow("orxonox/MultiplayerJoinButton"),14 ["button"] = P.window:getChild("MultiplayerJoinButton"), 15 15 ["callback"] = P.MultiplayerJoinButton_clicked 16 16 }) 17 17 18 18 P:setButton(1, 2, { 19 ["button"] = winMgr:getWindow("orxonox/MultiplayerHostButton"),19 ["button"] = P.window:getChild("MultiplayerHostButton"), 20 20 ["callback"] = P.MultiplayerHostButton_clicked 21 21 }) 22 22 23 23 P:setButton(2, 3, { 24 ["button"] = winMgr:getWindow("orxonox/MultiplayerBackButton"),24 ["button"] = P.window:getChild("MultiplayerBackButton"), 25 25 ["callback"] = P.MultiplayerBackButton_clicked 26 26 }) … … 31 31 32 32 if P.joinMode == 1 then 33 local window = winMgr:getWindow("orxonox/MultiplayerLanButton")33 local window = P.window:getChild("MultiplayerWindow/MultiplayerLanButton") 34 34 local button = tolua.cast(window,"CEGUI::RadioButton") 35 35 button:setSelected(true) 36 36 end 37 37 if P.joinMode == 2 then 38 local window = winMgr:getWindow("orxonox/MultiplayerInternetButton")38 local window = P.window:getChild("MultiplayerWindow/MultiplayerInternetButton") 39 39 local button = tolua.cast(window,"CEGUI::RadioButton") 40 40 button:setSelected(true) … … 66 66 67 67 function P.MultiplayerJoinButton_clicked(e) 68 local choice = winMgr:getWindow("orxonox/MultiplayerListbox"):getFirstSelectedItem()68 local choice = P.window:getChild("MultiplayerWindow/MultiplayerListbox"):getFirstSelectedItem() 69 69 local destination = nil 70 70 if choice then … … 85 85 -- LAN Discovery 86 86 if P.joinMode == 1 then 87 local listbox = winMgr:getWindow("orxonox/MultiplayerListbox")87 local listbox = P.window:getChild("MultiplayerWindow/MultiplayerListbox") 88 88 CEGUI.toListbox(listbox):resetList() 89 89 local discovery = orxonox.LANDiscovery:getInstance() … … 120 120 -- WAN Discovery 121 121 elseif P.joinMode == 2 then 122 local listbox = winMgr:getWindow("orxonox/MultiplayerListbox")122 local listbox = P.window:getChild("MultiplayerWindow/MultiplayerListbox") 123 123 CEGUI.toListbox(listbox):resetList() 124 124 local discovery = orxonox.WANDiscovery() -
code/branches/cegui0.8_ogre1.9/data/gui/scripts/ShipSelectionMenu.lua
r11795 r11799 44 44 45 45 function P.createFilterTab(name) -- generates filter tab and list box, sets handler for selection changes 46 tabName = " orxonox/ShipSelectionLevelTab"46 tabName = "ShipSelectionLevelTab" 47 47 -- create new tab window with desired name 48 48 listbox = CEGUI.toListbox(winMgr:createWindow("MenuWidgets/Listbox", tabName)) 49 49 listbox:setText(name) 50 listbox:setProperty(" UnifiedMaxSize", "{{1,0},{1,0}}")50 listbox:setProperty("MaxSize", "{{1,0},{1,0}}") 51 51 --[[TODO: smaller list if image and description is implemented. 52 listbox:setProperty(" UnifiedAreaRect", "{{0.05,0},{0.1,0},{0.5,0},{0.675,0}}") --]]53 listbox:setProperty(" UnifiedAreaRect", "{{0,0},{0,0},{1,0},{1,0}}")52 listbox:setProperty("Area", "{{0.05,0},{0.1,0},{0.5,0},{0.675,0}}") --]] 53 listbox:setProperty("Area", "{{0,0},{0,0},{1,0},{1,0}}") 54 54 -- fill listbox with items 55 55 P.update() 56 56 -- listen to selection changes 57 orxonox.GUIManager:subscribeEventHelper(listbox, " ItemSelectionChanged", P.name..".ShipSelectionSelectionChanged")58 local tabControl = winMgr:getWindow("orxonox/ShipSelectionTabControl")59 orxonox.GUIManager:subscribeEventHelper(tabControl, " TabSelectionChanged", P.name..".ShipSelectionSelectionChanged")57 orxonox.GUIManager:subscribeEventHelper(listbox, "SelectionChanged", P.name..".ShipSelectionSelectionChanged") 58 local tabControl = P.window:getChild("ShipSelectionWindow/ShipSelectionTabControl") 59 orxonox.GUIManager:subscribeEventHelper(tabControl, "SelectionChanged", P.name..".ShipSelectionSelectionChanged") 60 60 if listbox:getItemCount() > 0 then 61 tabControl:addChild Window(tabName)61 tabControl:addChild(listbox) 62 62 end 63 63 end … … 65 65 function P.ShipSelectionGetSelectedModel() --returns selected model, if available. 66 66 -- choose the active listbox 67 local tabControl = CEGUI.toTabControl( winMgr:getWindow("orxonox/ShipSelectionTabControl"))67 local tabControl = CEGUI.toTabControl(P.window:getChild("ShipSelectionWindow/ShipSelectionTabControl")) 68 68 local listbox = CEGUI.toListbox(tabControl:getTabContentsAtIndex(tabControl:getSelectedTabIndex())) 69 69 local choice = listbox:getFirstSelectedItem() … … 80 80 function P.ShipSelectionSelectionChanged(e) 81 81 --[[ TODO: Get image and description from template file 82 local levelImage = winMgr:getWindow("orxonox/ShipSelectionLevelImage")83 local levelDescription = winMgr:getWindow("orxonox/ShipSelectionLevelDescription")84 local configButton = winMgr:getWindow("orxonox/ShipSelectionConfigButton")82 local levelImage = P.window:getChild("orxonox/ShipSelectionLevelImage") 83 local levelDescription = P.window:getChild("orxonox/ShipSelectionLevelDescription") 84 local configButton = P.window:getChild("orxonox/ShipSelectionConfigButton") 85 85 local level = P.ShipSelectionGetSelectedModel() 86 86 if level ~= nil then -
code/branches/cegui0.8_ogre1.9/data/gui/scripts/SingleplayerConfigMenu.lua
r9665 r11799 16 16 17 17 function P.onLoad() 18 P.sampleWindow = winMgr:createWindow("MenuWidgets/StaticText", " orxonox/SingleplayerConfigMenu/MiscConfigPane/SampleWindow")18 P.sampleWindow = winMgr:createWindow("MenuWidgets/StaticText", "ConfigWindow/Wrapper/MiscConfigPane/SampleWindow") 19 19 P.sampleWindow:setText("SampleText") 20 20 21 21 P:setButton(1, 1, { 22 ["button"] = winMgr:getWindow("orxonox/SingleplayerConfigMenu/CancelButton"),22 ["button"] = P.window:getChild("CancelButton"), 23 23 ["callback"] = P.SingleplayerConfigCancelButton_clicked 24 24 }) 25 25 26 26 P:setButton(1, 2, { 27 ["button"] = winMgr:getWindow("orxonox/SingleplayerConfigMenu/OKButton"),27 ["button"] = P.window:getChild("OKButton"), 28 28 ["callback"] = P.SingleplayerConfigOKButton_clicked 29 29 }) … … 88 88 P.spaceWidth = 10 89 89 90 local pane = tolua.cast( winMgr:getWindow("orxonox/SingleplayerConfigMenu/MiscConfigPane"), "CEGUI::ScrollablePane")90 local pane = tolua.cast(P.window:getChild("ConfigWindow/Wrapper/MiscConfigPane"), "CEGUI::ScrollablePane") 91 91 size = pane:getViewableArea() 92 92 P.editboxWidth = size:getWidth() - P.commandWidth - P.resetWidth - 5*P.spaceWidth … … 98 98 local offset = 0 99 99 -- destroy config line, if it already exists (otherwise would cause an error) 100 if winMgr:isWindowPresent("orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k) then 101 winMgr:destroyWindow("orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k) 100 local oldLine = P.window:getChildRecursive("ConfigCommand" .. k) 101 if oldLine ~= nil then 102 winMgr:destroyWindow(oldLine) 102 103 end 103 104 -- content window for the entire line 104 local line = winMgr:createWindow("DefaultWindow", " orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k)105 local line = winMgr:createWindow("DefaultWindow", "ConfigCommand" .. k) 105 106 line:setHeight(CEGUI.UDim(0, P.lineHeight)) 106 107 line:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, P.lineHeight*(k-1)))) 107 108 108 109 -- config name 109 local command = winMgr:createWindow("MenuWidgets/StaticText", " orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Command")110 local command = winMgr:createWindow("MenuWidgets/StaticText", "Command") 110 111 command:setText(P.nameList[k]) 111 command:setSize(CEGUI.U Vector2(CEGUI.UDim(0, P.commandWidth), CEGUI.UDim(1, 0)))112 command:setSize(CEGUI.USize(CEGUI.UDim(0, P.commandWidth), CEGUI.UDim(1, 0))) 112 113 command:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0, 0))) 113 line:addChild Window(command)114 line:addChild(command) 114 115 offset = offset + P.commandWidth + P.spaceWidth 115 116 116 117 -- config value (editable) 117 local configvalue = winMgr:createWindow("MenuWidgets/Editbox", " orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Configvalue")118 local configvalue = winMgr:createWindow("MenuWidgets/Editbox", "Configvalue") 118 119 configvalue:setProperty("ReadOnly", "set:False") 119 120 local value = orxonox.CommandExecutor:query("getConfig " .. P.commandList[k]) 120 121 configvalue:setText(value) 121 configvalue:setSize(CEGUI.U Vector2(CEGUI.UDim(0, P.editboxWidth), CEGUI.UDim(0.9, 0)))122 configvalue:setSize(CEGUI.USize(CEGUI.UDim(0, P.editboxWidth), CEGUI.UDim(0.9, 0))) 122 123 configvalue:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.05, 0))) 123 124 -- enable the reset button if the value changed 124 125 orxonox.GUIManager:subscribeEventHelper(configvalue, "TextAccepted", P.name .. ".SingleplayerConfigEditbox_textAccepted") 125 line:addChild Window(configvalue)126 line:addChild(configvalue) 126 127 offset = offset + P.editboxWidth + P.spaceWidth 127 128 128 129 -- reset button (only available when value changed) 129 local reset = winMgr:createWindow("MenuWidgets/Button", " orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Reset")130 reset:setSize(CEGUI.U Vector2(CEGUI.UDim(0, P.resetWidth), CEGUI.UDim(0.9, 0)))130 local reset = winMgr:createWindow("MenuWidgets/Button", "Reset") 131 reset:setSize(CEGUI.USize(CEGUI.UDim(0, P.resetWidth), CEGUI.UDim(0.9, 0))) 131 132 reset:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.05, 0))) 132 133 reset:setText("reset") 133 134 orxonox.GUIManager:subscribeEventHelper(reset, "Clicked", P.name .. ".SingleplayerConfigResetButton_clicked") 134 line:addChild Window(reset)135 line:addChild(reset) 135 136 reset:setEnabled(false) 136 137 offset = offset + P.resetWidth + P.spaceWidth … … 142 143 143 144 function P.createLines() 144 local window = winMgr:getWindow("orxonox/SingleplayerConfigMenu/MiscConfigPane")145 local window = P.window:getChild("ConfigWindow/Wrapper/MiscConfigPane") 145 146 146 147 for k,v in pairs(P.commandList) do 147 148 local line = P.createLine(k) 148 149 table.insert(P.linesList, line) 149 window:addChild Window(line)150 window:addChild(line) 150 151 end 151 152 … … 157 158 for k,v in pairs(P.commandList) do 158 159 -- save the changes 159 local editbox = winMgr:getWindow("orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Configvalue")160 local editbox = P.window:getChild("ConfigWindow/Wrapper/MiscConfigPane/ConfigCommand" .. k .. "/Configvalue") 160 161 orxonox.CommandExecutor:execute("config " .. P.commandList[k] .. " " .. editbox:getText()) 161 local resetButton = winMgr:getWindow("orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. k .. "/Reset")162 local resetButton = P.window:getChild("ConfigWindow/Wrapper/MiscConfigPane/ConfigCommand" .. k .. "/Reset") 162 163 resetButton:setEnabled(false) 163 164 end … … 172 173 function P.SingleplayerConfigEditbox_textAccepted(e) 173 174 local we = CEGUI.toWindowEventArgs(e) 174 local name = we.window:getName ()175 local name = we.window:getNamePath() 175 176 176 177 local match = string.gmatch(name, "%d+") 177 178 local commandNr = tonumber(match()) 178 179 179 local resetButton = winMgr:getWindow("orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. commandNr .. "/Reset")180 local resetButton = P.window:getChild("ConfigWindow/Wrapper/MiscConfigPane/ConfigCommand" .. commandNr .. "/Reset") 180 181 resetButton:setEnabled(true) 181 182 end … … 183 184 function P.SingleplayerConfigResetButton_clicked(e) 184 185 local we = CEGUI.toWindowEventArgs(e) 185 local name = we.window:getName ()186 local name = we.window:getNamePath() 186 187 187 188 local match = string.gmatch(name, "%d+") … … 189 190 190 191 -- reload the old value 191 local editbox = winMgr:getWindow("orxonox/SingleplayerConfigMenu/MiscConfigPane/ConfigCommand" .. commandNr .. "/Configvalue")192 local editbox = P.window:getChild("ConfigWindow/Wrapper/MiscConfigPane/ConfigCommand" .. commandNr .. "/Configvalue") 192 193 local value = orxonox.CommandExecutor:query("getConfig " .. P.commandList[commandNr]) 193 194 editbox:setText(value)
Note: See TracChangeset
for help on using the changeset viewer.