[Orxonox-commit 802] r3323 - in trunk: cmake src/core src/orxonox
rgrieder at orxonox.net
rgrieder at orxonox.net
Sun Jul 19 15:11:15 CEST 2009
Author: rgrieder
Date: 2009-07-19 15:11:15 +0200 (Sun, 19 Jul 2009)
New Revision: 3323
Modified:
trunk/cmake/BuildConfig.cmake
trunk/src/core/CommandLine.cc
trunk/src/core/CommandLine.h
trunk/src/core/Core.cc
trunk/src/core/Core.h
trunk/src/core/Game.cc
trunk/src/core/Game.h
trunk/src/orxonox/GraphicsManager.cc
trunk/src/orxonox/Main.cc
Log:
ORXONOX_USE_WINMAIN should now work as expected.
Modified: trunk/cmake/BuildConfig.cmake
===================================================================
--- trunk/cmake/BuildConfig.cmake 2009-07-19 13:08:36 UTC (rev 3322)
+++ trunk/cmake/BuildConfig.cmake 2009-07-19 13:11:15 UTC (rev 3323)
@@ -73,7 +73,9 @@
OPTION(ORXONOX_RELEASE "Enable when building restributable releases" FALSE)
# Use WinMain() or main()?
-OPTION(ORXONOX_USE_WINMAIN "Use WinMain (doesn't show console) or main" FALSE)
+IF(WIN32)
+ OPTION(ORXONOX_USE_WINMAIN "Use WinMain (doesn't show console) or main" FALSE)
+ENDIF()
################# OGRE Plugins ##################
Modified: trunk/src/core/CommandLine.cc
===================================================================
--- trunk/src/core/CommandLine.cc 2009-07-19 13:08:36 UTC (rev 3322)
+++ trunk/src/core/CommandLine.cc 2009-07-19 13:11:15 UTC (rev 3323)
@@ -331,11 +331,12 @@
@brief
Parses only the command line for CommandLineArguments.
*/
- void CommandLine::_parseCommandLine(int argc, char** argv)
+ void CommandLine::_parseCommandLine(const std::string& cmdLine)
{
std::vector<std::string> args;
- for (int i = 1; i < argc; ++i)
- args.push_back(argv[i]);
+ SubString tokens(cmdLine, " ", " ", false, '\\', true, '"', true, '(', ')', false);
+ for (unsigned i = 0; i < tokens.size(); ++i)
+ args.push_back(tokens[i]);
this->_parse(args, false);
}
@@ -362,7 +363,7 @@
line = removeTrailingWhitespaces(line);
//if (!(line[0] == '#' || line[0] == '%'))
//{
- SubString tokens(line, " ", " ", false, 92, false, 34, false, 40, 41, false, '#');
+ SubString tokens(line, " ", " ", false, '\\', true, '"', true, '(', ')', false, '#');
for (unsigned i = 0; i < tokens.size(); ++i)
if (tokens[i][0] != '#')
args.push_back(tokens[i]);
Modified: trunk/src/core/CommandLine.h
===================================================================
--- trunk/src/core/CommandLine.h 2009-07-19 13:08:36 UTC (rev 3322)
+++ trunk/src/core/CommandLine.h 2009-07-19 13:11:15 UTC (rev 3323)
@@ -141,7 +141,7 @@
public:
//! Parse redirection to internal member method.
- static void parseCommandLine(int argc, char** argv) { _getInstance()._parseCommandLine(argc, argv); }
+ static void parseCommandLine(const std::string& cmdLine) { _getInstance()._parseCommandLine(cmdLine); }
static void parseFile() { _getInstance()._parseFile(); }
static std::string getUsageInformation();
@@ -173,7 +173,7 @@
static CommandLine& _getInstance();
- void _parseCommandLine(int argc, char** argv);
+ void _parseCommandLine(const std::string& cmdLine);
void _parseFile();
void _parse(const std::vector<std::string>& arguments, bool bParsingFile);
void checkFullArgument(const std::string& name, const std::string& value, bool bParsingFile);
Modified: trunk/src/core/Core.cc
===================================================================
--- trunk/src/core/Core.cc 2009-07-19 13:08:36 UTC (rev 3322)
+++ trunk/src/core/Core.cc 2009-07-19 13:11:15 UTC (rev 3323)
@@ -228,7 +228,7 @@
};
- Core::Core(int argc, char** argv)
+ Core::Core(const std::string& cmdLine)
{
if (singletonRef_s != 0)
{
@@ -241,7 +241,7 @@
this->configuration_ = new CoreConfiguration();
// Parse command line arguments first
- CommandLine::parseCommandLine(argc, argv);
+ CommandLine::parseCommandLine(cmdLine);
// Determine and set the location of the executable
setExecutablePath();
Modified: trunk/src/core/Core.h
===================================================================
--- trunk/src/core/Core.h 2009-07-19 13:08:36 UTC (rev 3322)
+++ trunk/src/core/Core.h 2009-07-19 13:11:15 UTC (rev 3323)
@@ -65,7 +65,7 @@
@throws
GeneralException
*/
- Core(int argc, char** argv);
+ Core(const std::string& cmdLine);
~Core();
void setConfigValues();
Modified: trunk/src/core/Game.cc
===================================================================
--- trunk/src/core/Game.cc 2009-07-19 13:08:36 UTC (rev 3322)
+++ trunk/src/core/Game.cc 2009-07-19 13:11:15 UTC (rev 3323)
@@ -109,7 +109,7 @@
@brief
Non-initialising constructor.
*/
- Game::Game(int argc, char** argv)
+ Game::Game(const std::string& cmdLine)
{
if (singletonRef_s != 0)
{
@@ -136,7 +136,7 @@
this->gameClock_ = new Clock();
// Create the Core
- this->core_ = new Core(argc, argv);
+ this->core_ = new Core(cmdLine);
// After the core has been created, we can safely instantiate the GameStates
for (std::map<std::string, GameStateInfo>::const_iterator it = gameStateDeclarations_s.begin();
Modified: trunk/src/core/Game.h
===================================================================
--- trunk/src/core/Game.h 2009-07-19 13:08:36 UTC (rev 3322)
+++ trunk/src/core/Game.h 2009-07-19 13:11:15 UTC (rev 3323)
@@ -67,7 +67,7 @@
class _CoreExport Game
{
public:
- Game(int argc, char** argv);
+ Game(const std::string& cmdLine);
~Game();
void setStateHierarchy(const std::string& str);
Modified: trunk/src/orxonox/GraphicsManager.cc
===================================================================
--- trunk/src/orxonox/GraphicsManager.cc 2009-07-19 13:08:36 UTC (rev 3322)
+++ trunk/src/orxonox/GraphicsManager.cc 2009-07-19 13:11:15 UTC (rev 3323)
@@ -277,7 +277,7 @@
boost::filesystem::path folder(ogrePluginsFolder_);
// Do some SubString magic to get the comma separated list of plugins
- SubString plugins(ogrePlugins_, ",", " ", false, 92, false, 34, false, 40, 41, false, '\0');
+ SubString plugins(ogrePlugins_, ",", " ", false, '\\', false, '"', false, '(', ')', false, '\0');
// Use backslash paths on Windows! file_string() already does that though.
for (unsigned int i = 0; i < plugins.size(); ++i)
ogreRoot_->loadPlugin((folder / plugins[i]).file_string());
Modified: trunk/src/orxonox/Main.cc
===================================================================
--- trunk/src/orxonox/Main.cc 2009-07-19 13:08:36 UTC (rev 3322)
+++ trunk/src/orxonox/Main.cc 2009-07-19 13:11:15 UTC (rev 3323)
@@ -34,7 +34,15 @@
*/
#include "OrxonoxPrereqs.h"
+#include "SpecialConfig.h"
+#ifdef ORXONOX_USE_WINMAIN
+# ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+# endif
+#include <windows.h>
+#endif
+
#include "util/Debug.h"
#include "util/Exception.h"
#include "core/Game.h"
@@ -54,7 +62,12 @@
Game* game = 0;
try
{
- game = new Game(argc, argv);
+#ifndef ORXONOX_USE_WINMAIN
+ std::string strCmdLine;
+ for (int i = 1; i < argc; ++i)
+ strCmdLine += argv[i] + std::string(" ");
+#endif
+ game = new Game(strCmdLine);
game->setStateHierarchy(
"root"
More information about the Orxonox-commit
mailing list