[Orxonox-commit 1301] r6019 - in code/branches/ingamemenu: data/gui/layouts data/gui/scripts src/libraries/core
scheusso at orxonox.net
scheusso at orxonox.net
Tue Nov 3 11:53:47 CET 2009
Author: scheusso
Date: 2009-11-03 11:53:47 +0100 (Tue, 03 Nov 2009)
New Revision: 6019
Modified:
code/branches/ingamemenu/data/gui/layouts/InGameMenu.layout
code/branches/ingamemenu/data/gui/scripts/InGameMenu.lua
code/branches/ingamemenu/src/libraries/core/CMakeLists.txt
code/branches/ingamemenu/src/libraries/core/Game.h
Log:
Added return to Game button to InGameMenu
MainMenu button now requests mainmenu gamestate
Modified: code/branches/ingamemenu/data/gui/layouts/InGameMenu.layout
===================================================================
--- code/branches/ingamemenu/data/gui/layouts/InGameMenu.layout 2009-11-02 22:46:58 UTC (rev 6018)
+++ code/branches/ingamemenu/data/gui/layouts/InGameMenu.layout 2009-11-03 10:53:47 UTC (rev 6019)
@@ -9,7 +9,7 @@
<Property Name="Font" Value="BlueHighway-12" />
<Property Name="Text" Value="MainMenu" />
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.2,0},{0.45,0},{0.4,0},{0.55,0}}" />
+ <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.2,0},{0.6,0},{0.3,0}}" />
<Property Name="Alpha" Value="0.7" />
<Event Name="Clicked" Function="InGameMenu.button_mainmenu_clicked"/>
</Window>
@@ -17,9 +17,17 @@
<Property Name="Font" Value="BlueHighway-12" />
<Property Name="Text" Value="Quit" />
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
- <Property Name="UnifiedAreaRect" Value="{{0.6,0},{0.45,0},{0.8,0},{0.55,0}}" />
+ <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.4,0},{0.6,0},{0.5,0}}" />
<Property Name="Alpha" Value="0.7" />
<Event Name="Clicked" Function="InGameMenu.button_quit_clicked"/>
</Window>
+ <Window Type="TaharezLook/Button" Name="orxonox/InGameMenu_ReturnButton" >
+ <Property Name="Font" Value="BlueHighway-12" />
+ <Property Name="Text" Value="return to Game" />
+ <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+ <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.6,0},{0.6,0},{0.7,0}}" />
+ <Property Name="Alpha" Value="0.7" />
+ <Event Name="Clicked" Function="InGameMenu.button_return_clicked"/>
+ </Window>
</Window>
</GUILayout>
Modified: code/branches/ingamemenu/data/gui/scripts/InGameMenu.lua
===================================================================
--- code/branches/ingamemenu/data/gui/scripts/InGameMenu.lua 2009-11-02 22:46:58 UTC (rev 6018)
+++ code/branches/ingamemenu/data/gui/scripts/InGameMenu.lua 2009-11-03 10:53:47 UTC (rev 6019)
@@ -22,9 +22,16 @@
end
function P.button_mainmenu_clicked(e)
+ orxonox.Game:getInstance():popState()
+ orxonox.Game:getInstance():popState()
+ orxonox.Game:getInstance():requestState("mainmenu")
orxonox.CommandExecutor:execute("showGUI MainMenu")
orxonox.CommandExecutor:execute("hideGUI InGameMenu")
end
+function P.button_return_clicked(e)
+ orxonox.CommandExecutor:execute("hideGUI InGameMenu")
+end
+
return P
Modified: code/branches/ingamemenu/src/libraries/core/CMakeLists.txt
===================================================================
--- code/branches/ingamemenu/src/libraries/core/CMakeLists.txt 2009-11-02 22:46:58 UTC (rev 6018)
+++ code/branches/ingamemenu/src/libraries/core/CMakeLists.txt 2009-11-03 10:53:47 UTC (rev 6019)
@@ -84,6 +84,7 @@
FIND_HEADER_FILES
TOLUA_FILES
CommandExecutor.h
+ Game.h
Loader.h
LuaState.h
DEFINE_SYMBOL
Modified: code/branches/ingamemenu/src/libraries/core/Game.h
===================================================================
--- code/branches/ingamemenu/src/libraries/core/Game.h 2009-11-02 22:46:58 UTC (rev 6018)
+++ code/branches/ingamemenu/src/libraries/core/Game.h 2009-11-03 10:53:47 UTC (rev 6019)
@@ -57,9 +57,10 @@
*/
#define DeclareGameState(className, stateName, bIgnoreTickTime, bGraphicsMode) \
static bool BOOST_PP_CAT(bGameStateDummy_##className, __LINE__) = orxonox::Game::declareGameState<className>(#className, stateName, bIgnoreTickTime, bGraphicsMode)
-
+// tolua_begin
namespace orxonox
{
+// tolua_end
class GameConfiguration;
//! Helper object required before GameStates are being constructed
@@ -77,8 +78,11 @@
@remark
You should only create this singleton once because it owns the Core class! (see remark there)
*/
- class _CoreExport Game : public Singleton<Game>
+// tolua_begin
+ class _CoreExport Game
+ : public Singleton<Game>
{
+// tolua_end
friend class Singleton<Game>;
typedef std::vector<shared_ptr<GameState> > GameStateVector;
typedef std::map<std::string, shared_ptr<GameState> > GameStateMap;
@@ -94,10 +98,12 @@
void run();
void stop();
- void requestState(const std::string& name);
- void requestStates(const std::string& names);
- void popState();
+ static Game& getInstance(){ return Singleton<Game>::getInstance(); } // tolua_export
+ void requestState(const std::string& name); //tolua_export
+ void requestStates(const std::string& names); //tolua_export
+ void popState(); //tolua_export
+
const Clock& getGameClock() { return *this->gameClock_; }
float getAvgTickTime() { return this->avgTickTime_; }
@@ -182,7 +188,7 @@
static std::map<std::string, GameStateInfo> gameStateDeclarations_s;
static Game* singletonPtr_s; //!< Pointer to the Singleton
- };
+ }; //tolua_export
template <class T>
/*static*/ bool Game::declareGameState(const std::string& className, const std::string& stateName, bool bIgnoreTickTime, bool bGraphicsMode)
@@ -208,6 +214,6 @@
// just a required dummy return value
return true;
}
-}
+} //tolua_export
#endif /* _Game_H__ */
More information about the Orxonox-commit
mailing list