[Orxonox-commit 427] r2152 - in media/gui: layouts scripts
bknecht at orxonox.net
bknecht at orxonox.net
Thu May 21 17:18:23 CEST 2009
Author: bknecht
Date: 2009-05-21 17:18:23 +0200 (Thu, 21 May 2009)
New Revision: 2152
Modified:
media/gui/layouts/MainMenu.layout
media/gui/layouts/MainMenu_2.layout
media/gui/scripts/gui.lua
media/gui/scripts/loadGUI_3.lua
media/gui/scripts/mainmenu_2.lua
Log:
media update for a working main menu. I hope this does not destroy something, I think it shouldn't.
Modified: media/gui/layouts/MainMenu.layout
===================================================================
--- media/gui/layouts/MainMenu.layout 2009-05-20 18:55:23 UTC (rev 2151)
+++ media/gui/layouts/MainMenu.layout 2009-05-21 15:18:23 UTC (rev 2152)
@@ -13,6 +13,9 @@
<Event Name="Clicked" Function="button_standalone_clicked"/>
</Window>
+ <Window Type="TaharezLook/Listbox" Name="orxonox/LevelListbox">
+ </Window>
+
<Window Type="TaharezLook/Button" Name="orxonox/DedicatedButton">
<Property Name="UnifiedPosition" Value="{{0.11,0},{0.376,0}}"/>
<Property Name="UnifiedSize" Value="{{0.15,0},{0.05,0}}"/>
Modified: media/gui/layouts/MainMenu_2.layout
===================================================================
--- media/gui/layouts/MainMenu_2.layout 2009-05-20 18:55:23 UTC (rev 2151)
+++ media/gui/layouts/MainMenu_2.layout 2009-05-21 15:18:23 UTC (rev 2152)
@@ -10,9 +10,18 @@
<Property Name="UnifiedPosition" Value="{{0.11,0},{0.3,0}}"/>
<Property Name="UnifiedSize" Value="{{0.15,0},{0.05,0}}"/>
<Property Name="Text" Value="Standalone"/>
+ <Property Name="Disabled" Value="true"/>
<Event Name="Clicked" Function="mainmenu_2.button_standalone_clicked"/>
</Window>
+ <Window Type="TaharezLook/Listbox" Name="orxonox/LevelListbox">
+ <Property Name="UnifiedPosition" Value="{{0.4,0},{0.3,0}}"/>
+ <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+ <Property Name="UnifiedSize" Value="{{0.35,0},{0.33,0}}" />
+ <Property Name="Tooltip" Value="Available Levels." />
+ <Event Name="ItemSelectionChanged" Function="mainmenu_2.listbox_level_selectionchanged" />
+ </Window>
+
<Window Type="TaharezLook/Button" Name="orxonox/DedicatedButton">
<Property Name="UnifiedPosition" Value="{{0.11,0},{0.376,0}}"/>
<Property Name="UnifiedSize" Value="{{0.15,0},{0.05,0}}"/>
Modified: media/gui/scripts/gui.lua
===================================================================
--- media/gui/scripts/gui.lua 2009-05-20 18:55:23 UTC (rev 2151)
+++ media/gui/scripts/gui.lua 2009-05-21 15:18:23 UTC (rev 2152)
@@ -14,7 +14,7 @@
local newElement = { window = gui, filename = fname, visible = false } or {}
setmetatable(newElement, self) -- connects new element with class
self.__index = self
- P:init()
+ self:init()
return newElement
end
Modified: media/gui/scripts/loadGUI_3.lua
===================================================================
--- media/gui/scripts/loadGUI_3.lua 2009-05-20 18:55:23 UTC (rev 2151)
+++ media/gui/scripts/loadGUI_3.lua 2009-05-21 15:18:23 UTC (rev 2152)
@@ -10,6 +10,7 @@
system:setDefaultMouseCursor("TaharezLook", "MouseArrow")
system:setDefaultFont("BlueHighway-12")
+system:setDefaultTooltip("TaharezLook/Tooltip")
loadedGUIs = {}
Modified: media/gui/scripts/mainmenu_2.lua
===================================================================
--- media/gui/scripts/mainmenu_2.lua 2009-05-20 18:55:23 UTC (rev 2151)
+++ media/gui/scripts/mainmenu_2.lua 2009-05-21 15:18:23 UTC (rev 2152)
@@ -8,24 +8,29 @@
P.layoutString = "MainMenu_2.layout"
function P:init()
- --win = winMgr:getWindow("orxonox/LevelListBox")
- --print(win.getItemCount())
- --item = winMgr:createWindow("TaharezLook/ListboxItem", "orxonox/LevelListBoxItem1")
- --item:setText("HiHo")
- --win:addItem(item)
- --print(win:getItemCount())
+ listbox = winMgr:getWindow("orxonox/LevelListbox")
+ orxonox.GUIManager:getInstance():getLevelList()
+ for k,v in pairs(levellist) do
+ item = CEGUI.createListboxTextItem(v)
+ item:setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush")
+ CEGUI.toListbox(listbox):addItem(item)
+ end
end
-- events for mainmenu
function P.button_quit_clicked(e)
- hideGUI()
- orxonox.CommandExecutor:execute("exit")
+ hideGUI()
+ orxonox.CommandExecutor:execute("exit")
end
function P.button_standalone_clicked(e)
- orxonox.CommandExecutor:execute("startGame")
- toggleGUI()
+ choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem()
+ if choice then
+ orxonox.CommandExecutor:execute("setLevel " .. choice:getText() .. ".oxw")
+ orxonox.CommandExecutor:execute("startGame")
+ toggleGUI()
+ end
end
function P.button_server_clicked(e)
@@ -43,5 +48,13 @@
hideGUI()
end
+function P.listbox_level_selectionchanged(e)
+ if winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem() then
+ winMgr:getWindow("orxonox/StandaloneButton"):enable()
+ else
+ winMgr:getWindow("orxonox/StandaloneButton"):disable()
+ end
+end
+
return mainmenu_2
More information about the Orxonox-commit
mailing list