[Orxonox-commit 2885] r7588 - in code/branches/menu: data/gui/layouts data/gui/scripts src/orxonox/gamestates
dafrick at orxonox.net
dafrick at orxonox.net
Wed Oct 27 13:15:28 CEST 2010
Author: dafrick
Date: 2010-10-27 13:15:28 +0200 (Wed, 27 Oct 2010)
New Revision: 7588
Modified:
code/branches/menu/data/gui/layouts/MainMenu.layout
code/branches/menu/data/gui/layouts/MainMenuBackground.layout
code/branches/menu/data/gui/scripts/MainMenu.lua
code/branches/menu/src/orxonox/gamestates/GSMainMenu.cc
Log:
Adjustments to allow key input in MainMenu and first steps towards "tab"-behavior.
Modified: code/branches/menu/data/gui/layouts/MainMenu.layout
===================================================================
--- code/branches/menu/data/gui/layouts/MainMenu.layout 2010-10-27 11:11:24 UTC (rev 7587)
+++ code/branches/menu/data/gui/layouts/MainMenu.layout 2010-10-27 11:15:28 UTC (rev 7588)
@@ -42,5 +42,6 @@
<Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.6625,0},{0.6,0},{0.7125,0}}" />
<Event Name="Clicked" Function="MainMenu.ExitButton_clicked"/>
</Window>
+ <Event Name="KeyDown" Function="MainMenu.Key_clicked"/>
</Window>
</GUILayout>
Modified: code/branches/menu/data/gui/layouts/MainMenuBackground.layout
===================================================================
--- code/branches/menu/data/gui/layouts/MainMenuBackground.layout 2010-10-27 11:11:24 UTC (rev 7587)
+++ code/branches/menu/data/gui/layouts/MainMenuBackground.layout 2010-10-27 11:15:28 UTC (rev 7588)
@@ -1,10 +1,10 @@
<?xml version="1.0" ?>
<GUILayout>
<Window Type="MenuWidgets/StaticImage" Name="orxonox/Background">
- <Property Name="UnifiedSize" Value="{{1.0,0},{1.0,0}}"/>
- <Property Name="Image" Value="set:MainMenuBackground image:Background"/>
- <Property Name="FrameEnabled" Value="set:true"/>
- <Property Name="BackgroundEnabled" Value="set:false"/>
- <Property Name="InheritsAlpha" Value="False" />
+ <Property Name="UnifiedSize" Value="{{1.0,0},{1.0,0}}"/>
+ <Property Name="Image" Value="set:MainMenuBackground image:Background"/>
+ <Property Name="FrameEnabled" Value="set:true"/>
+ <Property Name="BackgroundEnabled" Value="set:false"/>
+ <Property Name="InheritsAlpha" Value="False" />
</Window>
</GUILayout>
Modified: code/branches/menu/data/gui/scripts/MainMenu.lua
===================================================================
--- code/branches/menu/data/gui/scripts/MainMenu.lua 2010-10-27 11:11:24 UTC (rev 7587)
+++ code/branches/menu/data/gui/scripts/MainMenu.lua 2010-10-27 11:15:28 UTC (rev 7588)
@@ -3,6 +3,8 @@
local P = createMenuSheet("MainMenu")
P.loadAlong = { "SingleplayerMenu", "MultiplayerMenu", "SettingsMenu", "CreditsMenu" }
+P.index = 0
+
-- events for MainMenu
function P.QuickGameTestButton_clicked(e)
hideAllMenuSheets()
@@ -29,5 +31,32 @@
orxonox.execute("exit")
end
+function P.Key_clicked(e)
+ local we = tolua.cast(e, "CEGUI::KeyEventArgs")
+ cout(0, tostring(we.scancode))
+ if tostring(we.scancode) == "15" then
+ P.index = P.index + 1
+ local window = winMgr:getWindow("orxonox/MainMenuBackground")
+ if P.index == window:getChildCount() then
+ P.index = 1
+ end
+ local child = window:getChildAtIdx(P.index-1)
+ elseif tostring(we.scancode) == "28" and P.index ~= 0 then
+ if P.index == 1 then
+ P.QuickGameTestButton_clicked()
+ elseif P.index == 2 then
+ P.SingleplayerButton_clicked()
+ elseif P.index == 3 then
+ P.MultiplayerButton_clicked()
+ elseif P.index == 4 then
+ P.SettingsButton_clicked()
+ elseif P.index == 5 then
+ P.CreditsButton_clicked()
+ elseif P.index == 6 then
+ P.ExitButton_clicked()
+ end
+ end
+end
+
return P
Modified: code/branches/menu/src/orxonox/gamestates/GSMainMenu.cc
===================================================================
--- code/branches/menu/src/orxonox/gamestates/GSMainMenu.cc 2010-10-27 11:11:24 UTC (rev 7587)
+++ code/branches/menu/src/orxonox/gamestates/GSMainMenu.cc 2010-10-27 11:15:28 UTC (rev 7588)
@@ -66,7 +66,7 @@
{
RegisterRootObject(GSMainMenu);
- InputManager::getInstance().createInputState("MainMenuHackery")->setKeyHandler(KeyBinderManager::getInstance().getDefaultAsHandler());
+ InputManager::getInstance().createInputState("MainMenuHackery", true, true)->setKeyHandler(KeyBinderManager::getInstance().getDefaultAsHandler());
// create an empty Scene
this->scene_ = new Scene(NULL);
More information about the Orxonox-commit
mailing list