[Orxonox-commit 3352] r8040 - in code/branches/usability: data/gui/scripts src/libraries/core src/orxonox/gametypes
dafrick at orxonox.net
dafrick at orxonox.net
Mon Mar 7 09:57:14 CET 2011
Author: dafrick
Date: 2011-03-07 09:57:13 +0100 (Mon, 07 Mar 2011)
New Revision: 8040
Modified:
code/branches/usability/data/gui/scripts/HostMenu.lua
code/branches/usability/data/gui/scripts/MiscConfigMenu.lua
code/branches/usability/data/gui/scripts/SingleplayerMenu.lua
code/branches/usability/src/libraries/core/Core.cc
code/branches/usability/src/libraries/core/Core.h
code/branches/usability/src/libraries/core/GUIManager.h
code/branches/usability/src/orxonox/gametypes/Gametype.cc
Log:
Developer's mode. Is a ConfigValue, by default on except in release mode. If on it should help the developer, if off, it should obscure things we don't want the user to have to deal with.
So far it ticks the showAll button in the Singleplayer and Host menu, if on. It also sets the start countdown to 0 if on.
If you have some more ideas on how to make life easier for both developers and users, feel free to implement it yourself ot mention it to me.
Modified: code/branches/usability/data/gui/scripts/HostMenu.lua
===================================================================
--- code/branches/usability/data/gui/scripts/HostMenu.lua 2011-03-06 23:08:27 UTC (rev 8039)
+++ code/branches/usability/data/gui/scripts/HostMenu.lua 2011-03-07 08:57:13 UTC (rev 8040)
@@ -27,6 +27,23 @@
end
function P.onShow()
+ if P.showAll ~= orxonox.GUIManager:inDevMode() then
+ local window = winMgr:getWindow("orxonox/SingleplayerShowAllCheckbox")
+ local button = tolua.cast(window,"CEGUI::Checkbox")
+ P.showAll = not P.showAll
+ button:setSelected(P.showAll)
+ P.createLevelList()
+ end
+end
+
+function P.onShow()
+ if P.showAll ~= orxonox.GUIManager:inDevMode() then
+ local window = winMgr:getWindow("orxonox/SingleplayerShowAllCheckbox")
+ local button = tolua.cast(window,"CEGUI::Checkbox")
+ P.showAll = not P.showAll
+ button:setSelected(P.showAll)
+ end
+
if P.multiplayerMode == "startServer" then
local window = winMgr:getWindow("orxonox/HostMenuHostButton")
local button = tolua.cast(window,"CEGUI::RadioButton")
Modified: code/branches/usability/data/gui/scripts/MiscConfigMenu.lua
===================================================================
--- code/branches/usability/data/gui/scripts/MiscConfigMenu.lua 2011-03-06 23:08:27 UTC (rev 8039)
+++ code/branches/usability/data/gui/scripts/MiscConfigMenu.lua 2011-03-07 08:57:13 UTC (rev 8040)
@@ -34,6 +34,7 @@
table.insert(P.commandList, "TeamDeathmatch teams_")
table.insert(P.commandList, "HumanPlayer nick_")
table.insert(P.commandList, "ChatOverlay displayTime_")
+ table.insert(P.commandList, "Core bDevMode_")
P.nameList = {}
table.insert(P.nameList, "Mouse sensitivity")
@@ -53,6 +54,7 @@
table.insert(P.nameList, "TeamDeathmatch: Number of teams")
table.insert(P.nameList, "Playername")
table.insert(P.nameList, "Chat: display time")
+ table.insert(P.nameList, "Developer's Mode")
P.linesList = {}
Modified: code/branches/usability/data/gui/scripts/SingleplayerMenu.lua
===================================================================
--- code/branches/usability/data/gui/scripts/SingleplayerMenu.lua 2011-03-06 23:08:27 UTC (rev 8039)
+++ code/branches/usability/data/gui/scripts/SingleplayerMenu.lua 2011-03-07 08:57:13 UTC (rev 8040)
@@ -24,6 +24,16 @@
})
end
+function P.onShow()
+ if P.showAll ~= orxonox.GUIManager:inDevMode() then
+ local window = winMgr:getWindow("orxonox/SingleplayerShowAllCheckbox")
+ local button = tolua.cast(window,"CEGUI::Checkbox")
+ P.showAll = not P.showAll
+ button:setSelected(P.showAll)
+ P.createLevelList()
+ end
+end
+
function P.createLevelList()
P.levelList = {}
P.itemList = {}
@@ -43,8 +53,6 @@
end
index = index + 1
end
- --TODO: Reintroduce sorting, if needed. At the moment it's sorted by filename.
- --table.sort(levelList)
for k,v in pairs(P.levelList) do
local item = CEGUI.createListboxTextItem(v:getName())
item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
Modified: code/branches/usability/src/libraries/core/Core.cc
===================================================================
--- code/branches/usability/src/libraries/core/Core.cc 2011-03-06 23:08:27 UTC (rev 8039)
+++ code/branches/usability/src/libraries/core/Core.cc 2011-03-07 08:57:13 UTC (rev 8040)
@@ -207,8 +207,12 @@
{
#ifdef ORXONOX_RELEASE
const unsigned int defaultLevelLogFile = 3;
+ SetConfigValue(bDevMode_, false)
+ .description("Developer mode. If not set, hides some things from the user to not confuse him.");
#else
const unsigned int defaultLevelLogFile = 4;
+ SetConfigValue(bDevMode_, true)
+ .description("Developer mode. If not set, hides some things from the user to not confuse him.");
#endif
SetConfigValueExternal(softDebugLevelLogFile_, "OutputHandler", "softDebugLevelLogFile", defaultLevelLogFile)
.description("The maximum level of debug output shown in the log file");
Modified: code/branches/usability/src/libraries/core/Core.h
===================================================================
--- code/branches/usability/src/libraries/core/Core.h 2011-03-06 23:08:27 UTC (rev 8039)
+++ code/branches/usability/src/libraries/core/Core.h 2011-03-07 08:57:13 UTC (rev 8040)
@@ -90,6 +90,9 @@
inline long long getOgreConfigTimestamp() const
{ return this->ogreConfigTimestamp_; }
+ inline bool inDevMode(void) const
+ { return this->bDevMode_; }
+
private:
Core(const Core&); //!< Don't use (undefined symbol)
@@ -129,6 +132,7 @@
bool bStartIOConsole_; //!< Set to false if you don't want to use the IOConsole
long long lastLevelTimestamp_; ///< Timestamp when the last level was started
long long ogreConfigTimestamp_; ///< Timestamp wehen the ogre config level was modified
+ bool bDevMode_; //!< Developers bit. If set to false, some options are not available as to not confuse the normal user.
static Core* singletonPtr_s;
};
Modified: code/branches/usability/src/libraries/core/GUIManager.h
===================================================================
--- code/branches/usability/src/libraries/core/GUIManager.h 2011-03-06 23:08:27 UTC (rev 8039)
+++ code/branches/usability/src/libraries/core/GUIManager.h 2011-03-07 08:57:13 UTC (rev 8040)
@@ -48,6 +48,7 @@
#include "util/TriBool.h"
#include "util/Singleton.h"
#include "input/InputHandler.h"
+#include "Core.h"
#include "OrxonoxClass.h"
#include "WindowEventListener.h"
@@ -96,6 +97,12 @@
static void navigateGUI(const std::string& mode);
void guisActiveChanged(bool active); // tolua_export
+ /**
+ @brief Helper method to get the developer's mode without having to export Core.h.
+ @see Core::inDevMode
+ */
+ static bool inDevMode(void) { return Core::getInstance().inDevMode(); } // tolua_export
+
//! Creates a new InputState to be used with a GUI Sheet
const std::string& createInputState(const std::string& name, TriBool::Value showCursor = TriBool::True, TriBool::Value useKeyboard = TriBool::True, bool bBlockJoyStick = false); // tolua_export
LuaState* getLuaState(void)
Modified: code/branches/usability/src/orxonox/gametypes/Gametype.cc
===================================================================
--- code/branches/usability/src/orxonox/gametypes/Gametype.cc 2011-03-06 23:08:27 UTC (rev 8039)
+++ code/branches/usability/src/orxonox/gametypes/Gametype.cc 2011-03-07 08:57:13 UTC (rev 8040)
@@ -29,6 +29,7 @@
#include "Gametype.h"
#include "util/Math.h"
+#include "core/Core.h"
#include "core/CoreIncludes.h"
#include "core/ConfigValueIncludes.h"
#include "core/GameMode.h"
@@ -385,7 +386,11 @@
}
if (allplayersready && hashumanplayers)
{
- this->gtinfo_->startCountdown_ = this->initialStartCountdown_;
+ // If in developer's mode, there is no start countdown.
+ if(Core::getInstance().inDevMode())
+ this->gtinfo_->startCountdown_ = 0;
+ else
+ this->gtinfo_->startCountdown_ = this->initialStartCountdown_;
this->gtinfo_->bStartCountdownRunning_ = true;
}
}
More information about the Orxonox-commit
mailing list