[Orxonox-commit 2716] r7421 - in sandbox_qt: . bin cmake cmake/tools data doc/api doc/api/images src src/external src/libraries src/libraries/core src/libraries/util src/orxonox
rgrieder at orxonox.net
rgrieder at orxonox.net
Sun Sep 12 00:47:31 CEST 2010
Author: rgrieder
Date: 2010-09-12 00:47:30 +0200 (Sun, 12 Sep 2010)
New Revision: 7421
Added:
sandbox_qt/cmake/LibraryConfigTardis.cmake
sandbox_qt/cmake/PackageConfig.cmake
sandbox_qt/cmake/PackageConfigMSVC.cmake
sandbox_qt/cmake/PackageConfigMinGW.cmake
Removed:
sandbox_qt/doc/api/images/orxonox.jpg
sandbox_qt/src/libraries/core/CorePrecompiledHeaders.h
Modified:
sandbox_qt/CMakeLists.txt
sandbox_qt/INSTALL
sandbox_qt/README
sandbox_qt/bin/CMakeLists.txt
sandbox_qt/bin/vld.ini.in
sandbox_qt/cmake/CompilerConfigGCC.cmake
sandbox_qt/cmake/InstallConfig.cmake
sandbox_qt/cmake/LibraryConfig.cmake
sandbox_qt/cmake/tools/TargetUtilities.cmake
sandbox_qt/data/CMakeLists.txt
sandbox_qt/doc/api/Groups.dox
sandbox_qt/doc/api/doxy.config.in
sandbox_qt/doc/api/main.dox
sandbox_qt/src/CMakeLists.txt
sandbox_qt/src/OrxonoxConfig.h.in
sandbox_qt/src/SpecialConfig.h.in
sandbox_qt/src/external/CMakeLists.txt
sandbox_qt/src/libraries/CMakeLists.txt
sandbox_qt/src/libraries/core/CMakeLists.txt
sandbox_qt/src/libraries/core/Core.cc
sandbox_qt/src/libraries/core/Core.h
sandbox_qt/src/libraries/core/CorePrereqs.h
sandbox_qt/src/libraries/core/Game.cc
sandbox_qt/src/libraries/core/Game.h
sandbox_qt/src/libraries/core/PathConfig.cc
sandbox_qt/src/libraries/core/PathConfig.h
sandbox_qt/src/libraries/util/CMakeLists.txt
sandbox_qt/src/libraries/util/Exception.cc
sandbox_qt/src/libraries/util/Math.cc
sandbox_qt/src/libraries/util/Math.h
sandbox_qt/src/libraries/util/Singleton.h
sandbox_qt/src/libraries/util/StringUtils.cc
sandbox_qt/src/libraries/util/UtilPrereqs.h
sandbox_qt/src/orxonox-main.vcproj.user.in
sandbox_qt/src/orxonox/CMakeLists.txt
sandbox_qt/src/orxonox/Main.cc
sandbox_qt/src/orxonox/OrxonoxPrereqs.h
Log:
Basic stuff up and running for the Qt sandbox.
No GUI support yet.
Modified: sandbox_qt/CMakeLists.txt
===================================================================
--- sandbox_qt/CMakeLists.txt 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/CMakeLists.txt 2010-09-11 22:47:30 UTC (rev 7421)
@@ -51,7 +51,6 @@
SET(DEFAULT_RUNTIME_PATH bin)
SET(DEFAULT_LIBRARY_PATH lib)
SET(DEFAULT_ARCHIVE_PATH lib/static)
-SET(DEFAULT_MODULE_PATH lib/modules)
SET(DEFAULT_DOC_PATH doc)
SET(DEFAULT_DATA_PATH data)
SET(DEFAULT_CONFIG_PATH config)
@@ -61,15 +60,11 @@
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_RUNTIME_PATH})
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_LIBRARY_PATH})
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_ARCHIVE_PATH})
-SET(CMAKE_MODULE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_MODULE_PATH})
SET(CMAKE_DOC_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_DOC_PATH})
# Data directories are only inputs, no delclaration here
SET(CMAKE_CONFIG_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_CONFIG_PATH})
SET(CMAKE_LOG_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_LOG_PATH})
-# Set the extension of the dynamic modules
-SET(ORXONOX_MODULE_EXTENSION ".module")
-
# Sets where to find the external libraries like OgreMain.dll at runtime
# On Unix you should not have to change this at all.
# This only applies to development runs in the build tree
Modified: sandbox_qt/INSTALL
===================================================================
--- sandbox_qt/INSTALL 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/INSTALL 2010-09-11 22:47:30 UTC (rev 7421)
@@ -5,22 +5,4 @@
************** Libraries ****************
-In order to compile Orxonox you will need the following libraries:
-(for windows there are already precompiled packages on the website)
-
-OGRE 3D Graphics Engine 1.4 - 1.7
-CEGUI (Crazy Eddie's GUI System) 0.5 - 0.6
-Boost libraries 1.35 -
-ENet (Network library) 1.1 - 1.2
-Lua (scripting language) 5.0 - 5.1
-Tcl (shell script language) 8.4 - 8.5
-OpenAL (audio) (no version requirements specified yet)
-ALUT (audio) (no version requirements specified yet)
-LibOgg (no version requirements specified yet)
-LibVorbis (no version requirements specified yet)
-ZLib (compression) (no version requirements specified yet)
-
-OGRE supports both OpenGL and DirectX9 rendering. You will also need OGRE for the dedicated server!
-
-Further information about installing and running this application can be found on
-http://www.orxonox.net/wiki/Running
+In order to compile this Orxonox sandbox you will need to install Qt 4.6
Modified: sandbox_qt/README
===================================================================
--- sandbox_qt/README 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/README 2010-09-11 22:47:30 UTC (rev 7421)
@@ -1,20 +1,3 @@
-Hi there,
+This is a fork of the Orxonox trunk used to quickly set up some arbitrary test program.
-We are proud to present you Orxonox - the most ferious 3D space shooter ever to exist.
-
-This game is free, if you have paid for this, get your money back! The source code of this game is licensed under the GPL (GNU General Public License).
-The game content is licensed under the Creative Commons Attribution-Sharealike 3.0 license. For more information read LICENSE in the same folder you found this file.
-
-For directions to install this game, please check out the file INSTALL or http://www.orxonox.net/wiki/Running
-
-This application uses the Ogre Graphics Engine (http://www.ogre3d.org), if you haven't already downloaded a precompiled version of Ogre with this package. Visit our webpage to get your Orxonox compatible version of the Ogre libraries.
-
-This is an open source game. If you want to contribute check out http://www.orxonox.net/wiki/development to find more information how you could help us making the game better. We are always looking for programmers and content designers, who like to contribute.
-
-We hope you have fun playing the game. Check out http://www.orxonox.net for news and newer versions of the game.
-
-Please contact us in our forum ( http://forum.orxonox.net ) or check out our contact page ( http://www.orxonox.net/wiki/about#Contact ). We hope to hear from you and are looking forward to your feedback.
-
-
-Cheers,
-The Orxonox Development Team
+To make life easier you work with the Qt framework and even do some UI stuff.
Modified: sandbox_qt/bin/CMakeLists.txt
===================================================================
--- sandbox_qt/bin/CMakeLists.txt 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/bin/CMakeLists.txt 2010-09-11 22:47:30 UTC (rev 7421)
@@ -25,7 +25,7 @@
#
# Create run scripts for Windows to manually add the DLL path when executing
-SET(RUN_SCRIPTS run standalone client1 client2 server dedicated dedicatedClient)
+SET(RUN_SCRIPTS run)
IF(WIN32)
FOREACH(_script ${RUN_SCRIPTS})
LIST(REMOVE_ITEM RUN_SCRIPTS ${_script})
Modified: sandbox_qt/bin/vld.ini.in
===================================================================
--- sandbox_qt/bin/vld.ini.in 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/bin/vld.ini.in 2010-09-11 22:47:30 UTC (rev 7421)
@@ -55,7 +55,7 @@
; Valid Values: Any list containing module names (i.e. names of EXEs or DLLs).
; Default: None.
;
-ForceIncludeModules = boost_date_time-vc80-mt-gd-1_39.dll, boost_filesystem-vc80-mt-gd-1_39.dll, boost_system-vc80-mt-gd-1_39.dll, boost_thread-vc80-mt-gd-1_39.dll, enet_d.dll, lua_d.dll, ogg_d.dll, vorbis_d.dll, vorbifile_d.dll
+ForceIncludeModules =
; Maximum number of data bytes to display for each leaked block. If zero, then
; the data dump is completely suppressed and only call stacks are shown.
Modified: sandbox_qt/cmake/CompilerConfigGCC.cmake
===================================================================
--- sandbox_qt/cmake/CompilerConfigGCC.cmake 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/cmake/CompilerConfigGCC.cmake 2010-09-11 22:47:30 UTC (rev 7421)
@@ -36,14 +36,6 @@
OUTPUT_VARIABLE GCC_VERSION
)
-# Complain about incompatibilities
-COMPARE_VERSION_STRINGS("${GCC_VERSION}" "4.4.0" _compare_result)
-IF(NOT _compare_result LESS 0)
- IF(${Boost_VERSION} LESS 103700)
- MESSAGE(STATUS "Warning: Boost versions earlier than 1.37 may not compile with GCC 4.4 or later!")
- ENDIF()
-ENDIF()
-
# GCC may not support #pragma GCC system_header correctly when using
# templates. According to Bugzilla, it was fixed March 07 but tests
# have confirmed that GCC 4.0.0 does not pose a problem for our cases.
@@ -80,7 +72,7 @@
# For GCC older than version 4, do not display sign compare warnings
# because of boost::filesystem (which creates about a hundred per include)
-ADD_COMPILER_FLAGS("-Wno-sign-compare" GCC_NO_SYSTEM_HEADER_SUPPORT CACHE)
+#ADD_COMPILER_FLAGS("-Wno-sign-compare" GCC_NO_SYSTEM_HEADER_SUPPORT CACHE)
# For newer GCC (4.3 and above), don't display hundreds of annoying deprecated
# messages. Other versions don't seem to show any such warnings at all.
Modified: sandbox_qt/cmake/InstallConfig.cmake
===================================================================
--- sandbox_qt/cmake/InstallConfig.cmake 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/cmake/InstallConfig.cmake 2010-09-11 22:47:30 UTC (rev 7421)
@@ -42,7 +42,6 @@
SET(RUNTIME_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${DEFAULT_RUNTIME_PATH})
SET(LIBRARY_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${DEFAULT_LIBRARY_PATH})
SET(ARCHIVE_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${DEFAULT_ARCHIVE_PATH})
-SET(MODULE_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${DEFAULT_MODULE_PATH})
SET(DOC_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${DEFAULT_DOC_PATH})
SET(DATA_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${DEFAULT_DATA_PATH})
SET(CONFIG_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${DEFAULT_CONFIG_PATH})
@@ -54,7 +53,6 @@
SET(RUNTIME_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/games)
SET(LIBRARY_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/lib/games/orxonox)
SET(ARCHIVE_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/lib/games/orxonox/static)
- SET(MODULE_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/lib/games/orxonox/modules)
SET(DOC_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/share/doc/orxonox)
SET(DATA_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/share/games/orxonox)
ENDIF()
Modified: sandbox_qt/cmake/LibraryConfig.cmake
===================================================================
--- sandbox_qt/cmake/LibraryConfig.cmake 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/cmake/LibraryConfig.cmake 2010-09-11 22:47:30 UTC (rev 7421)
@@ -39,15 +39,10 @@
# On Windows using a package causes way less problems
SET(_option_msg "Set this to true to use precompiled dependecy archives")
-IF(WIN32)
- OPTION(DEPENDENCY_PACKAGE_ENABLE "${_option_msg}" ON)
-ELSE(WIN32)
- OPTION(DEPENDENCY_PACKAGE_ENABLE "${_option_msg}" FALSE)
-ENDIF(WIN32)
+OPTION(DEPENDENCY_PACKAGE_ENABLE "${_option_msg}" FALSE)
# Scripts for specific library and CMake config
INCLUDE(LibraryConfigTardis)
-INCLUDE(LibraryConfigApple)
IF(DEPENDENCY_PACKAGE_ENABLE)
GET_FILENAME_COMPONENT(_dep_dir_1 ${CMAKE_SOURCE_DIR}/../dependencies ABSOLUTE)
@@ -92,123 +87,20 @@
############### Library finding #################
# Performs the search and sets the variables #
-FIND_PACKAGE(OGRE 1.4 REQUIRED)
-FIND_PACKAGE(ENet 1.1 REQUIRED)
-FIND_PACKAGE(Ogg REQUIRED)
-FIND_PACKAGE(Vorbis REQUIRED)
-FIND_PACKAGE(ALUT REQUIRED)
-FIND_PACKAGE(ZLIB REQUIRED)
-IF(POCO_REQUIRED)
- FIND_PACKAGE(POCO REQUIRED)
-ENDIF()
-IF(WIN32)
- FIND_PACKAGE(DirectX REQUIRED)
-ENDIF()
+FIND_PACKAGE(QT4 COMPONENTS QtCore QtGui REQUIRED)
-##### CEGUI #####
-# We make use of the CEGUI script module called CEGUILua.
-# However there is a small issue with that: We use Tolua, a C++ binding
-# generator ourselves. And we also have to use our bindings in the same
-# lua state is CEGUILua's. Unfortunately this implies that both lua runtime
-# version are equal or else you get segmentation faults.
-# In order to match the Lua versions we decided to ship CEGUILua in our
-# repository, mainly because there is no way to determine which version of
-# Lua CEGUILua was linked against (you'd have to specify yourself) and secondly
-# because we can then choose the Lua version. Future plans might involve only
-# accepting Lua 5.1.
-# Insert all internally supported CEGUILua versions here
-SET(CEGUILUA_INTERNAL_SUPPORT 0.5.0 0.6.0 0.6.1 0.6.2)
-OPTION(CEGUILUA_USE_EXTERNAL_LIBRARY "Force the use of external CEGUILua library" OFF)
-FIND_PACKAGE(CEGUI 0.5 REQUIRED)
-
-##### Lua #####
-IF(CEGUILUA_USE_EXTERNAL_LIBRARY)
- COMPARE_VERSION_STRINGS(${CEGUI_VERSION} "0.6" _version_comparison)
- IF(version_comparison LESS 0)
- SET(LUA_VERSION_REQUEST 5.0)
- ELSE()
- SET(LUA_VERSION_REQUEST 5.1)
- ENDIF()
-ELSE()
- SET(LUA_VERSION_REQUEST 5)
-ENDIF()
-FIND_PACKAGE(Lua ${LUA_VERSION_REQUEST} EXACT REQUIRED)
-
-##### OpenAL #####
-FIND_PACKAGE(OpenAL REQUIRED)
-# Also use parent include dir (without AL/) for ALUT
-IF(OPENAL_INCLUDE_DIR MATCHES "/AL$")
- GET_FILENAME_COMPONENT(ALT_OPENAL_INCLUDE_DIR ${OPENAL_INCLUDE_DIR} PATH)
-ENDIF()
-SET(OPENAL_INCLUDE_DIRS ${OPENAL_INCLUDE_DIR} ${ALT_OPENAL_INCLUDE_DIR})
-# Notfiy user
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenAL DEFAULT_MSG OPENAL_LIBRARY OPENAL_INCLUDE_DIR)
-# Hide variables created by the script
-MARK_AS_ADVANCED(OPENAL_INCLUDE_DIR OPENAL_LIBRARY)
-
-##### Tcl #####
-# We only require Tcl, so avoid confusing user about other Tcl stuff by
-# applying a little workaround
-SET(Tclsh_FIND_QUIETLY TRUE)
-FIND_PACKAGE(TCL QUIET)
-# Display messages separately
-SET(TCL_FIND_QUIETLY FALSE)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(TCL DEFAULT_MSG TCL_LIBRARY TCL_INCLUDE_PATH)
-
-##### Boost #####
-# Expand the next statement if newer boost versions than 1.36.1 are released
-SET(Boost_ADDITIONAL_VERSIONS 1.37 1.37.0 1.38 1.38.0 1.39 1.39.0 1.40 1.40.0
- 1.41 1.41.0 1.42 1.42.0 1.43 1.43.0 1.44 1.44.0)
-IF( NOT TARDIS )
- FIND_PACKAGE(Boost 1.35 REQUIRED thread filesystem system date_time)
-ENDIF()
-# No auto linking, so this option is useless anyway
-MARK_AS_ADVANCED(Boost_LIB_DIAGNOSTIC_DEFINITIONS)
-
-
####### Static/Dynamic linking options ##########
# On Windows dynamically linked libraries need some special treatment
# You may want to edit these settings if you provide your own libraries
# Note: Default option in the libraries vary, but our default option is dynamic
IF(WIN32)
- OPTION(LINK_BOOST_DYNAMIC "Link Boost dynamically on Windows" TRUE)
- OPTION(LINK_CEGUI_DYNAMIC "Link CEGUI dynamicylly on Windows" TRUE)
- OPTION(LINK_ENET_DYNAMIC "Link ENet dynamically on Windows" TRUE)
- OPTION(LINK_OGRE_DYNAMIC "Link OGRE dynamically on Windows" TRUE)
- OPTION(LINK_TCL_DYNAMIC "Link TCL dynamically on Windows" TRUE)
- OPTION(LINK_ZLIB_DYNAMIC "Link ZLib dynamically on Windows" TRUE)
- COMPARE_VERSION_STRINGS("${LUA_VERSION}" "5.1" _version_comparison)
- IF(_version_comparison LESS 0)
- OPTION(LINK_LUA_DYNAMIC "Link Lua dynamically on Windows" FALSE)
- ELSE(_version_comparison LESS 0)
- OPTION(LINK_LUA_DYNAMIC "Link Lua dynamically on Windows" TRUE)
- ENDIF(_version_comparison LESS 0)
+ #OPTION(LINK_ZLIB_DYNAMIC "Link ZLib dynamically on Windows" TRUE)
IF(DEPENDENCY_PACKAGE_ENABLE)
- MARK_AS_ADVANCED(
- LINK_BOOST_DYNAMIC LINK_CEGUI_DYNAMIC LINK_ENET_DYNAMIC
- LINK_OGRE_DYNAMIC LINK_TCL_DYNAMIC LINK_ZLIB_DYNAMIC
- LINK_LUA_DYNAMIC
- )
+ #MARK_AS_ADVANCED(
+ #LINK_ZLIB_DYNAMIC
+ #)
ENDIF()
ENDIF(WIN32)
-
-
-################# OGRE Plugins ##################
-
-# More plugins: Plugin_BSPSceneManager, Plugin_OctreeSceneManager
-SET(OGRE_PLUGINS_INT Plugin_ParticleFX)
-IF(WIN32)
- # CG program manager is probably DirectX related (not available under unix)
- LIST(APPEND OGRE_PLUGINS_INT Plugin_CgProgramManager)
-ENDIF(WIN32)
-SET(OGRE_PLUGINS ${OGRE_PLUGINS_INT} CACHE STRING
- "Specify which OGRE plugins to load. Existance check is performed.")
-
-# Check the plugins and determine the plugin folder
-# You can give a hint by setting the environment variable ENV{OGRE_PLUGIN_DIR}
-INCLUDE(CheckOGREPlugins)
-CHECK_OGRE_PLUGINS(${OGRE_PLUGINS})
-
Copied: sandbox_qt/cmake/LibraryConfigTardis.cmake (from rev 7418, sandbox_qt/cmake/LibraryConfigTardis.cmake)
===================================================================
--- sandbox_qt/cmake/LibraryConfigTardis.cmake (rev 0)
+++ sandbox_qt/cmake/LibraryConfigTardis.cmake 2010-09-11 22:47:30 UTC (rev 7421)
@@ -0,0 +1,33 @@
+ #
+ # ORXONOX - the hottest 3D action shooter ever to exist
+ # > www.orxonox.net <
+ #
+ # This program is free software; you can redistribute it and/or
+ # modify it under the terms of the GNU General Public License
+ # as published by the Free Software Foundation; either version 2
+ # of the License, or (at your option) any later version.
+ #
+ # This program is distributed in the hope that it will be useful,
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ # GNU General Public License for more details.
+ #
+ # You should have received a copy of the GNU General Public License along
+ # with this program; if not, write to the Free Software Foundation,
+ # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ #
+ #
+ # Author:
+ # Adrian Friedli
+ # Description:
+ # Sets the TARDIS variable.
+ #
+
+IF(UNIX AND NOT APPLE)
+ IF(EXISTS /etc/hostname)
+ FILE(STRINGS /etc/hostname HOSTNAME LIMIT_COUNT 1)
+ IF(${HOSTNAME} MATCHES "^tardis-[a-z][0-9][0-9]$")
+ SET (TARDIS ON)
+ ENDIF()
+ ENDIF()
+ENDIF()
Copied: sandbox_qt/cmake/PackageConfig.cmake (from rev 7418, sandbox_qt/cmake/PackageConfig.cmake)
===================================================================
--- sandbox_qt/cmake/PackageConfig.cmake (rev 0)
+++ sandbox_qt/cmake/PackageConfig.cmake 2010-09-11 22:47:30 UTC (rev 7421)
@@ -0,0 +1,60 @@
+ #
+ # ORXONOX - the hottest 3D action shooter ever to exist
+ # > www.orxonox.net <
+ #
+ # This program is free software; you can redistribute it and/or
+ # modify it under the terms of the GNU General Public License
+ # as published by the Free Software Foundation; either version 2
+ # of the License, or (at your option) any later version.
+ #
+ # This program is distributed in the hope that it will be useful,
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ # GNU General Public License for more details.
+ #
+ # You should have received a copy of the GNU General Public License along
+ # with this program; if not, write to the Free Software Foundation,
+ # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ #
+ #
+ # Author:
+ # Reto Grieder
+ # Description:
+ # General package configuration. Merely sets the include paths.
+ # Library files are treated separately.
+ #
+
+IF(NOT _INTERNAL_PACKAGE_MESSAGE)
+ MESSAGE(STATUS "Using library package for the dependencies.")
+ SET(_INTERNAL_PACKAGE_MESSAGE 1 CACHE INTERNAL "Do not edit!" FORCE)
+ENDIF()
+
+# Include paths and other special treatments
+#SET(ENV{ALUTDIR} ${DEP_INCLUDE_DIR}/freealut)
+#LIST(APPEND CMAKE_INCLUDE_PATH ${DEP_INCLUDE_DIR}/tcl/include)
+
+### INSTALL ###
+
+# On Windows, DLLs have to be in the executable folder, install them
+IF(WIN32 AND DEP_BINARY_DIR)
+ ## DEBUG
+ # When installing a debug version, we really can't know which libraries
+ # are used in released mode because there might be deps of deps.
+ # --> Copy all of them, except the debug databases
+ INSTALL(
+ DIRECTORY ${DEP_BINARY_DIR}/
+ DESTINATION bin
+ CONFIGURATIONS Debug
+ REGEX "^.*\\.pdb$" EXCLUDE
+ )
+
+ ## RELEASE
+ # Try to filter out all the debug libraries. If the regex doesn't do the
+ # job anymore, simply adjust it.
+ INSTALL(
+ DIRECTORY ${DEP_BINARY_DIR}/
+ DESTINATION bin
+ CONFIGURATIONS Release RelWithDebInfo MinSizeRel
+ REGEX "_[Dd]\\.[a-zA-Z0-9+-]+$|-mt-gd-|^.*\\.pdb$" EXCLUDE
+ )
+ENDIF()
Copied: sandbox_qt/cmake/PackageConfigMSVC.cmake (from rev 7418, sandbox_qt/cmake/PackageConfigMSVC.cmake)
===================================================================
--- sandbox_qt/cmake/PackageConfigMSVC.cmake (rev 0)
+++ sandbox_qt/cmake/PackageConfigMSVC.cmake 2010-09-11 22:47:30 UTC (rev 7421)
@@ -0,0 +1,64 @@
+ #
+ # ORXONOX - the hottest 3D action shooter ever to exist
+ # > www.orxonox.net <
+ #
+ # This program is free software; you can redistribute it and/or
+ # modify it under the terms of the GNU General Public License
+ # as published by the Free Software Foundation; either version 2
+ # of the License, or (at your option) any later version.
+ #
+ # This program is distributed in the hope that it will be useful,
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ # GNU General Public License for more details.
+ #
+ # You should have received a copy of the GNU General Public License along
+ # with this program; if not, write to the Free Software Foundation,
+ # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ #
+ #
+ # Author:
+ # Reto Grieder
+ # Description:
+ # Sets the library directories when using precompiled dependency archives
+ # Note:
+ # When setting ENV${} variables, make sure to use quotes for lists
+ #
+
+IF(MSVC)
+
+ # 64 bit system?
+ IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ SET(BINARY_POSTFIX x64)
+ ELSE()
+ SET(BINARY_POSTFIX x86)
+ ENDIF()
+
+ # Choose right MSVC version
+ STRING(REGEX REPLACE "^Visual Studio ([0-9][0-9]?) .*$" "\\1"
+ _msvc_version "${CMAKE_GENERATOR}")
+
+ SET(DEP_INCLUDE_DIR ${DEPENDENCY_PACKAGE_DIR}/include)
+ SET(DEP_LIBRARY_DIR ${DEPENDENCY_PACKAGE_DIR}/lib/msvc${_msvc_version}-${BINARY_POSTFIX})
+ SET(DEP_BINARY_DIR ${DEPENDENCY_PACKAGE_DIR}/bin/msvc${_msvc_version}-${BINARY_POSTFIX})
+ IF(NOT EXISTS ${DEP_LIBRARY_DIR})
+ message(FATAL_ERROR "No binaries found for your MSVC Version (${CMAKE_GENERATOR})")
+ ENDIF()
+
+ # Also the directory with the runtime libraries
+ SET(RUNTIME_LIBRARY_DIRECTORY ${DEP_BINARY_DIR})
+
+ # Sets the library path for the FIND_LIBRARY
+ SET(CMAKE_LIBRARY_PATH ${DEP_LIBRARY_DIR})
+
+ # Certain find scripts don't behave as ecpected to we have
+ # to specify the libraries ourselves.
+ #SET(TCL_LIBRARY ${DEP_LIBRARY_DIR}/tcl85.lib CACHE FILEPATH "")
+
+ # Visual Leak Detector
+ SET(VLD_INCLUDE_DIR ${DEP_INCLUDE_DIR}/vld CACHE PATH "")
+ SET(VLD_LIBRARY_DIR ${DEP_LIBRARY_DIR} CACHE PATH "")
+ LINK_DIRECTORIES(${VLD_LIBRARY_DIR}) # Used for auto-linking
+ MARK_AS_ADVANCED(VLD_INCLUDE_DIR VLD_LIBRARY_DIR)
+
+ENDIF(MSVC)
Copied: sandbox_qt/cmake/PackageConfigMinGW.cmake (from rev 7418, sandbox_qt/cmake/PackageConfigMinGW.cmake)
===================================================================
--- sandbox_qt/cmake/PackageConfigMinGW.cmake (rev 0)
+++ sandbox_qt/cmake/PackageConfigMinGW.cmake 2010-09-11 22:47:30 UTC (rev 7421)
@@ -0,0 +1,51 @@
+ #
+ # ORXONOX - the hottest 3D action shooter ever to exist
+ # > www.orxonox.net <
+ #
+ # This program is free software; you can redistribute it and/or
+ # modify it under the terms of the GNU General Public License
+ # as published by the Free Software Foundation; either version 2
+ # of the License, or (at your option) any later version.
+ #
+ # This program is distributed in the hope that it will be useful,
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ # GNU General Public License for more details.
+ #
+ # You should have received a copy of the GNU General Public License along
+ # with this program; if not, write to the Free Software Foundation,
+ # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ #
+ #
+ # Author:
+ # Reto Grieder
+ # Description:
+ # Sets the library directories when using precompiled dependency archives
+ # Note:
+ # When setting ENV${} variables, make sure to use quotes for lists
+ #
+
+IF(MINGW)
+
+ # 64 bit system?
+ IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ SET(BINARY_POSTFIX x64)
+ ELSE()
+ SET(BINARY_POSTFIX x86)
+ ENDIF()
+
+ SET(DEP_INCLUDE_DIR ${DEPENDENCY_PACKAGE_DIR}/include)
+ SET(DEP_LIBRARY_DIR ${DEPENDENCY_PACKAGE_DIR}/lib/mingw-${BINARY_POSTFIX})
+ SET(DEP_BINARY_DIR ${DEPENDENCY_PACKAGE_DIR}/bin/mingw-${BINARY_POSTFIX})
+
+ # Also the directory with the runtime libraries
+ SET(RUNTIME_LIBRARY_DIRECTORY ${DEP_BINARY_DIR})
+
+ # Sets the library path for the FIND_LIBRARY
+ SET(CMAKE_LIBRARY_PATH ${DEP_LIBRARY_DIR} ${DEP_BINARY_DIR})
+
+ # Certain find scripts don't behave as ecpected to we have
+ # to specify the libraries ourselves.
+ #SET(TCL_LIBRARY ${DEP_BINARY_DIR}/tcl85.dll CACHE FILEPATH "")
+
+ENDIF(MINGW)
Modified: sandbox_qt/cmake/tools/TargetUtilities.cmake
===================================================================
--- sandbox_qt/cmake/tools/TargetUtilities.cmake 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/cmake/tools/TargetUtilities.cmake 2010-09-11 22:47:30 UTC (rev 7421)
@@ -33,7 +33,6 @@
# ORXONOX_EXTERNAL: Specify this for third party libraries
# NO_DLL_INTERFACE: Link statically with MSVC
# NO_SOURCE_GROUPS: Don't create msvc source groups
- # MODULE: For dynamic module libraries (libraries only)
# WIN32: Inherited from ADD_EXECUTABLE (executables only)
# PCH_NO_DEFAULT: Do not make precompiled header files default if
# specified with PCH_FILE
@@ -45,10 +44,11 @@
# VERSION: Set version to the binary
# SOURCE_FILES: Source files for the target
# DEFINE_SYMBOL: Sets the DEFINE_SYMBOL target property
- # TOLUA_FILES: Files with tolua interface
# PCH_FILE: Precompiled header file
# PCH_EXCLUDE: Source files to be excluded from PCH support
# OUTPUT_NAME: If you want a different name than the target name
+ # QT_MOC_FILES: List of files to be processed by Qt MOC
+ # QT_UIC_FILES: List of files to be processed by Qt UIC
# Note:
# This function also installs the target!
# Prerequisistes:
@@ -59,7 +59,6 @@
INCLUDE(CMakeDependentOption)
INCLUDE(CapitaliseName)
-INCLUDE(GenerateToluaBindings)
INCLUDE(ParseMacroArguments)
INCLUDE(SourceFileUtilities)
IF(PCH_COMPILER_SUPPORT)
@@ -67,7 +66,7 @@
ENDIF()
MACRO(ORXONOX_ADD_LIBRARY _target_name)
- TU_ADD_TARGET(${_target_name} LIBRARY "MODULE" ${ARGN})
+ TU_ADD_TARGET(${_target_name} LIBRARY "" ${ARGN})
ENDMACRO(ORXONOX_ADD_LIBRARY)
MACRO(ORXONOX_ADD_EXECUTABLE _target_name)
@@ -84,8 +83,8 @@
NO_DLL_INTERFACE NO_SOURCE_GROUPS PCH_NO_DEFAULT
NO_INSTALL NO_VERSION ${_additional_switches})
SET(_list_names LINK_LIBRARIES VERSION SOURCE_FILES
- DEFINE_SYMBOL TOLUA_FILES PCH_FILE
- PCH_EXCLUDE OUTPUT_NAME)
+ DEFINE_SYMBOL PCH_FILE PCH_EXCLUDE
+ OUTPUT_NAME QT_MOC_FILES QT_UIC_FILES)
PARSE_MACRO_ARGUMENTS("${_switches}" "${_list_names}" ${ARGN})
@@ -106,19 +105,22 @@
GET_ALL_HEADER_FILES(_${_target_name}_header_files)
ENDIF()
- # Combine source and header files
+ # Combine source, header and QT designer files
SET(_${_target_name}_files
${_${_target_name}_header_files}
${_${_target_name}_source_files}
+ ${_arg_QT_UIC_FILES}
)
# Remove potential duplicates
LIST(REMOVE_DUPLICATES _${_target_name}_files)
- # TOLUA_FILES
- IF(_arg_TOLUA_FILES)
- GENERATE_TOLUA_BINDINGS(${_target_name_capitalised} _${_target_name}_files
- INPUTFILES ${_arg_TOLUA_FILES})
+ # QT MOC and UIC preprocessing
+ IF(_arg_QT_MOC_FILES)
+ QT4_WRAP_CPP(_${_target_name}_files ${_arg_QT_MOC_FILES})
ENDIF()
+ IF(_arg_QT_UIC_FILES)
+ QT4_WRAP_UI(_${_target_name}_files ${_arg_QT_UIC_FILES})
+ ENDIF()
# First part (pre target) of precompiled header files
IF(PCH_COMPILER_SUPPORT AND _arg_PCH_FILE)
@@ -207,17 +209,6 @@
SET_TARGET_PROPERTIES(${_target_name} PROPERTIES COMPILE_FLAGS "${_compile_flags} -Zm1000")
ENDIF()
- # Configure modules
- IF (_arg_MODULE)
- SET_TARGET_PROPERTIES(${_target_name} PROPERTIES
- RUNTIME_OUTPUT_DIRECTORY ${CMAKE_MODULE_OUTPUT_DIRECTORY} # Windows
- LIBRARY_OUTPUT_DIRECTORY ${CMAKE_MODULE_OUTPUT_DIRECTORY} # Unix
- )
- ADD_MODULE(${_target_name})
- # Ensure that the main program depends on the module
- SET(ORXONOX_MODULES ${ORXONOX_MODULES} ${_target_name} CACHE STRING "" FORCE)
- ENDIF()
-
# LINK_LIBRARIES
IF(_arg_LINK_LIBRARIES)
TARGET_LINK_LIBRARIES(${_target_name} ${_arg_LINK_LIBRARIES})
@@ -250,52 +241,10 @@
# Install all targets except for static ones (executables also have SHARED in _link_mode)
IF(${_link_mode} STREQUAL "SHARED" AND NOT _arg_NO_INSTALL)
- IF(_arg_MODULE)
- INSTALL(TARGETS ${_target_name}
- RUNTIME DESTINATION ${MODULE_INSTALL_DIRECTORY}
- LIBRARY DESTINATION ${MODULE_INSTALL_DIRECTORY}
- )
- ELSE()
- INSTALL(TARGETS ${_target_name}
- RUNTIME DESTINATION ${RUNTIME_INSTALL_DIRECTORY}
- LIBRARY DESTINATION ${LIBRARY_INSTALL_DIRECTORY}
- )
- ENDIF()
+ INSTALL(TARGETS ${_target_name}
+ RUNTIME DESTINATION ${RUNTIME_INSTALL_DIRECTORY}
+ LIBRARY DESTINATION ${LIBRARY_INSTALL_DIRECTORY}
+ )
ENDIF()
ENDMACRO(TU_ADD_TARGET)
-
-
-# Creates a helper file with name <name_of_the_library>${ORXONOX_MODULE_EXTENSION}
-# This helps finding dynamically loadable modules at runtime
-
-FUNCTION(ADD_MODULE _target)
- # We use the properties to get the name because the librarys name may differ from
- # the target name (for example orxonox <-> liborxonox)
-
- GET_TARGET_PROPERTY(_target_loc ${_target} LOCATION)
- GET_FILENAME_COMPONENT(_target_name ${_target_loc} NAME_WE)
-
- IF(CMAKE_CONFIGURATION_TYPES)
- FOREACH(_config ${CMAKE_CONFIGURATION_TYPES})
- SET(_module_filename ${CMAKE_MODULE_OUTPUT_DIRECTORY}/${_config}/${_target_name}${ORXONOX_MODULE_EXTENSION})
-
- FILE(WRITE ${_module_filename})
-
- INSTALL(
- FILES ${_module_filename}
- DESTINATION ${MODULE_INSTALL_DIRECTORY}
- CONFIGURATIONS ${_config}
- )
- ENDFOREACH()
- ELSE()
- SET(_module_filename ${CMAKE_MODULE_OUTPUT_DIRECTORY}/${_target_name}${ORXONOX_MODULE_EXTENSION})
-
- FILE(WRITE ${_module_filename})
-
- INSTALL(
- FILES ${_module_filename}
- DESTINATION ${MODULE_INSTALL_DIRECTORY}
- )
- ENDIF()
-ENDFUNCTION(ADD_MODULE)
Modified: sandbox_qt/data/CMakeLists.txt
===================================================================
--- sandbox_qt/data/CMakeLists.txt 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/data/CMakeLists.txt 2010-09-11 22:47:30 UTC (rev 7421)
@@ -29,38 +29,10 @@
SET(DATA_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
SET(DATA_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE)
-# Specify data directory
-GET_FILENAME_COMPONENT(_search_path_1 ${CMAKE_SOURCE_DIR}/../data_extern ABSOLUTE)
-FIND_PATH(EXTERNAL_DATA_DIRECTORY resources.oxr
- PATHS
- ${CMAKE_SOURCE_DIR}/data_extern
- ${_search_path_1}
- NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH
-)
-
-IF(NOT EXTERNAL_DATA_DIRECTORY)
- MESSAGE(STATUS "Warning: External data directory not found. If you want to compile while downloading the data files, you will have to recompile about four files afterwards and relink everything.")
- MESSAGE(STATUS "You can specify your own folder with the EXTERNAL_DATA_DIRECTORY variable. Default location for the path is orxonox_root/data_extern")
- # Temporary override to the default location.
- SET(EXTERNAL_DATA_DIRECTORY ${CMAKE_SOURCE_DIR}/data_extern)
-ENDIF()
-
-
################ Installation #################
-# Internal directory
INSTALL(
DIRECTORY ${DATA_DIRECTORY}/
DESTINATION ${DATA_INSTALL_DIRECTORY}
REGEX "\\.svn$|_svn$|CMakeLists.txt|InstallScript.cmake" EXCLUDE
)
-# External directory
-INSTALL(
- DIRECTORY ${EXTERNAL_DATA_DIRECTORY}/
- DESTINATION ${DATA_INSTALL_DIRECTORY}
- REGEX "\\.svn$|_svn$|resources\\.oxr|AUTHORS|LICENSE" EXCLUDE
-)
-# Configure the install scripts (variables not available during installation)
-CONFIGURE_FILE(DataInstallScript.cmake ${CMAKE_CURRENT_BINARY_DIR}/DataInstallScript.cmake @ONLY)
-# Join both resources.oxr files
-INSTALL(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/DataInstallScript.cmake)
Modified: sandbox_qt/doc/api/Groups.dox
===================================================================
--- sandbox_qt/doc/api/Groups.dox 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/doc/api/Groups.dox 2010-09-11 22:47:30 UTC (rev 7421)
@@ -43,109 +43,6 @@
*/
/**
- @defgroup Class Class management
- @ingroup Core
-*/
-
-/**
- @defgroup Object Object management
- @ingroup Core
-*/
-
-/**
- @defgroup Command Command
- @ingroup Core
-*/
-
-/**
@defgroup Config Config
@ingroup Core
*/
-
-/**
- @defgroup Input Input
- @ingroup Core
-*/
-
-/**
- @defgroup Management Management
- @ingroup Core
-*/
-
-/**
- @defgroup XML XML
- @ingroup Core
-*/
-
-/**
- @defgroup Network Network
-
- The network library is used to connect clients and server, to synchronize objects and variables, and
- to transmit network function calls. It contains the central @ref orxonox::Server "Server" and
- @ref orxonox::Client "Client" classes as well as several functions and macros for
- @ref orxonox::Synchronisable "synchronisable" classes.
-*/
-
-/**
- @defgroup Tools Tools
-
- The tools are a bunch of utilities that belong to the Orxonox library, but are independent of other
- features.
-*/
-
-/**
- @defgroup Orxonox Orxonox
-
- The Orxonox library contains the central and most important classes of the game. Managers, interfaces,
- base-classes, and more are located in Orxonox. More specialized classes that inherit of the base-classes
- in Orxonox are often sourced out to the modules.
-*/
-
-/**
- @defgroup Modules Modules
-
- The modules are libraries that depend on the Orxonox library and that are loaded dynamically on runtime
- (in contrast to statically loaded libraries like util and core). Each module contains some classes that
- are usually connected to each other, but they are independent of other modules. However modules can still
- link to other modules, but only in a hierarchical order, no circular dependencies.
-*/
-
-/**
- @defgroup Designtools Designtools
- @ingroup Modules
-*/
-
-/**
- @defgroup Notifications Notifications
- @ingroup Modules
-*/
-
-/**
- @defgroup Objects Objects
- @ingroup Modules
-*/
-
-/**
- @defgroup Overlays Overlays
- @ingroup Modules
-*/
-
-/**
- @defgroup Pickup Pickup
- @ingroup Modules
-*/
-
-/**
- @defgroup Pong Pong
- @ingroup Modules
-*/
-
-/**
- @defgroup Questsystem Questsystem
- @ingroup Modules
-*/
-
-/**
- @defgroup Weapons Weapons
- @ingroup Modules
-*/
Modified: sandbox_qt/doc/api/doxy.config.in
===================================================================
--- sandbox_qt/doc/api/doxy.config.in 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/doc/api/doxy.config.in 2010-09-11 22:47:30 UTC (rev 7421)
@@ -623,14 +623,7 @@
# excluded from the INPUT source files. This way you can easily exclude a
# subdirectory from a directory tree whose root is specified with the INPUT tag.
-EXCLUDE = @CMAKE_SOURCE_DIR@/src/external/bullet/ \
- @CMAKE_SOURCE_DIR@/src/external/cpptcl/ \
- @CMAKE_SOURCE_DIR@/src/external/ceguilua/ceguilua-0.5.0 \
- @CMAKE_SOURCE_DIR@/src/external/ceguilua/ceguilua-0.6.0 \
- @CMAKE_SOURCE_DIR@/src/external/ceguilua/ceguilua-0.6.1 \
- @CMAKE_SOURCE_DIR@/src/libraries/core/command/IOConsoleWindows.h \
- @CMAKE_SOURCE_DIR@/src/libraries/core/command/IOConsoleWindows.cc \
- @CMAKE_SOURCE_DIR@/src/libraries/tools/bsp \
+EXCLUDE =
# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
# directories that are symbolic links (a Unix filesystem feature) are excluded
Deleted: sandbox_qt/doc/api/images/orxonox.jpg
===================================================================
(Binary files differ)
Modified: sandbox_qt/doc/api/main.dox
===================================================================
--- sandbox_qt/doc/api/main.dox 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/doc/api/main.dox 2010-09-11 22:47:30 UTC (rev 7421)
@@ -1,15 +1,5 @@
/**
@mainpage
- @image html orxonox.jpg
-
- This is the documentation of Orxonox. It contains descriptions of our classes and functions and
- explains their usage with several examples and background information. Because Orxonox is so big,
- we can't document all of our code - sorry for that! But we do your best to document the most
- important parts of it, namely the @ref Core "core" and @ref Util "util" libraries, as well as the
- central classes in the @ref Orxonox "orxonox" main library and some @ref Modules "modules".
-
- To understand the connection between different classes in Orxonox, have a look at the
- <a href="modules.html"><b>Modules section</b></a>. It contains a list of the most important topics
- and groups files that contribute to the same feature.
+ This is the documentation of some test project. It has not yet been written though...
*/
Modified: sandbox_qt/src/CMakeLists.txt
===================================================================
--- sandbox_qt/src/CMakeLists.txt 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/src/CMakeLists.txt 2010-09-11 22:47:30 UTC (rev 7421)
@@ -32,24 +32,13 @@
####### Library Behaviour (dependencies) ########
-# Disable Boost auto linking completely
-ADD_COMPILER_FLAGS("-DBOOST_ALL_NO_LIB")
-
# If no defines are specified, these libs get linked statically
-ADD_COMPILER_FLAGS("-DBOOST_ALL_DYN_LINK" WIN32 LINK_BOOST_DYNAMIC)
-ADD_COMPILER_FLAGS("-DENET_DLL" WIN32 LINK_ENET_DYNAMIC)
-ADD_COMPILER_FLAGS("-DLUA_BUILD_AS_DLL" WIN32 LINK_LUA_DYNAMIC)
-ADD_COMPILER_FLAGS("-DZLIB_DLL" WIN32 LINK_ZLIB_DYNAMIC)
+#ADD_COMPILER_FLAGS("-DZLIB_DLL" WIN32 LINK_ZLIB_DYNAMIC)
# If no defines are specified, these libs get linked dynamically
-ADD_COMPILER_FLAGS("-DCEGUI_STATIC" WIN32 NOT LINK_CEGUI_DYNAMIC)
-ADD_COMPILER_FLAGS("-DOGRE_STATIC_LIB" WIN32 NOT LINK_OGRE_DYNAMIC)
-ADD_COMPILER_FLAGS("-DSTATIC_BUILD" WIN32 NOT LINK_TCL_DYNAMIC)
+#ADD_COMPILER_FLAGS("-DSTATIC_BUILD" WIN32 NOT LINK_TCL_DYNAMIC)
######### Library Behaviour (external) ##########
-# Use TinyXML++
-ADD_COMPILER_FLAGS("-DTIXML_USE_TICPP")
-
# Default linking for externals is SHARED
SET(ORXONOX_EXTERNAL_LINK_MODE SHARED CACHE STRING "Link mode for external libraries that we build ourselves. Note: on Windows, some libraries cannot be linked shared.")
@@ -59,61 +48,34 @@
SET(_external_shared_link FALSE)
ENDIF()
# If no defines are specified, these libs get linked dynamically
-ADD_COMPILER_FLAGS("-DCEGUILUA_STATIC" WIN32 NOT _external_shared_link)
-ADD_COMPILER_FLAGS("-DOGRE_GUIRENDERER_STATIC_LIB" WIN32 NOT _external_shared_link)
-ADD_COMPILER_FLAGS("-DOIS_STATIC_LIB" WIN32 NOT _external_shared_link)
-ADD_COMPILER_FLAGS("-DTOLUA_STATIC_BUILD" WIN32 NOT _external_shared_link)
+#ADD_COMPILER_FLAGS("-DTOLUA_STATIC_BUILD" WIN32 NOT _external_shared_link)
############## Include Directories ##############
# Set the search paths for include files
INCLUDE_DIRECTORIES(
# External
- ${OGRE_INCLUDE_DIR}
- ${CEGUI_INCLUDE_DIR}
- ${ENET_INCLUDE_DIR}
- ${Boost_INCLUDE_DIRS}
- ${POCO_INCLUDE_DIR}
- ${OPENAL_INCLUDE_DIRS}
- ${ALUT_INCLUDE_DIR}
- ${VORBIS_INCLUDE_DIR}
- ${OGG_INCLUDE_DIR}
- ${LUA_INCLUDE_DIR}
- ${TCL_INCLUDE_PATH}
- ${DIRECTX_INCLUDE_DIR}
- ${ZLIB_INCLUDE_DIR}
${VLD_INCLUDE_DIR}
# All includes in "externals" should be prefixed with the path
# relative to "external" to avoid conflicts
${CMAKE_CURRENT_SOURCE_DIR}/external
# Include directories needed even if only included by Orxonox
- ${CMAKE_CURRENT_SOURCE_DIR}/external/bullet
- ${CMAKE_CURRENT_SOURCE_DIR}/external/ois
+ #${CMAKE_CURRENT_SOURCE_DIR}/external/bullet
# OrxonoxConfig.h
${CMAKE_CURRENT_BINARY_DIR}
)
-IF(CEGUILUA_USE_INTERNAL_LIBRARY)
- INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/external/ceguilua/ceguilua-${CEGUI_VERSION})
-ENDIF()
+###################### Qt4 ######################
-################### Tolua Bind ##################
+INCLUDE(${QT_USE_FILE})
-# Create directory because the tolua application doesn't work otherwise
-IF(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/toluabind/${CMAKE_CFG_INTDIR})
- FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/toluabind/${CMAKE_CFG_INTDIR})
-ENDIF()
-
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/toluabind/${CMAKE_CFG_INTDIR})
-
################ Sub Directories ################
ADD_SUBDIRECTORY(external)
ADD_SUBDIRECTORY(libraries)
ADD_SUBDIRECTORY(orxonox)
-ADD_SUBDIRECTORY(modules)
################## Executable ###################
@@ -136,8 +98,6 @@
Orxonox.cc
OUTPUT_NAME orxonox
)
-# Main executable should depend on all modules
-ADD_DEPENDENCIES(orxonox-main ${ORXONOX_MODULES})
# Get name to configure the run scripts
GET_TARGET_PROPERTY(_exec_loc orxonox-main LOCATION)
@@ -169,7 +129,6 @@
# the correct path to use when including a file, e.g.
# core/XMLPort.h instead of src/core/XMLPort.h
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/modules)
GET_DIRECTORY_PROPERTY(_temp INCLUDE_DIRECTORIES)
# Replace ';' by spaces
STRING(REPLACE ";" " " _temp "${_temp}")
Modified: sandbox_qt/src/OrxonoxConfig.h.in
===================================================================
--- sandbox_qt/src/OrxonoxConfig.h.in 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/src/OrxonoxConfig.h.in 2010-09-11 22:47:30 UTC (rev 7421)
@@ -193,24 +193,5 @@
typedef basic_string<char, char_traits<char>, allocator<char> > string;
}
-// Import general purpose smart pointers
-namespace boost
-{
- template<class T> class scoped_ptr;
- template<class T> class shared_ptr;
- template<class T> class weak_ptr;
- template<class T> class intrusive_ptr;
- template<class T> class shared_array;
- template<class T> class scoped_array;
-}
-namespace orxonox
-{
- using boost::scoped_ptr;
- using boost::shared_ptr;
- using boost::weak_ptr;
- using boost::intrusive_ptr;
- using boost::shared_array;
- using boost::scoped_array;
-}
#endif /* _OrxonoxConfig_H__ */
Modified: sandbox_qt/src/SpecialConfig.h.in
===================================================================
--- sandbox_qt/src/SpecialConfig.h.in 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/src/SpecialConfig.h.in 2010-09-11 22:47:30 UTC (rev 7421)
@@ -41,8 +41,6 @@
#include "OrxonoxConfig.h"
-#cmakedefine CEGUILUA_USE_INTERNAL_LIBRARY ///< Set whether we must suffix "ceguilua/" for the CEGUILua.h include
-
#cmakedefine DEPENDENCY_PACKAGE_ENABLE ///< Defined if a precompiled depdency package was used. We then copy all libraries too when installing.
#cmakedefine INSTALL_COPYABLE ///< Orxonox either gets installed to the system or just into a folder. The latter uses relative paths.
@@ -56,7 +54,6 @@
const char defaultRuntimePath[] = "@DEFAULT_RUNTIME_PATH@";
const char defaultLibraryPath[] = "@DEFAULT_LIBRARY_PATH@";
const char defaultArchivePath[] = "@DEFAULT_ARCHIVE_PATH@";
- const char defaultModulePath[] = "@DEFAULT_MODULE_PATH@";
const char defaultDocPath[] = "@DEFAULT_DOC_PATH@";
const char defaultDataPath[] = "@DEFAULT_DATA_PATH@";
const char defaultConfigPath[] = "@DEFAULT_CONFIG_PATH@";
@@ -65,18 +62,14 @@
#ifndef INSTALL_COPYABLE
// INSTALLATION PATHS
const char dataInstallDirectory[] = "@DATA_INSTALL_DIRECTORY@";
- const char moduleInstallDirectory[] = "@MODULE_INSTALL_DIRECTORY@";
#endif
// DEVELOPMENT RUN PATHS
const char dataDevDirectory[] = "@DATA_DIRECTORY@";
- const char externalDataDevDirectory[] = "@EXTERNAL_DATA_DIRECTORY@";
#ifdef CMAKE_CONFIGURATION_TYPES
- const char moduleDevDirectory[] = "@CMAKE_MODULE_OUTPUT_DIRECTORY@/" CMAKE_INTDIR;
const char configDevDirectory[] = "@CMAKE_CONFIG_OUTPUT_DIRECTORY@/" CMAKE_INTDIR;
const char logDevDirectory[] = "@CMAKE_LOG_OUTPUT_DIRECTORY@/" CMAKE_INTDIR;
#else
- const char moduleDevDirectory[] = "@CMAKE_MODULE_OUTPUT_DIRECTORY@";
const char configDevDirectory[] = "@CMAKE_CONFIG_OUTPUT_DIRECTORY@";
const char logDevDirectory[] = "@CMAKE_LOG_OUTPUT_DIRECTORY@";
#endif
@@ -84,26 +77,6 @@
#ifdef DEPENDENCY_PACKAGE_ENABLE
const char dependencyLibraryDirectory[] = "@DEP_LIBRARY_DIR@";
#endif
-
- // Module extension
- const char moduleExtension[] = "@ORXONOX_MODULE_EXTENSION@";
-
- // OGRE PLUGINS
-#ifdef NDEBUG
- const char ogrePlugins[] = "@OGRE_PLUGINS_RELEASE@";
-# ifdef DEPENDENCY_PACKAGE_ENABLE
- const char ogrePluginsDirectory[] = ".";
-# else
- const char ogrePluginsDirectory[] = "@OGRE_PLUGINS_FOLDER_RELEASE@";
-# endif
-#else
- const char ogrePlugins[] = "@OGRE_PLUGINS_DEBUG@";
-# ifdef DEPENDENCY_PACKAGE_ENABLE
- const char ogrePluginsDirectory[] = ".";
-# else
- const char ogrePluginsDirectory[] = "@OGRE_PLUGINS_FOLDER_DEBUG@";
-# endif
-#endif
} }
#cmakedefine ORXONOX_USE_WINMAIN ///< Using MSVC or XCode IDE
Modified: sandbox_qt/src/external/CMakeLists.txt
===================================================================
--- sandbox_qt/src/external/CMakeLists.txt 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/src/external/CMakeLists.txt 2010-09-11 22:47:30 UTC (rev 7421)
@@ -19,21 +19,4 @@
################ Sub Directories ################
-ADD_SUBDIRECTORY(tolua)
-
-# Include CEGUILua if not requested otherwise
-IF(CEGUILUA_USE_INTERNAL_LIBRARY)
- IF(NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ceguilua/ceguilua-${CEGUI_VERSION})
- MESSAGE(FATAL_ERROR "CEGUILua version not found in src folder. Update list of supported versions in LibraryConfig.cmake!")
- ENDIF()
-
- ADD_SUBDIRECTORY(ceguilua)
- SET(CEGUILUA_LIBRARY ${CEGUILUA_LIBRARY} PARENT_SCOPE)
-ENDIF()
-
-ADD_SUBDIRECTORY(bullet)
-ADD_SUBDIRECTORY(cpptcl)
ADD_SUBDIRECTORY(loki)
-ADD_SUBDIRECTORY(ogreceguirenderer)
-ADD_SUBDIRECTORY(ois)
-ADD_SUBDIRECTORY(tinyxml)
Modified: sandbox_qt/src/libraries/CMakeLists.txt
===================================================================
--- sandbox_qt/src/libraries/CMakeLists.txt 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/src/libraries/CMakeLists.txt 2010-09-11 22:47:30 UTC (rev 7421)
@@ -23,5 +23,3 @@
ADD_SUBDIRECTORY(util)
ADD_SUBDIRECTORY(core)
-ADD_SUBDIRECTORY(network)
-ADD_SUBDIRECTORY(tools)
Modified: sandbox_qt/src/libraries/core/CMakeLists.txt
===================================================================
--- sandbox_qt/src/libraries/core/CMakeLists.txt 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/src/libraries/core/CMakeLists.txt 2010-09-11 22:47:30 UTC (rev 7421)
@@ -18,86 +18,15 @@
#
SET_SOURCE_FILES(CORE_SRC_FILES
- CommandLineParser.cc
- ConfigValueContainer.cc
Core.cc
- DynLib.cc
- DynLibManager.cc
- Event.cc
Game.cc
- GameMode.cc
- GameState.cc
- GraphicsManager.cc
- GUIManager.cc
- Language.cc
- LuaState.cc
- ObjectListBase.cc
- OrxonoxClass.cc
- Resource.cc
- WindowEventListener.cc
-
- # hierarchy
- Identifier.cc
- MetaObjectList.cc
-
- # level
- BaseObject.cc
- ClassTreeMask.cc
- Loader.cc
- Namespace.cc
- NamespaceNode.cc
- Template.cc
- XMLPort.cc
- XMLNameListener.cc
-
-COMPILATION_BEGIN FilesystemCompilation.cc
- command/ArgumentCompletionFunctions.cc
- ConfigFileManager.cc
- MemoryArchive.cc
PathConfig.cc
-COMPILATION_END
-
- # multithreading
- ThreadPool.cc
-COMPILATION_BEGIN ThreadCompilation.cc
- command/TclThreadManager.cc
- Thread.cc
-COMPILATION_END
)
-ADD_SUBDIRECTORY(command)
-ADD_SUBDIRECTORY(input)
-
ORXONOX_ADD_LIBRARY(core
FIND_HEADER_FILES
- TOLUA_FILES
- command/CommandExecutor.h
- ConfigFileManager.h
- Game.h
- GameMode.h
- GUIManager.h
- Loader.h
- LuaState.h
- PathConfig.h
- input/InputManager.h
- input/KeyBinder.h
- input/KeyBinderManager.h
- PCH_FILE
- CorePrecompiledHeaders.h
LINK_LIBRARIES
- ${OGRE_LIBRARY}
- ${Boost_FILESYSTEM_LIBRARY}
- ${Boost_SYSTEM_LIBRARY} # Filesystem dependency
- ${Boost_THREAD_LIBRARY}
- ${Boost_DATE_TIME_LIBRARY} # Thread dependency
- ${CEGUI_LIBRARY}
- ${CEGUILUA_LIBRARY}
- ${LUA_LIBRARIES}
- cpptcl_orxonox
- ogreceguirenderer_orxonox
- ois_orxonox
- tinyxml_orxonox
- tolua_orxonox
+ ${QT_QTCORE_LIBRARY}
util
SOURCE_FILES
${CORE_SRC_FILES}
Modified: sandbox_qt/src/libraries/core/Core.cc
===================================================================
--- sandbox_qt/src/libraries/core/Core.cc 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/src/libraries/core/Core.cc 2010-09-11 22:47:30 UTC (rev 7421)
@@ -30,12 +30,13 @@
/**
@file
@brief
- Implementation of the Core singleton with its global variables (avoids boost include)
+ Implementation of the Core singleton
*/
#include "Core.h"
#include <cassert>
+#include <ctime>
#include <fstream>
#include <vector>
@@ -48,139 +49,42 @@
# undef max
#endif
-#include "util/Clock.h"
#include "util/Debug.h"
#include "util/Exception.h"
-#include "util/Scope.h"
-#include "util/ScopedSingletonManager.h"
-#include "util/SignalHandler.h"
#include "PathConfig.h"
-#include "CommandLineParser.h"
-#include "ConfigFileManager.h"
-#include "ConfigValueIncludes.h"
-#include "CoreIncludes.h"
-#include "DynLibManager.h"
-#include "GameMode.h"
-#include "GraphicsManager.h"
-#include "GUIManager.h"
-#include "Identifier.h"
-#include "Language.h"
-#include "LuaState.h"
-#include "command/ConsoleCommand.h"
-#include "command/IOConsole.h"
-#include "command/TclBind.h"
-#include "command/TclThreadManager.h"
-#include "input/InputManager.h"
namespace orxonox
{
//! Static pointer to the singleton
Core* Core::singletonPtr_s = 0;
- SetCommandLineArgument(settingsFile, "orxonox.ini").information("THE configuration file");
- SetCommandLineSwitch(noIOConsole).information("Use this if you don't want to use the IOConsole (for instance for Lua debugging)");
-
-#ifdef ORXONOX_PLATFORM_WINDOWS
- SetCommandLineArgument(limitToCPU, 1).information("Limits the program to one CPU/core (1, 2, 3, etc.). Default is the first core (faster than off)");
-#endif
-
Core::Core(const std::string& cmdLine)
- // Cleanup guard for identifier destruction (incl. XMLPort, configValues, consoleCommands)
- : identifierDestroyer_(Identifier::destroyAllIdentifiers)
- // Cleanup guard for external console commands that don't belong to an Identifier
- , consoleCommandDestroyer_(ConsoleCommand::destroyAll)
- , bGraphicsLoaded_(false)
- , bStartIOConsole_(true)
{
// Set the hard coded fixed paths
this->pathConfig_.reset(new PathConfig());
- // Create a new dynamic library manager
- this->dynLibManager_.reset(new DynLibManager());
-
- // Load modules
- const std::vector<std::string>& modulePaths = this->pathConfig_->getModulePaths();
- for (std::vector<std::string>::const_iterator it = modulePaths.begin(); it != modulePaths.end(); ++it)
- {
- try
- {
- this->dynLibManager_->load(*it);
- }
- catch (...)
- {
- COUT(1) << "Couldn't load module \"" << *it << "\": " << Exception::handleMessage() << std::endl;
- }
- }
-
- // Parse command line arguments AFTER the modules have been loaded (static code!)
- CommandLineParser::parseCommandLine(cmdLine);
-
// Set configurable paths like log, config and media
this->pathConfig_->setConfigurablePaths();
- // create a signal handler (only active for Linux)
- // This call is placed as soon as possible, but after the directories are set
- this->signalHandler_.reset(new SignalHandler());
- this->signalHandler_->doCatch(PathConfig::getExecutablePathString(), PathConfig::getLogPathString() + "orxonox_crash.log");
-
// Set the correct log path. Before this call, /tmp (Unix) or %TEMP% (Windows) was used
OutputHandler::getInstance().setLogPath(PathConfig::getLogPathString());
- // Parse additional options file now that we know its path
- CommandLineParser::parseFile();
-
#ifdef ORXONOX_PLATFORM_WINDOWS
// limit the main thread to the first core so that QueryPerformanceCounter doesn't jump
- // do this after ogre has initialised. Somehow Ogre changes the settings again (not through
- // the timer though).
- int limitToCPU = CommandLineParser::getValue("limitToCPU");
+ int limitToCPU = 0;//CommandLineParser::getValue("limitToCPU");
if (limitToCPU > 0)
setThreadAffinity(static_cast<unsigned int>(limitToCPU));
#endif
- // Manage ini files and set the default settings file (usually orxonox.ini)
- this->configFileManager_.reset(new ConfigFileManager());
- this->configFileManager_->setFilename(ConfigFileType::Settings,
- CommandLineParser::getValue("settingsFile").getString());
-
- // Required as well for the config values
- this->languageInstance_.reset(new Language());
-
- // Do this soon after the ConfigFileManager has been created to open up the
- // possibility to configure everything below here
- ClassIdentifier<Core>::getIdentifier("Core")->initialiseObject(this, "Core", true);
- this->setConfigValues();
-
- // create persistent io console
- if (CommandLineParser::getValue("noIOConsole").getBool())
- {
- ModifyConfigValue(bStartIOConsole_, tset, false);
- }
- if (this->bStartIOConsole_)
- this->ioConsole_.reset(new IOConsole());
-
- // creates the class hierarchy for all classes with factories
- Identifier::createClassHierarchy();
-
- // Load OGRE excluding the renderer and the render window
- this->graphicsManager_.reset(new GraphicsManager(false));
-
- // initialise Tcl
- this->tclBind_.reset(new TclBind(PathConfig::getDataPathString()));
- this->tclThreadManager_.reset(new TclThreadManager(tclBind_->getTclInterpreter()));
-
- // Create singletons that always exist (in other libraries)
- this->rootScope_.reset(new Scope<ScopeID::Root>());
-
// Generate documentation instead of normal run?
std::string docFilename;
- CommandLineParser::getValue("generateDoc", &docFilename);
+ //CommandLineParser::getValue("generateDoc", &docFilename);
if (!docFilename.empty())
{
std::ofstream docFile(docFilename.c_str());
if (docFile.is_open())
{
- CommandLineParser::generateDoc(docFile);
+ //CommandLineParser::generateDoc(docFile);
docFile.close();
}
else
@@ -190,12 +94,10 @@
/**
@brief
- All destruction code is handled by scoped_ptrs and ScopeGuards.
+ All destruction code is handled by QScopedPointers
*/
Core::~Core()
{
- // Remove us from the object lists again to avoid problems when destroying them
- this->unregisterObject();
}
//! Function to collect the SetConfigValue-macro calls.
@@ -206,6 +108,7 @@
#else
const unsigned int defaultLevelLogFile = 4;
#endif
+ /*
SetConfigValueExternal(softDebugLevelLogFile_, "OutputHandler", "softDebugLevelLogFile", defaultLevelLogFile)
.description("The maximum level of debug output shown in the log file");
OutputHandler::getInstance().setSoftDebugLevel(OutputHandler::logFileOutputListenerName_s, this->softDebugLevelLogFile_);
@@ -218,15 +121,9 @@
.callback(this, &Core::initRandomNumberGenerator);
SetConfigValue(bStartIOConsole_, true)
.description("Set to false if you don't want to use the IOConsole (for Lua debugging for instance)");
+ */
}
- //! Callback function if the language has changed.
- void Core::languageChanged()
- {
- // Read the translation file after the language was configured
- Language::getInstance().readTranslatedLanguageFile();
- }
-
void Core::initRandomNumberGenerator()
{
static bool bInitialized = false;
@@ -238,76 +135,6 @@
}
}
- void Core::loadGraphics()
- {
- // Any exception should trigger this, even in upgradeToGraphics (see its remarks)
- Loki::ScopeGuard unloader = Loki::MakeObjGuard(*this, &Core::unloadGraphics);
-
- // Upgrade OGRE to receive a render window
- try
- {
- graphicsManager_->upgradeToGraphics();
- }
- catch (...)
- {
- // Recovery from this is very difficult. It requires to completely
- // destroy Ogre related objects and load again (without graphics).
- // However since Ogre 1.7 there seems to be a problem when Ogre
- // throws an exception and the graphics engine then gets destroyed
- // and reloaded between throw and catch (access violation in MSVC).
- // That's why we abort completely and only display the exception.
- COUT(0) << "An exception occurred during upgrade to graphics. "
- << "That is unrecoverable. The message was:" << endl
- << Exception::handleMessage() << endl;
- abort();
- }
-
- // Calls the InputManager which sets up the input devices.
- inputManager_.reset(new InputManager());
-
- // Load the CEGUI interface
- guiManager_.reset(new GUIManager(inputManager_->getMousePosition()));
-
- bGraphicsLoaded_ = true;
- GameMode::bShowsGraphics_s = true;
-
- // Load some sort of a debug overlay (only denoted by its name, "debug.oxo")
- graphicsManager_->loadDebugOverlay();
-
- // Create singletons associated with graphics (in other libraries)
- graphicsScope_.reset(new Scope<ScopeID::Graphics>());
-
- unloader.Dismiss();
- }
-
- void Core::unloadGraphics()
- {
- this->graphicsScope_.reset();
- this->guiManager_.reset();
- this->inputManager_.reset();
- this->graphicsManager_.reset();
-
- // Load Ogre::Root again, but without the render system
- try
- { this->graphicsManager_.reset(new GraphicsManager(false)); }
- catch (...)
- {
- COUT(0) << "An exception occurred during 'unloadGraphics':" << Exception::handleMessage() << std::endl
- << "Another exception might be being handled which may lead to undefined behaviour!" << std::endl
- << "Terminating the program." << std::endl;
- abort();
- }
-
- bGraphicsLoaded_ = false;
- GameMode::bShowsGraphics_s = false;
- }
-
- //! Sets the language in the config-file back to the default.
- void Core::resetLanguage()
- {
- ResetConfigValue(language_);
- }
-
/**
@note
The code of this function has been copied and adjusted from OGRE, an open source graphics engine.
@@ -353,37 +180,4 @@
SetThreadAffinityMask(GetCurrentThread(), threadMask);
#endif
}
-
- void Core::preUpdate(const Clock& time)
- {
- // Update singletons before general ticking
- ScopedSingletonManager::preUpdate<ScopeID::Root>(time);
- if (this->bGraphicsLoaded_)
- {
- // Process input events
- this->inputManager_->preUpdate(time);
- // Update GUI
- this->guiManager_->preUpdate(time);
- // Update singletons before general ticking
- ScopedSingletonManager::preUpdate<ScopeID::Graphics>(time);
- }
- // Process console events and status line
- if (this->ioConsole_ != NULL)
- this->ioConsole_->preUpdate(time);
- // Process thread commands
- this->tclThreadManager_->preUpdate(time);
- }
-
- void Core::postUpdate(const Clock& time)
- {
- // Update singletons just before rendering
- ScopedSingletonManager::postUpdate<ScopeID::Root>(time);
- if (this->bGraphicsLoaded_)
- {
- // Update singletons just before rendering
- ScopedSingletonManager::postUpdate<ScopeID::Graphics>(time);
- // Render (doesn't throw)
- this->graphicsManager_->postUpdate(time);
- }
- }
}
Modified: sandbox_qt/src/libraries/core/Core.h
===================================================================
--- sandbox_qt/src/libraries/core/Core.h 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/src/libraries/core/Core.h 2010-09-11 22:47:30 UTC (rev 7421)
@@ -44,11 +44,11 @@
#include "CorePrereqs.h"
#include <string>
-#include <boost/scoped_ptr.hpp>
+#include <QScopedPointer>
#include <loki/ScopeGuard.h>
#include "util/Singleton.h"
-#include "OrxonoxClass.h"
+#include "PathConfig.h"
namespace orxonox
{
@@ -58,7 +58,7 @@
@remark
You should only create this singleton once because it destroys the identifiers!
*/
- class _CoreExport Core : public Singleton<Core>, public OrxonoxClass
+ class _CoreExport Core : public Singleton<Core>
{
typedef Loki::ScopeGuardImpl0<void (*)()> SimpleScopeGuard;
friend class Singleton<Core>;
@@ -77,48 +77,20 @@
void setConfigValues();
- //! Returns the configured language.
- const std::string& getLanguage()
- { return this->language_; }
- void resetLanguage();
-
private:
Core(const Core&); //!< Don't use (undefined symbol)
- void languageChanged();
void initRandomNumberGenerator();
- void preUpdate(const Clock& time);
- void postUpdate(const Clock& time);
+ void update() {}
- void loadGraphics();
- void unloadGraphics();
-
void setThreadAffinity(int limitToCPU);
// MANAGED SINGLETONS/OBJECTS
// Mind the order for the destruction!
- scoped_ptr<PathConfig> pathConfig_;
- scoped_ptr<DynLibManager> dynLibManager_;
- scoped_ptr<SignalHandler> signalHandler_;
- SimpleScopeGuard identifierDestroyer_;
- SimpleScopeGuard consoleCommandDestroyer_;
- scoped_ptr<ConfigFileManager> configFileManager_;
- scoped_ptr<Language> languageInstance_;
- scoped_ptr<IOConsole> ioConsole_;
- scoped_ptr<TclBind> tclBind_;
- scoped_ptr<TclThreadManager> tclThreadManager_;
- scoped_ptr<Scope<ScopeID::Root> > rootScope_;
- // graphical
- scoped_ptr<GraphicsManager> graphicsManager_; //!< Interface to OGRE
- scoped_ptr<InputManager> inputManager_; //!< Interface to OIS
- scoped_ptr<GUIManager> guiManager_; //!< Interface to GUI
- scoped_ptr<Scope<ScopeID::Graphics> > graphicsScope_;
+ QScopedPointer<PathConfig> pathConfig_;
- bool bGraphicsLoaded_;
int softDebugLevelLogFile_; //!< The debug level for the log file (belongs to OutputHandler)
- std::string language_; //!< The language
bool bInitRandomNumberGenerator_; //!< If true, srand(time(0)) is called
- bool bStartIOConsole_; //!< Set to false if you don't want to use the IOConsole
static Core* singletonPtr_s;
};
Deleted: sandbox_qt/src/libraries/core/CorePrecompiledHeaders.h
===================================================================
--- sandbox_qt/src/libraries/core/CorePrecompiledHeaders.h 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/src/libraries/core/CorePrecompiledHeaders.h 2010-09-11 22:47:30 UTC (rev 7421)
@@ -1,86 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-/**
- at file
- at brief
- Compilation of the most often used header files in the core library
- at details
- Updated: 13. September 2009
- Total Files: 56
-*/
-
-#include "OrxonoxConfig.h"
-
-///////////////////////////////////////////
-///// Stable Headers /////
-///////////////////////////////////////////
-
-#include <string> // 54
-#include <vector> // 54
-#include <cassert> // 53
-#include <fstream> // 53
-#include <iostream> // 53
-#include <map> // 53
-#include <sstream> // 53
-#include <set> // 50
-
-#include "util/Debug.h" // 48
-
-#include <deque> // 43
-#include <list> // 44
-#include <cmath> // 42
-
-#include <loki/ScopeGuard.h> // 38
-
-#include <OgreMath.h> // 36
-#include <OgreVector2.h> // 36
-#include <OgreVector3.h> // 36
-#include <OgreVector4.h> // 36
-#include <OgreQuaternion.h> // 36
-#include <OgreColourValue.h> // 36
-#include <boost/preprocessor/cat.hpp> // 27
-#include <boost/shared_ptr.hpp> // 21
-
-#ifdef ORXONOX_COMPILER_MSVC
-
-#include <ois/OISKeyboard.h> // 15
-#include <ois/OISMouse.h> // 15
-#include <ois/OISJoyStick.h> // 15
-
-#include "util/SubString.h" // 14
-
-#include <boost/scoped_ptr.hpp> // 13
-#include <stack> // 12
-
-#endif /*ORXONOX_COMPILER_MSVC */
-
-
-// Just in case some header included windows.h
-#undef min
-#undef max
Modified: sandbox_qt/src/libraries/core/CorePrereqs.h
===================================================================
--- sandbox_qt/src/libraries/core/CorePrereqs.h 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/src/libraries/core/CorePrereqs.h 2010-09-11 22:47:30 UTC (rev 7421)
@@ -36,7 +36,6 @@
#define _CorePrereqs_H__
#include "OrxonoxConfig.h"
-#include <boost/version.hpp>
//-----------------------------------------------------------------------
// Shared library settings
@@ -62,281 +61,19 @@
// Constants
//-----------------------------------------------------------------------
-namespace orxonox
-{
- static const uint32_t OBJECTID_UNKNOWN = static_cast<uint32_t>(-1);
-}
-
//-----------------------------------------------------------------------
// Enums
//-----------------------------------------------------------------------
-namespace orxonox
-{
- namespace XMLPort
- {
- enum Mode
- {
- NOP,
- LoadObject,
- SaveObject,
- ExpandObject
- };
- }
-
- namespace ConfigFileType
- {
- enum Value
- {
- Settings,
- JoyStickCalibration,
- CommandHistory
- // Don't forget to adjust the array size in the ConfigFileManager when adding a new entry here!
- };
- }
-
- namespace KeybindMode
- {
- enum Value
- {
- OnPress,
- OnHold,
- OnRelease,
- None
- };
- };
-}
-
//-----------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------
namespace orxonox
{
- typedef std::string LanguageEntryLabel;
-
- template <class T, class U>
- T orxonox_cast(U*);
-
- class BaseObject;
- template <class T>
- class ClassFactory;
- template <class T>
- class ClassIdentifier;
- class ClassTreeMask;
- class ClassTreeMaskIterator;
- class ClassTreeMaskNode;
- class ClassTreeMaskObjectIterator;
- class CommandLineParser;
- class CommandLineArgument;
- class ConfigFile;
- class ConfigFileEntry;
- class ConfigFileEntryComment;
- class ConfigFileEntryValue;
- class ConfigFileManager;
- class ConfigFileSection;
- class ConfigValueContainer;
class Core;
- class DynLib;
- class DynLibManager;
- struct Event;
- class EventState;
- class Factory;
class Game;
- class GameState;
- struct GameStateInfo;
- struct GameStateTreeNode;
- class GraphicsManager;
- class GUIManager;
- class Identifier;
- template <class T>
- class Iterator;
- class Language;
- class LuaFunctor;
- class LuaState;
- class MemoryArchive;
- class MemoryArchiveFactory;
- class MetaObjectList;
- class MetaObjectListElement;
- class Namespace;
- class NamespaceNode;
- template <class T>
- class ObjectList;
- class ObjectListBase;
- class ObjectListBaseElement;
- template <class T>
- class ObjectListElement;
- template <class T>
- class ObjectListIterator;
- class OgreWindowEventListener;
- class OrxonoxClass;
class PathConfig;
- struct ResourceInfo;
- class SettingsConfigFile;
- template <class T>
- class SmartPtr;
- template <class T>
- class SubclassIdentifier;
- class Template;
- class Thread;
- class ThreadPool;
- template <class T>
- class WeakPtr;
- class WindowEventListener;
- class XMLFile;
- class XMLNameListener;
- template <class T, class O>
- class XMLPortClassObjectContainer;
- template <class T>
- class XMLPortClassParamContainer;
- class XMLPortObjectContainer;
- class XMLPortParamContainer;
-
- // Command
- class ArgumentCompleter;
- class ArgumentCompletionListElement;
- class CommandEvaluation;
- class ConsoleCommand;
- class Executor;
- template <class T>
- class ExecutorMember;
- class ExecutorStatic;
- class Functor;
- template <class O>
- class FunctorMember;
- typedef FunctorMember<void> FunctorStatic;
- template <class F, class O>
- class FunctorPointer;
- class IOConsole;
- class IRC;
- class Shell;
- class ShellListener;
- class TclBind;
- struct TclInterpreterBundle;
- template <class T>
- class TclThreadList;
- class TclThreadManager;
-
- // Input
- class BaseCommand;
- class BufferedParamCommand;
- class Button;
- class HalfAxis;
- class InputBuffer;
- class InputDevice;
- template <class Traits>
- class InputDeviceTemplated;
- class InputHandler;
- class InputManager;
- class InputState;
- struct InputStatePriority;
- class JoyStickQuantityListener;
- class JoyStick;
- class KeyBinder;
- class KeyBinderManager;
- class Keyboard;
- class KeyDetector;
- class KeyEvent;
- class Mouse;
- class ParamCommand;
- class SimpleCommand;
}
-#include "command/FunctorPtr.h"
-#include "command/ExecutorPtr.h"
-
-// CppTcl
-namespace Tcl
-{
- class interpreter;
- class object;
-}
-
-// Boost
-namespace boost
-{
-#if (BOOST_VERSION < 104400)
- namespace filesystem
- {
- struct path_traits;
- template <class String, class Traits> class basic_path;
- typedef basic_path<std::string, path_traits> path;
- }
-#else
- namespace filesystem2
- {
- struct path_traits;
- template <class String, class Traits> class basic_path;
- typedef basic_path<std::string, path_traits> path;
- }
- namespace filesystem
- {
- using filesystem2::basic_path;
- using filesystem2::path_traits;
- using filesystem2::path;
- }
-#endif
- class thread;
- class mutex;
- class shared_mutex;
- class condition_variable;
-}
-
-// Ogre
-namespace Ogre
-{
- class DataStream;
- template <class T> class SharedPtr;
- typedef SharedPtr<DataStream> DataStreamPtr;
-}
-namespace orxonox
-{
- // Import the Ogre::DataStream
- using Ogre::DataStream;
- using Ogre::DataStreamPtr;
-}
-
-// CEGUI
-namespace CEGUI
-{
- class DefaultLogger;
- class Logger;
- class LuaScriptModule;
-
- class OgreCEGUIRenderer;
- class OgreCEGUIResourceProvider;
- class OgreCEGUITexture;
-}
-
-// Lua
-struct lua_State;
-
-// TinyXML and TinyXML++
-class TiXmlString;
-class TiXmlOutStream;
-class TiXmlNode;
-class TiXmlHandle;
-class TiXmlDocument;
-class TiXmlElement;
-class TiXmlComment;
-class TiXmlUnknown;
-class TiXmlAttribute;
-class TiXmlText;
-class TiXmlDeclaration;
-class TiXmlParsingData;
-namespace ticpp
-{
- class Document;
- class Element;
- class Declaration;
- class StylesheetReference;
- class Text;
- class Comment;
- class Attribute;
-}
-namespace orxonox
-{
- using ticpp::Element;
-}
-
#endif /* _CorePrereqs_H__ */
Modified: sandbox_qt/src/libraries/core/Game.cc
===================================================================
--- sandbox_qt/src/libraries/core/Game.cc 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/src/libraries/core/Game.cc 2010-09-11 22:47:30 UTC (rev 7421)
@@ -35,576 +35,66 @@
#include "Game.h"
#include <exception>
-#include <boost/weak_ptr.hpp>
-#include <loki/ScopeGuard.h>
-#include "util/Clock.h"
#include "util/Debug.h"
#include "util/Exception.h"
#include "util/Sleep.h"
-#include "util/SubString.h"
-#include "CommandLineParser.h"
#include "Core.h"
-#include "CoreIncludes.h"
-#include "ConfigValueIncludes.h"
-#include "GameMode.h"
-#include "GameState.h"
-#include "GUIManager.h"
-#include "command/ConsoleCommand.h"
namespace orxonox
{
- static void stop_game()
- { Game::getInstance().stop(); }
- SetConsoleCommand("exit", &stop_game);
- static void printFPS()
- { COUT(0) << Game::getInstance().getAvgFPS() << std::endl; }
- SetConsoleCommand("printFPS", &printFPS);
- static void printTickTime()
- { COUT(0) << Game::getInstance().getAvgTickTime() << std::endl; }
- SetConsoleCommand("printTickTime", &printTickTime);
-
- std::map<std::string, GameStateInfo> Game::gameStateDeclarations_s;
Game* Game::singletonPtr_s = 0;
- //! Represents one node of the game state tree.
- struct GameStateTreeNode
- {
- std::string name_;
- weak_ptr<GameStateTreeNode> parent_;
- std::vector<shared_ptr<GameStateTreeNode> > children_;
- };
-
Game::Game(const std::string& cmdLine)
- // Destroy factories before the Core!
- : gsFactoryDestroyer_(Game::GameStateFactory::getFactories(), &std::map<std::string, shared_ptr<GameStateFactory> >::clear)
{
this->bAbort_ = false;
- bChangingState_ = false;
-#ifdef ORXONOX_PLATFORM_WINDOWS
- minimumSleepTime_ = 1000/*us*/;
-#else
- minimumSleepTime_ = 0/*us*/;
-#endif
-
- // reset statistics
- this->statisticsStartTime_ = 0;
- this->statisticsTickTimes_.clear();
- this->periodTickTime_ = 0;
- this->periodTime_ = 0;
- this->avgFPS_ = 0.0f;
- this->avgTickTime_ = 0.0f;
- this->excessSleepTime_ = 0;
-
- // Create an empty root state
- this->declareGameState<GameState>("GameState", "emptyRootGameState", true, false);
-
- // Set up a basic clock to keep time
- this->gameClock_.reset(new Clock());
-
// Create the Core
this->core_.reset(new Core(cmdLine));
-
- // Do this after the Core creation!
- ClassIdentifier<Game>::getIdentifier("Game")->initialiseObject(this, "Game", true);
- this->setConfigValues();
-
- // After the core has been created, we can safely instantiate the GameStates that don't require graphics
- for (std::map<std::string, GameStateInfo>::const_iterator it = gameStateDeclarations_s.begin();
- it != gameStateDeclarations_s.end(); ++it)
- {
- if (!it->second.bGraphicsMode)
- constructedStates_[it->second.stateName] = GameStateFactory::fabricate(it->second);
- }
-
- // The empty root state is ALWAYS loaded!
- this->rootStateNode_ = shared_ptr<GameStateTreeNode>(new GameStateTreeNode());
- this->rootStateNode_->name_ = "emptyRootGameState";
- this->loadedTopStateNode_ = this->rootStateNode_;
- this->loadedStates_.push_back(this->getState(rootStateNode_->name_));
}
/**
@brief
- All destruction code is handled by scoped_ptrs and SimpleScopeGuards.
+ All destruction code is handled by QScopedPointers.
*/
Game::~Game()
{
- // Remove us from the object lists again to avoid problems when destroying them
- this->unregisterObject();
}
void Game::setConfigValues()
{
+ /*
SetConfigValue(statisticsRefreshCycle_, 250000)
.description("Sets the time in microseconds interval at which average fps, etc. get updated.");
SetConfigValue(statisticsAvgLength_, 1000000)
.description("Sets the time in microseconds interval at which average fps, etc. gets calculated.");
SetConfigValue(fpsLimit_, 50)
.description("Sets the desired frame rate (0 for no limit).");
+ */
}
/**
@brief
Main loop of the orxonox game.
- @note
- We use the Ogre::Timer to measure time since it uses the most precise
- method an any platform (however the windows timer lacks time when under
- heavy kernel load!).
*/
void Game::run()
{
- if (this->requestedStateNodes_.empty())
- COUT(0) << "Warning: Starting game without requesting GameState. This automatically terminates the program." << std::endl;
-
- // START GAME
- // first delta time should be about 0 seconds
- this->gameClock_->capture();
- // A first item is required for the fps limiter
- StatisticsTickInfo tickInfo = {0, 0};
- statisticsTickTimes_.push_back(tickInfo);
- while (!this->bAbort_ && (!this->loadedStates_.empty() || this->requestedStateNodes_.size() > 0))
+ while (!this->bAbort_)
{
- // Generate the dt
- this->gameClock_->capture();
-
- // Statistics init
- StatisticsTickInfo tickInfo = {gameClock_->getMicroseconds(), 0};
- statisticsTickTimes_.push_back(tickInfo);
- this->periodTime_ += this->gameClock_->getDeltaTimeMicroseconds();
-
- // Update the GameState stack if required
- this->updateGameStateStack();
-
- // Core preUpdate
try
- { this->core_->preUpdate(*this->gameClock_); }
+ { this->core_->update(); }
catch (...)
{
- COUT(0) << "An exception occurred in the Core preUpdate: " << Exception::handleMessage() << std::endl;
- COUT(0) << "This should really never happen! Closing the program." << std::endl;
- this->stop();
- break;
- }
-
- // Update the GameStates bottom up in the stack
- this->updateGameStates();
-
- // Core postUpdate
- try
- { this->core_->postUpdate(*this->gameClock_); }
- catch (...)
- {
COUT(0) << "An exception occurred in the Core postUpdate: " << Exception::handleMessage() << std::endl;
COUT(0) << "This should really never happen! Closing the program." << std::endl;
this->stop();
break;
}
-
- // Evaluate statistics
- this->updateStatistics();
-
- // Limit frame rate
- this->updateFPSLimiter();
}
-
- // UNLOAD all remaining states
- while (this->loadedStates_.size() > 1)
- this->unloadState(this->loadedStates_.back()->getName());
- this->loadedTopStateNode_ = this->rootStateNode_;
- this->requestedStateNodes_.clear();
}
- void Game::updateGameStateStack()
- {
- while (this->requestedStateNodes_.size() > 0)
- {
- shared_ptr<GameStateTreeNode> requestedStateNode = this->requestedStateNodes_.front();
- assert(this->loadedTopStateNode_);
- if (!this->loadedTopStateNode_->parent_.expired() && requestedStateNode == this->loadedTopStateNode_->parent_.lock())
- this->unloadState(loadedTopStateNode_->name_);
- else // has to be child
- {
- try
- {
- this->loadState(requestedStateNode->name_);
- }
- catch (...)
- {
- COUT(1) << "Error: Loading GameState '" << requestedStateNode->name_ << "' failed: " << Exception::handleMessage() << std::endl;
- // All scheduled operations have now been rendered inert --> flush them and issue a warning
- if (this->requestedStateNodes_.size() > 1)
- COUT(4) << "All " << this->requestedStateNodes_.size() - 1 << " scheduled transitions have been ignored." << std::endl;
- this->requestedStateNodes_.clear();
- break;
- }
- }
- this->loadedTopStateNode_ = requestedStateNode;
- this->requestedStateNodes_.erase(this->requestedStateNodes_.begin());
- }
- }
-
- void Game::updateGameStates()
- {
- // Note: The first element is the empty root state, which doesn't need ticking
- for (GameStateVector::const_iterator it = this->loadedStates_.begin() + 1;
- it != this->loadedStates_.end(); ++it)
- {
- try
- {
- // Add tick time for most of the states
- uint64_t timeBeforeTick = 0;
- if ((*it)->getInfo().bIgnoreTickTime)
- timeBeforeTick = this->gameClock_->getRealMicroseconds();
- (*it)->update(*this->gameClock_);
- if ((*it)->getInfo().bIgnoreTickTime)
- this->subtractTickTime(static_cast<int32_t>(this->gameClock_->getRealMicroseconds() - timeBeforeTick));
- }
- catch (...)
- {
- COUT(1) << "An exception occurred while updating '" << (*it)->getName() << "': " << Exception::handleMessage() << std::endl;
- COUT(1) << "This should really never happen!" << std::endl;
- COUT(1) << "Unloading all GameStates depending on the one that crashed." << std::endl;
- shared_ptr<GameStateTreeNode> current = this->loadedTopStateNode_;
- while (current->name_ != (*it)->getName() && current)
- current = current->parent_.lock();
- if (current && current->parent_.lock())
- this->requestState(current->parent_.lock()->name_);
- else
- this->stop();
- break;
- }
- }
- }
-
- void Game::updateStatistics()
- {
- // Add the tick time of this frame (rendering time has already been subtracted)
- uint64_t currentTime = gameClock_->getMicroseconds();
- uint64_t currentRealTime = gameClock_->getRealMicroseconds();
- this->statisticsTickTimes_.back().tickLength += (uint32_t)(currentRealTime - currentTime);
- this->periodTickTime_ += (uint32_t)(currentRealTime - currentTime);
- if (this->periodTime_ > this->statisticsRefreshCycle_)
- {
- std::list<StatisticsTickInfo>::iterator it = this->statisticsTickTimes_.begin();
- assert(it != this->statisticsTickTimes_.end());
- int64_t lastTime = currentTime - this->statisticsAvgLength_;
- if (static_cast<int64_t>(it->tickTime) < lastTime)
- {
- do
- {
- assert(this->periodTickTime_ >= it->tickLength);
- this->periodTickTime_ -= it->tickLength;
- ++it;
- assert(it != this->statisticsTickTimes_.end());
- } while (static_cast<int64_t>(it->tickTime) < lastTime);
- this->statisticsTickTimes_.erase(this->statisticsTickTimes_.begin(), it);
- }
-
- uint32_t framesPerPeriod = this->statisticsTickTimes_.size();
- // Why minus 1? No idea, but otherwise the fps rate is always (from 10 to 200!) one frame too low
- this->avgFPS_ = -1 + static_cast<float>(framesPerPeriod) / (currentTime - this->statisticsTickTimes_.front().tickTime) * 1000000.0f;
- this->avgTickTime_ = static_cast<float>(this->periodTickTime_) / framesPerPeriod / 1000.0f;
-
- this->periodTime_ -= this->statisticsRefreshCycle_;
- }
- }
-
- void Game::updateFPSLimiter()
- {
- uint64_t nextTime = gameClock_->getMicroseconds() - excessSleepTime_ + static_cast<uint32_t>(1000000.0f / fpsLimit_);
- uint64_t currentRealTime = gameClock_->getRealMicroseconds();
- while (currentRealTime < nextTime - minimumSleepTime_)
- {
- usleep((unsigned long)(nextTime - currentRealTime));
- currentRealTime = gameClock_->getRealMicroseconds();
- }
- // Integrate excess to avoid steady state error
- excessSleepTime_ = (int)(currentRealTime - nextTime);
- // Anti windup
- if (excessSleepTime_ > 50000) // 20ms is about the maximum time Windows would sleep for too long
- excessSleepTime_ = 50000;
- }
-
void Game::stop()
{
this->bAbort_ = true;
}
-
- void Game::subtractTickTime(int32_t length)
- {
- assert(!this->statisticsTickTimes_.empty());
- this->statisticsTickTimes_.back().tickLength -= length;
- this->periodTickTime_ -= length;
- }
-
-
- /***** GameState related *****/
-
- void Game::requestState(const std::string& name)
- {
- if (!this->checkState(name))
- {
- COUT(2) << "Warning: GameState named '" << name << "' doesn't exist!" << std::endl;
- return;
- }
-
- if (this->bChangingState_)
- {
- COUT(2) << "Warning: Requesting GameStates while loading/unloading a GameState is illegal! Ignoring." << std::endl;
- return;
- }
-
- shared_ptr<GameStateTreeNode> lastRequestedNode;
- if (this->requestedStateNodes_.empty())
- lastRequestedNode = this->loadedTopStateNode_;
- else
- lastRequestedNode = this->requestedStateNodes_.back();
- if (name == lastRequestedNode->name_)
- {
- COUT(2) << "Warning: Requesting the currently active state! Ignoring." << std::endl;
- return;
- }
-
- // Check children first
- std::vector<shared_ptr<GameStateTreeNode> > requestedNodes;
- for (unsigned int i = 0; i < lastRequestedNode->children_.size(); ++i)
- {
- if (lastRequestedNode->children_[i]->name_ == name)
- {
- requestedNodes.push_back(lastRequestedNode->children_[i]);
- break;
- }
- }
-
- if (requestedNodes.empty())
- {
- // Check parent and all its grand parents
- shared_ptr<GameStateTreeNode> currentNode = lastRequestedNode;
- while (currentNode != NULL)
- {
- if (currentNode->name_ == name)
- break;
- currentNode = currentNode->parent_.lock();
- requestedNodes.push_back(currentNode);
- }
- if (currentNode == NULL)
- requestedNodes.clear();
- }
-
- if (requestedNodes.empty())
- COUT(1) << "Error: Requested GameState transition is not allowed. Ignoring." << std::endl;
- else
- this->requestedStateNodes_.insert(requestedStateNodes_.end(), requestedNodes.begin(), requestedNodes.end());
- }
-
- void Game::requestStates(const std::string& names)
- {
- SubString tokens(names, ",;", " ");
- for (unsigned int i = 0; i < tokens.size(); ++i)
- this->requestState(tokens[i]);
- }
-
- void Game::popState()
- {
- shared_ptr<GameStateTreeNode> lastRequestedNode;
- if (this->requestedStateNodes_.empty())
- lastRequestedNode = this->loadedTopStateNode_;
- else
- lastRequestedNode = this->requestedStateNodes_.back();
- if (lastRequestedNode != this->rootStateNode_)
- this->requestState(lastRequestedNode->parent_.lock()->name_);
- else
- COUT(2) << "Warning: Can't pop the internal dummy root GameState" << std::endl;
- }
-
- shared_ptr<GameState> Game::getState(const std::string& name)
- {
- GameStateMap::const_iterator it = constructedStates_.find(name);
- if (it != constructedStates_.end())
- return it->second;
- else
- {
- std::map<std::string, GameStateInfo>::const_iterator it = gameStateDeclarations_s.find(name);
- if (it != gameStateDeclarations_s.end())
- COUT(1) << "Error: GameState '" << name << "' has not yet been loaded." << std::endl;
- else
- COUT(1) << "Error: Could not find GameState '" << name << "'." << std::endl;
- return shared_ptr<GameState>();
- }
- }
-
- void Game::setStateHierarchy(const std::string& str)
- {
- // Split string into pieces of the form whitespacesText
- std::vector<std::pair<std::string, int> > stateStrings;
- size_t pos = 0;
- size_t startPos = 0;
- while (pos < str.size())
- {
- int indentation = 0;
- while (pos < str.size() && str[pos] == ' ')
- ++indentation, ++pos;
- startPos = pos;
- while (pos < str.size() && str[pos] != ' ')
- ++pos;
- stateStrings.push_back(std::make_pair(str.substr(startPos, pos - startPos), indentation));
- }
- if (stateStrings.empty())
- ThrowException(GameState, "Emtpy GameState hierarchy provided, terminating.");
- // Add element with large identation to detect the last with just an iterator
- stateStrings.push_back(std::make_pair("", -1));
-
- // Parse elements recursively
- std::vector<std::pair<std::string, int> >::const_iterator begin = stateStrings.begin();
- parseStates(begin, this->rootStateNode_);
- }
-
- /*** Internal ***/
-
- void Game::parseStates(std::vector<std::pair<std::string, int> >::const_iterator& it, shared_ptr<GameStateTreeNode> currentNode)
- {
- SubString tokens(it->first, ",");
- std::vector<std::pair<std::string, int> >::const_iterator startIt = it;
-
- for (unsigned int i = 0; i < tokens.size(); ++i)
- {
- it = startIt; // Reset iterator to the beginning of the sub tree
- if (!this->checkState(tokens[i]))
- ThrowException(GameState, "GameState with name '" << tokens[i] << "' not found!");
- if (tokens[i] == this->rootStateNode_->name_)
- ThrowException(GameState, "You shouldn't use 'emptyRootGameState' in the hierarchy...");
- shared_ptr<GameStateTreeNode> node(new GameStateTreeNode());
- node->name_ = tokens[i];
- node->parent_ = currentNode;
- currentNode->children_.push_back(node);
-
- int currentLevel = it->second;
- ++it;
- while (it->second != -1)
- {
- if (it->second <= currentLevel)
- break;
- else if (it->second == currentLevel + 1)
- parseStates(it, node);
- else
- ThrowException(GameState, "Indentation error while parsing the hierarchy.");
- }
- }
- }
-
- void Game::loadGraphics()
- {
- if (!GameMode::showsGraphics())
- {
- core_->loadGraphics();
- Loki::ScopeGuard graphicsUnloader = Loki::MakeObjGuard(*this, &Game::unloadGraphics);
-
- // Construct all the GameStates that require graphics
- for (std::map<std::string, GameStateInfo>::const_iterator it = gameStateDeclarations_s.begin();
- it != gameStateDeclarations_s.end(); ++it)
- {
- if (it->second.bGraphicsMode)
- {
- // Game state loading failure is serious --> don't catch
- shared_ptr<GameState> gameState = GameStateFactory::fabricate(it->second);
- if (!constructedStates_.insert(std::make_pair(
- it->second.stateName, gameState)).second)
- assert(false); // GameState was already created!
- }
- }
- graphicsUnloader.Dismiss();
- }
- }
-
- void Game::unloadGraphics()
- {
- if (GameMode::showsGraphics())
- {
- // Destroy all the GameStates that require graphics
- for (GameStateMap::iterator it = constructedStates_.begin(); it != constructedStates_.end();)
- {
- if (it->second->getInfo().bGraphicsMode)
- constructedStates_.erase(it++);
- else
- ++it;
- }
-
- core_->unloadGraphics();
- }
- }
-
- bool Game::checkState(const std::string& name) const
- {
- std::map<std::string, GameStateInfo>::const_iterator it = gameStateDeclarations_s.find(name);
- if (it == gameStateDeclarations_s.end())
- return false;
- else
- return true;
- }
-
- void Game::loadState(const std::string& name)
- {
- this->bChangingState_ = true;
- LOKI_ON_BLOCK_EXIT_OBJ(*this, &Game::resetChangingState);
-
- // If state requires graphics, load it
- Loki::ScopeGuard graphicsUnloader = Loki::MakeObjGuard(*this, &Game::unloadGraphics);
- if (gameStateDeclarations_s[name].bGraphicsMode && !GameMode::showsGraphics())
- this->loadGraphics();
- else
- graphicsUnloader.Dismiss();
-
- shared_ptr<GameState> state = this->getState(name);
- state->activateInternal();
- if (!this->loadedStates_.empty())
- this->loadedStates_.back()->activity_.topState = false;
- this->loadedStates_.push_back(state);
- state->activity_.topState = true;
-
- graphicsUnloader.Dismiss();
- }
-
- void Game::unloadState(const std::string& name)
- {
- this->bChangingState_ = true;
- try
- {
- shared_ptr<GameState> state = this->getState(name);
- state->activity_.topState = false;
- this->loadedStates_.pop_back();
- if (!this->loadedStates_.empty())
- this->loadedStates_.back()->activity_.topState = true;
- state->deactivateInternal();
- }
- catch (...)
- {
- COUT(2) << "Warning: Unloading GameState '" << name << "' threw an exception: " << Exception::handleMessage() << std::endl;
- COUT(2) << " There might be potential resource leaks involved! To avoid this, improve exception-safety." << std::endl;
- }
- // Check if graphics is still required
- if (!bAbort_)
- {
- bool graphicsRequired = false;
- for (unsigned i = 0; i < loadedStates_.size(); ++i)
- graphicsRequired |= loadedStates_[i]->getInfo().bGraphicsMode;
- if (!graphicsRequired)
- this->unloadGraphics();
- }
- this->bChangingState_ = false;
- }
-
- /*static*/ std::map<std::string, shared_ptr<Game::GameStateFactory> >& Game::GameStateFactory::getFactories()
- {
- static std::map<std::string, shared_ptr<GameStateFactory> > factories;
- return factories;
- }
-
- /*static*/ shared_ptr<GameState> Game::GameStateFactory::fabricate(const GameStateInfo& info)
- {
- std::map<std::string, shared_ptr<Game::GameStateFactory> >::const_iterator it = getFactories().find(info.className);
- assert(it != getFactories().end());
- return it->second->fabricateInternal(info);
- }
}
Modified: sandbox_qt/src/libraries/core/Game.h
===================================================================
--- sandbox_qt/src/libraries/core/Game.h 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/src/libraries/core/Game.h 2010-09-11 22:47:30 UTC (rev 7421)
@@ -38,56 +38,21 @@
#include "CorePrereqs.h"
-#include <cassert>
-#include <list>
-#include <map>
#include <string>
-#include <vector>
-#include <boost/shared_ptr.hpp>
-#include <boost/scoped_ptr.hpp>
-#include <boost/preprocessor/cat.hpp>
-#include <loki/ScopeGuard.h>
-
-#include "util/Debug.h"
+#include <QScopedPointer>
#include "util/Singleton.h"
-#include "OrxonoxClass.h"
-/**
- at brief
- Adds a new GameState to the Game. The second parameter is the name as string
- and every following paramter is a constructor argument (which is usually non existent)
-*/
-#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
-
- //! Helper object required before GameStates are being constructed
- struct GameStateInfo
- {
- std::string stateName;
- std::string className;
- bool bIgnoreTickTime;
- bool bGraphicsMode;
- };
-
/**
@brief
Main class responsible for running the game.
@remark
You should only create this singleton once because it owns the Core class! (see remark there)
*/
-// tolua_begin
- class _CoreExport Game
-// tolua_end
- : public Singleton<Game>, public OrxonoxClass
- { // tolua_export
+ class _CoreExport Game : public Singleton<Game>
+ {
friend class Singleton<Game>;
- typedef std::vector<shared_ptr<GameState> > GameStateVector;
- typedef std::map<std::string, shared_ptr<GameState> > GameStateMap;
- typedef shared_ptr<GameStateTreeNode> GameStateTreeNodePtr;
public:
Game(const std::string& cmdLine);
@@ -95,132 +60,17 @@
void setConfigValues();
- void setStateHierarchy(const std::string& str);
- shared_ptr<GameState> getState(const std::string& name);
-
void run();
void stop();
- 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_; }
- float getAvgFPS() { return this->avgFPS_; }
-
- void subtractTickTime(int32_t length);
-
- template <class T>
- static bool declareGameState(const std::string& className, const std::string& stateName, bool bIgnoreTickTime, bool bConsoleMode);
-
private:
- class _CoreExport GameStateFactory
- {
- public:
- virtual ~GameStateFactory() { }
- static shared_ptr<GameState> fabricate(const GameStateInfo& info);
- template <class T>
- static void createFactory(const std::string& className)
- { getFactories()[className].reset(new TemplateGameStateFactory<T>()); }
-
- virtual shared_ptr<GameState> fabricateInternal(const GameStateInfo& info) = 0;
- static std::map<std::string, shared_ptr<GameStateFactory> >& getFactories();
- };
- template <class T>
- class TemplateGameStateFactory : public GameStateFactory
- {
- public:
- shared_ptr<GameState> fabricateInternal(const GameStateInfo& info)
- { return shared_ptr<GameState>(new T(info)); }
- };
- // For the factory destruction
- typedef Loki::ObjScopeGuardImpl0<std::map<std::string, shared_ptr<GameStateFactory> >, void (std::map<std::string, shared_ptr<GameStateFactory> >::*)()> ObjScopeGuard;
-
- struct StatisticsTickInfo
- {
- uint64_t tickTime;
- uint32_t tickLength;
- };
-
Game(Game&); // don't mess with singletons
- void loadGraphics();
- void unloadGraphics();
-
- void parseStates(std::vector<std::pair<std::string, int> >::const_iterator& it, shared_ptr<GameStateTreeNode> currentNode);
- bool checkState(const std::string& name) const;
- void loadState(const std::string& name);
- void unloadState(const std::string& name);
-
- // Main loop structuring
- void updateGameStateStack();
- void updateGameStates();
- void updateStatistics();
- void updateFPSLimiter();
-
- // ScopeGuard helper function
- void resetChangingState() { this->bChangingState_ = false; }
-
- scoped_ptr<Clock> gameClock_;
- scoped_ptr<Core> core_;
- ObjScopeGuard gsFactoryDestroyer_;
-
- GameStateMap constructedStates_;
- GameStateVector loadedStates_;
- GameStateTreeNodePtr rootStateNode_;
- GameStateTreeNodePtr loadedTopStateNode_;
- std::vector<GameStateTreeNodePtr> requestedStateNodes_;
-
- bool bChangingState_;
+ QScopedPointer<Core> core_;
bool bAbort_;
- // variables for time statistics
- uint64_t statisticsStartTime_;
- std::list<StatisticsTickInfo> statisticsTickTimes_;
- uint32_t periodTime_;
- uint32_t periodTickTime_;
- float avgFPS_;
- float avgTickTime_;
- int excessSleepTime_;
- unsigned int minimumSleepTime_;
-
- // config values
- unsigned int statisticsRefreshCycle_;
- unsigned int statisticsAvgLength_;
- unsigned int fpsLimit_;
-
- 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)
- {
- std::map<std::string, GameStateInfo>::const_iterator it = gameStateDeclarations_s.find(stateName);
- if (it == gameStateDeclarations_s.end())
- {
- GameStateInfo& info = gameStateDeclarations_s[stateName];
- info.stateName = stateName;
- info.className = className;
- info.bIgnoreTickTime = bIgnoreTickTime;
- info.bGraphicsMode = bGraphicsMode;
- }
- else
- {
- COUT(0) << "Error: Cannot declare two GameStates with the same name." << std::endl;
- COUT(0) << " Ignoring second one ('" << stateName << "')." << std::endl;
- }
-
- // Create a factory to delay GameState creation
- GameStateFactory::createFactory<T>(className);
-
- // just a required dummy return value
- return true;
- }
-} //tolua_export
-
#endif /* _Game_H__ */
Modified: sandbox_qt/src/libraries/core/PathConfig.cc
===================================================================
--- sandbox_qt/src/libraries/core/PathConfig.cc 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/src/libraries/core/PathConfig.cc 2010-09-11 22:47:30 UTC (rev 7421)
@@ -32,8 +32,6 @@
#include <cstdlib>
#include <cstdio>
#include <vector>
-#include <boost/version.hpp>
-#include <boost/filesystem.hpp>
#ifdef ORXONOX_PLATFORM_WINDOWS
# ifndef WIN32_LEAN_AND_MEAN
@@ -53,34 +51,13 @@
#include "SpecialConfig.h"
#include "util/Debug.h"
#include "util/Exception.h"
-#include "CommandLineParser.h"
-// Boost 1.36 has some issues with deprecated functions that have been omitted
-#if (BOOST_VERSION == 103600)
-# define BOOST_LEAF_FUNCTION filename
-#else
-# define BOOST_LEAF_FUNCTION leaf
-#endif
-
namespace orxonox
{
- namespace bf = boost::filesystem;
-
//! Static pointer to the singleton
PathConfig* PathConfig::singletonPtr_s = 0;
- SetCommandLineArgument(externalDataPath, "").information("Path to the external data files");
- SetCommandLineOnlyArgument(writingPathSuffix, "").information("Additional subfolder for config and log files");
-
PathConfig::PathConfig()
- : rootPath_(*(new bf::path()))
- , executablePath_(*(new bf::path()))
- , modulePath_(*(new bf::path()))
- , dataPath_(*(new bf::path()))
- , externalDataPath_(*(new bf::path()))
- , configPath_(*(new bf::path()))
- , logPath_(*(new bf::path()))
- , bDevRun_(false)
{
//////////////////////////
// FIND EXECUTABLE PATH //
@@ -124,20 +101,15 @@
buffer[ret] = 0;
#endif
- executablePath_ = bf::path(buffer);
+ executablePath_ = QDir(buffer);
#ifndef ORXONOX_PLATFORM_APPLE
- executablePath_ = executablePath_.branch_path(); // remove executable name
+ executablePath_.cdUp(); // remove executable name
#endif
- /////////////////////
- // SET MODULE PATH //
- /////////////////////
-
- if (bf::exists(executablePath_ / "orxonox_dev_build.keep_me"))
+ if (executablePath_.exists("orxonox_dev_build.keep_me"))
{
COUT(1) << "Running from the build tree." << std::endl;
PathConfig::bDevRun_ = true;
- modulePath_ = specialConfig::moduleDevDirectory;
}
else
{
@@ -145,21 +117,17 @@
#ifdef INSTALL_COPYABLE // --> relative paths
// Also set the root path
- bf::path relativeExecutablePath(specialConfig::defaultRuntimePath);
+ QDir relativeExecutablePath(specialConfig::defaultRuntimePath);
rootPath_ = executablePath_;
- while (!bf::equivalent(rootPath_ / relativeExecutablePath, executablePath_) && !rootPath_.empty())
- rootPath_ = rootPath_.branch_path();
- if (rootPath_.empty())
- ThrowException(General, "Could not derive a root directory. Might the binary installation directory contain '..' when taken relative to the installation prefix path?");
+ while (rootPath_ / relativeExecutablePath != executablePath_)
+ {
+ if (!rootPath_.cdUp())
+ ThrowException(General, "Could not derive a root directory. Might the binary installation directory contain '..' when taken relative to the installation prefix path?");
+ }
- // Module path is fixed as well
- modulePath_ = rootPath_ / specialConfig::defaultModulePath;
-
#else
// There is no root path, so don't set it at all
- // Module path is fixed as well
- modulePath_ = specialConfig::moduleInstallDirectory;
#endif
}
@@ -167,13 +135,6 @@
PathConfig::~PathConfig()
{
- delete &rootPath_;
- delete &executablePath_;
- delete &modulePath_;
- delete &dataPath_;
- delete &externalDataPath_;
- delete &configPath_;
- delete &logPath_;
}
void PathConfig::setConfigurablePaths()
@@ -183,12 +144,6 @@
dataPath_ = specialConfig::dataDevDirectory;
configPath_ = specialConfig::configDevDirectory;
logPath_ = specialConfig::logDevDirectory;
-
- // Check for data path override by the command line
- if (!CommandLineParser::getArgument("externalDataPath")->hasDefaultValue())
- externalDataPath_ = CommandLineParser::getValue("externalDataPath").getString();
- else
- externalDataPath_ = specialConfig::externalDataDevDirectory;
}
else
{
@@ -212,7 +167,7 @@
# endif
if (userDataPathPtr == NULL)
ThrowException(General, "Could not retrieve user data path.");
- bf::path userDataPath(userDataPathPtr);
+ QDir userDataPath(userDataPathPtr);
userDataPath /= ".orxonox";
configPath_ = userDataPath / specialConfig::defaultConfigPath;
@@ -222,106 +177,45 @@
}
- // Option to put all the config and log files in a separate folder
- if (!CommandLineParser::getArgument("writingPathSuffix")->hasDefaultValue())
- {
- const std::string& directory(CommandLineParser::getValue("writingPathSuffix").getString());
- configPath_ = configPath_ / directory;
- logPath_ = logPath_ / directory;
- }
-
// Create directories to avoid problems when opening files in non existent folders.
- std::vector<std::pair<bf::path, std::string> > directories;
- directories.push_back(std::make_pair(bf::path(configPath_), "config"));
- directories.push_back(std::make_pair(bf::path(logPath_), "log"));
+ std::vector<std::pair<QDir, std::string> > directories;
+ directories.push_back(std::make_pair(QDir(configPath_), "config"));
+ directories.push_back(std::make_pair(QDir(logPath_), "log"));
- for (std::vector<std::pair<bf::path, std::string> >::iterator it = directories.begin();
+ for (std::vector<std::pair<QDir, std::string> >::iterator it = directories.begin();
it != directories.end(); ++it)
{
- if (bf::exists(it->first) && !bf::is_directory(it->first))
+ if (!it->first.exists())
{
- ThrowException(General, std::string("The ") + it->second + " directory has been preoccupied by a file! \
- Please remove " + it->first.string());
- }
- if (bf::create_directories(it->first)) // function may not return true at all (bug?)
- {
+ if (!it->first.mkpath("."))
+ ThrowException(General, std::string("The ") + it->second + " directory could not be created.");
COUT(4) << "Created " << it->second << " directory" << std::endl;
}
}
}
- std::vector<std::string> PathConfig::getModulePaths()
- {
- std::vector<std::string> modulePaths;
-
- // We search for helper files with the following extension
- const std::string& moduleextension = specialConfig::moduleExtension;
- size_t moduleextensionlength = moduleextension.size();
-
- // Add that path to the PATH variable in case a module depends on another one
- std::string pathVariable(getenv("PATH"));
- putenv(const_cast<char*>(("PATH=" + pathVariable + ';' + modulePath_.string()).c_str()));
-
- // Make sure the path exists, otherwise don't load modules
- if (!boost::filesystem::exists(modulePath_))
- return modulePaths;
-
- boost::filesystem::directory_iterator file(modulePath_);
- boost::filesystem::directory_iterator end;
-
- // Iterate through all files
- while (file != end)
- {
- const std::string& filename = file->BOOST_LEAF_FUNCTION();
-
- // Check if the file ends with the exension in question
- if (filename.size() > moduleextensionlength)
- {
- if (filename.substr(filename.size() - moduleextensionlength) == moduleextension)
- {
- // We've found a helper file
- const std::string& library = filename.substr(0, filename.size() - moduleextensionlength);
- modulePaths.push_back((modulePath_ / library).file_string());
- }
- }
- ++file;
- }
-
- return modulePaths;
- }
-
/*static*/ std::string PathConfig::getRootPathString()
{
- return getInstance().rootPath_.string() + '/';
+ return getInstance().rootPath_.path().toStdString() + '/';
}
/*static*/ std::string PathConfig::getExecutablePathString()
{
- return getInstance().executablePath_.string() + '/';
+ return getInstance().executablePath_.path().toStdString() + '/';
}
/*static*/ std::string PathConfig::getDataPathString()
{
- return getInstance().dataPath_.string() + '/';
+ return getInstance().dataPath_.path().toStdString() + '/';
}
- /*static*/ std::string PathConfig::getExternalDataPathString()
- {
- return getInstance().externalDataPath_.string() + '/';
- }
-
/*static*/ std::string PathConfig::getConfigPathString()
{
- return getInstance().configPath_.string() + '/';
+ return getInstance().configPath_.path().toStdString() + '/';
}
/*static*/ std::string PathConfig::getLogPathString()
{
- return getInstance().logPath_.string() + '/';
+ return getInstance().logPath_.path().toStdString() + '/';
}
-
- /*static*/ std::string PathConfig::getModulePathString()
- {
- return getInstance().modulePath_.string() + '/';
- }
}
Modified: sandbox_qt/src/libraries/core/PathConfig.h
===================================================================
--- sandbox_qt/src/libraries/core/PathConfig.h 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/src/libraries/core/PathConfig.h 2010-09-11 22:47:30 UTC (rev 7421)
@@ -38,34 +38,31 @@
#include <string>
#include <vector>
+#include <QDir>
#include "util/Singleton.h"
-//tolua_begin
namespace orxonox
{
-//tolua_end
/**
@brief
The PathConfig class is a singleton used to configure different paths.
@details
- The class provides information about the data, config, log, executable,
- root and module path.
+ The class provides information about the data, config, log, executable
+ and root path.
It determines those by the use of platform specific functions.
@remarks
Not all paths are always available:
- root only when installed copyable
- - externalData only for development builds in the build tree
*/
- class _CoreExport PathConfig //tolua_export
- : public Singleton<PathConfig>
- { //tolua_export
+ class _CoreExport PathConfig : public Singleton<PathConfig>
+ {
friend class Singleton<PathConfig>;
friend class Core;
public:
/**
@brief
- Retrievs the executable path and sets all hard coded fixed paths (currently only the module path)
+ Retrieves the executable path and sets all hard coded fixed paths (currently only the module path)
Also checks for "orxonox_dev_build.keep_me" in the executable diretory.
If found it means that this is not an installed run, hence we
don't write the logs and config files to ~/.orxonox
@@ -75,27 +72,21 @@
PathConfig();
~PathConfig();
- //! Returns the path to the root folder as boost::filesystem::path
- static const boost::filesystem::path& getRootPath()
+ //! Returns the path to the root folder as QDir
+ static const QDir& getRootPath()
{ return getInstance().rootPath_; }
- //! Returns the path to the executable folder as boost::filesystem::path
- static const boost::filesystem::path& getExecutablePath()
+ //! Returns the path to the executable folder as QDir
+ static const QDir& getExecutablePath()
{ return getInstance().executablePath_; }
- //! Returns the path to the data files as boost::filesystem::path
- static const boost::filesystem::path& getDataPath()
+ //! Returns the path to the data files as QDir
+ static const QDir& getDataPath()
{ return getInstance().dataPath_; }
- //! Returns the path to the external data files as boost::filesystem::path
- static const boost::filesystem::path& getExternalDataPath()
- { return getInstance().externalDataPath_; }
- //! Returns the path to the config files as boost::filesystem::path
- static const boost::filesystem::path& getConfigPath()
+ //! Returns the path to the config files as QDir
+ static const QDir& getConfigPath()
{ return getInstance().configPath_; }
- //! Returns the path to the log files as boost::filesystem::path
- static const boost::filesystem::path& getLogPath()
+ //! Returns the path to the log files as QDir
+ static const QDir& getLogPath()
{ return getInstance().logPath_; }
- //! Returns the path to the modules as boost::filesystem::path
- static const boost::filesystem::path& getModulePath()
- { return getInstance().modulePath_; }
//! Returns the path to the root folder as std::string
static std::string getRootPathString();
@@ -103,14 +94,10 @@
static std::string getExecutablePathString();
//! Returns the path to the data files as std::string
static std::string getDataPathString();
- //! Returns the path to the external data files as std::string
- static std::string getExternalDataPathString();
//! Returns the path to the config files as std::string
static std::string getConfigPathString(); //tolua_export
//! Returns the path to the log files as std::string
static std::string getLogPathString();
- //! Returns the path to the modules as std::string
- static std::string getModulePathString();
//! Return trrue for runs in the build directory (not installed)
static bool isDevelopmentRun() { return getInstance().bDevRun_; }
@@ -125,19 +112,15 @@
GeneralException
*/
void setConfigurablePaths();
- //! Returns a list with all modules declared by a *.module file in the module folder.
- std::vector<std::string> getModulePaths();
//! Path to the parent directory of the ones above if program was installed with relativ paths
- boost::filesystem::path& rootPath_;
- boost::filesystem::path& executablePath_; //!< Path to the executable
- boost::filesystem::path& modulePath_; //!< Path to the modules
- boost::filesystem::path& dataPath_; //!< Path to the data files folder
- boost::filesystem::path& externalDataPath_; //!< Path to the external data files folder
- boost::filesystem::path& configPath_; //!< Path to the config files folder
- boost::filesystem::path& logPath_; //!< Path to the log files folder
+ QDir rootPath_;
+ QDir executablePath_; //!< Path to the executable
+ QDir dataPath_; //!< Path to the data files folder
+ QDir configPath_; //!< Path to the config files folder
+ QDir logPath_; //!< Path to the log files folder
- bool bDevRun_; //!< True for runs in the build directory (not installed)
+ bool bDevRun_; //!< True for runs in the build directory (not installed)
static PathConfig* singletonPtr_s;
}; //tolua_export
} //tolua_export
Modified: sandbox_qt/src/libraries/util/CMakeLists.txt
===================================================================
--- sandbox_qt/src/libraries/util/CMakeLists.txt 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/src/libraries/util/CMakeLists.txt 2010-09-11 22:47:30 UTC (rev 7421)
@@ -18,43 +18,21 @@
#
SET_SOURCE_FILES(UTIL_SRC_FILES
- Clock.cc
Exception.cc
- ExprParser.cc
Math.cc
- MultiType.cc
- Scope.cc
StringUtils.cc
COMPILATION_BEGIN StableCompilation.cc
- Clipboard.cc
Convert.cc
- CRC32.cc
OutputHandler.cc
- ScopedSingletonManager.cc
- SharedPtr.cc
- SignalHandler.cc
Sleep.cc
- SmallObjectAllocator.cc
SubString.cc
COMPILATION_END
)
-IF(GCC_NO_SYSTEM_HEADER_SUPPORT)
- # Get around displaying a few hundred lines of warning code
- SET_SOURCE_FILES_PROPERTIES(MultiType.cc PROPERTIES COMPILE_FLAGS "-w")
-ENDIF()
-IF(MSVC)
- # Simply using #pragma warning(disable:4244) doesn't really disable it
- # if the warning occurs in a template in another file
- # Hence promote it manually to a higher warning level (4)
- SET_SOURCE_FILES_PROPERTIES(MultiType.cc PROPERTIES COMPILE_FLAGS "-w44244")
-ENDIF()
-
ORXONOX_ADD_LIBRARY(util
FIND_HEADER_FILES
LINK_LIBRARIES
- ${CEGUI_LIBRARY}
- ${OGRE_LIBRARY}
+ ${QT_QTCORE_LIBRARY}
SOURCE_FILES
${UTIL_SRC_FILES}
)
Modified: sandbox_qt/src/libraries/util/Exception.cc
===================================================================
--- sandbox_qt/src/libraries/util/Exception.cc 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/src/libraries/util/Exception.cc 2010-09-11 22:47:30 UTC (rev 7421)
@@ -34,7 +34,6 @@
#include "Exception.h"
-#include <CEGUIExceptions.h>
#include "Debug.h"
namespace orxonox
@@ -98,15 +97,6 @@
{
return ex.what();
}
- catch (const CEGUI::Exception& ex)
- {
-#if CEGUI_VERSION_MAJOR == 0 && CEGUI_VERSION_MINOR < 6
- return GeneralException(ex.getMessage().c_str()).getDescription();
-#else
- return GeneralException(ex.getMessage().c_str(), ex.getLine(),
- ex.getFileName().c_str(), ex.getName().c_str()).getDescription();
-#endif
- }
catch (...)
{
COUT(0) << "BIG WARNING: Unknown exception type encountered."
Modified: sandbox_qt/src/libraries/util/Math.cc
===================================================================
--- sandbox_qt/src/libraries/util/Math.cc 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/src/libraries/util/Math.cc 2010-09-11 22:47:30 UTC (rev 7421)
@@ -33,193 +33,9 @@
#include "Math.h"
-#include <OgrePlane.h>
-
-#include "MathConvert.h"
-#include "SubString.h"
-// Do not remove this include, it avoids linker errors.
-#include "mbool.h"
-
namespace orxonox
{
-#if OGRE_VERSION < 0x010603
/**
- @brief Function for writing a Radian to a stream.
- */
- std::ostream& operator<<(std::ostream& out, const orxonox::Radian& radian)
- {
- out << radian.valueRadians();
- return out;
- }
-
- /**
- @brief Function for writing a Degree to a stream.
- */
- std::ostream& operator<<(std::ostream& out, const orxonox::Degree& degree)
- {
- out << degree.valueDegrees();
- return out;
- }
-#endif
-
- /**
- @brief Function for reading a Radian from a stream.
- */
- std::istream& operator>>(std::istream& in, orxonox::Radian& radian)
- {
- float temp;
- in >> temp;
- radian = temp;
- return in;
- }
-
- /**
- @brief Function for reading a Degree from a stream.
- */
- std::istream& operator>>(std::istream& in, orxonox::Degree& degree)
- {
- float temp;
- in >> temp;
- degree = temp;
- return in;
- }
-
-
- /**
- @brief Gets the angle between my viewing direction and the direction to the position of the other object.
- @param myposition My position
- @param mydirection My viewing direction
- @param otherposition The position of the other object
- @return The angle in radian
-
- Examples:
- - If the other object is exactly in front of me, the function returns 0.
- - If the other object is exactly behind me, the function returns pi.
- - If the other object is exactly right/left to me (or above/below), the function returns pi/2.
- */
- float getAngle(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& otherposition)
- {
- orxonox::Vector3 distance = otherposition - myposition;
- float distancelength = distance.length();
- if (distancelength == 0)
- return 0;
- else
- return acos(clamp<float>(mydirection.dotProduct(distance) / distancelength, -1, 1));
- }
-
- /**
- @brief Gets the 2D viewing direction (up/down, left/right) to the position of the other object.
- @param myposition My position
- @param mydirection My viewing direction
- @param myorthonormal My orthonormalvector (pointing upwards through my head)
- @param otherposition The position of the other object
- @return The viewing direction
-
- Examples:
- - If the other object is exactly in front of me, the function returns <tt>Vector2(0, 0)</tt>.
- - If the other object is exactly at my left, the function returns <tt>Vector2(-1, 0)</tt>.
- - If the other object is exactly at my right, the function returns <tt>Vector2(1, 0)</tt>.
- - If the other object is only a bit at my right, the function still returns <tt>Vector2(1, 0)</tt>.
- - If the other object is exactly above me, the function returns <tt>Vector2(0, 1)</tt>.
- */
- orxonox::Vector2 get2DViewdirection(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition)
- {
- orxonox::Vector3 distance = otherposition - myposition;
-
- // project difference vector on our plane
- orxonox::Vector3 projection = Ogre::Plane(mydirection, myposition).projectVector(distance);
-
- float projectionlength = projection.length();
- if (projectionlength == 0)
- {
- if (myposition.dotProduct(otherposition) >= 0)
- return orxonox::Vector2(0, 0);
- else
- return orxonox::Vector2(0, 1);
- }
-
- float cos_value = clamp<float>(myorthonormal.dotProduct(projection) / projectionlength, -1, 1);
- float sin_value = sqrt( 1 - cos_value*cos_value );
-
- if ((mydirection.crossProduct(myorthonormal)).dotProduct(distance) > 0)
- return orxonox::Vector2( sin_value, cos_value );
- else
- return orxonox::Vector2( -sin_value, cos_value );
- }
-
- /**
- @brief Gets the 2D viewing direction (up/down, left/right) to the position of the other object, multiplied with the viewing distance to the object (0° = 0, 180° = 1).
- @param myposition My position
- @param mydirection My viewing direction
- @param myorthonormal My orthonormalvector (pointing upwards through my head)
- @param otherposition The position of the other object
- @return The viewing direction
-
- Examples:
- - If the other object is exactly in front of me, the function returns <tt>Vector2(0, 0)</tt>.
- - If the other object is exactly at my left, the function returns <tt>Vector2(-0.5, 0)</tt>.
- - If the other object is exactly at my right, the function returns <tt>Vector2(0.5, 0)</tt>.
- - If the other object is only a bit at my right, the function still returns <tt>Vector2(0.01, 0)</tt>.
- - If the other object is exactly above me, the function returns <tt>Vector2(0, 0.5)</tt>.
- */
- orxonox::Vector2 get2DViewcoordinates(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition)
- {
- orxonox::Vector3 distance = otherposition - myposition;
-
- // project difference vector on our plane
- orxonox::Vector3 projection = Ogre::Plane(mydirection, myposition).projectVector(distance);
-
- float projectionlength = projection.length();
- if (projectionlength == 0)
- {
- if (myposition.dotProduct(otherposition) >= 0)
- return orxonox::Vector2(0, 0);
- else
- return orxonox::Vector2(0, 1);
- }
- //float angle = acos(clamp<float>(myorthonormal.dotProduct(projection) / projectionlength, -1, 1));
-
- float cos_value = clamp<float>(myorthonormal.dotProduct(projection) / projectionlength, -1, 1);
- float sin_value = sqrt( 1 - cos_value*cos_value );
-
- float distancelength = distance.length();
- if (distancelength == 0) return orxonox::Vector2(0, 0);
- float radius = acos(clamp<float>(mydirection.dotProduct(distance) / distancelength, -1, 1)) / math::pi;
-
- if ((mydirection.crossProduct(myorthonormal)).dotProduct(distance) > 0)
- return orxonox::Vector2( sin_value * radius, cos_value * radius);
- else
- return orxonox::Vector2( -sin_value * radius, cos_value * radius);
- }
-
- /**
- @brief Returns the predicted position I have to aim at, if I want to hit a moving target with a moving projectile.
- @param myposition My position
- @param projectilespeed The speed of my projectile
- @param targetposition The position of my target
- @param targetvelocity The velocity of my target
- @return The predicted position
-
- The function predicts the position based on a linear velocity of the target. If the target changes speed or direction, the projectile will miss.
- */
- orxonox::Vector3 getPredictedPosition(const orxonox::Vector3& myposition, float projectilespeed, const orxonox::Vector3& targetposition, const orxonox::Vector3& targetvelocity)
- {
- float squaredProjectilespeed = projectilespeed * projectilespeed;
- orxonox::Vector3 distance = targetposition - myposition;
- float a = distance.squaredLength();
- float b = 2 * (distance.x + distance.y + distance.z) * (targetvelocity.x + targetvelocity.y + targetvelocity.z);
- float c = targetvelocity.squaredLength();
-
- float temp = 4*squaredProjectilespeed*c + a*a - 4*b*c;
- if (temp < 0)
- return orxonox::Vector3::ZERO;
-
- temp = sqrt(temp);
- float time = (temp + a) / (2 * (squaredProjectilespeed - b));
- return (targetposition + targetvelocity * time);
- }
-
- /**
@brief Returns a unique number. This function will never return the same value twice.
*/
unsigned long getUniqueNumber()
@@ -227,141 +43,4 @@
static unsigned long aNumber = 135;
return aNumber++;
}
-
-
- //////////////////////////
- // Conversion functions //
- //////////////////////////
-
- // std::string to Vector2
- bool ConverterFallback<std::string, orxonox::Vector2>::convert(orxonox::Vector2* output, const std::string& input)
- {
- size_t opening_parenthesis, closing_parenthesis = input.find('}');
- if ((opening_parenthesis = input.find('{')) == std::string::npos)
- opening_parenthesis = 0;
- else
- opening_parenthesis++;
-
- SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis),
- ",", SubString::WhiteSpaces, false, '\\', true, '"', true, '\0', '\0', true, '\0');
- if (tokens.size() >= 2)
- {
- if (!convertValue(&(output->x), tokens[0]))
- return false;
- if (!convertValue(&(output->y), tokens[1]))
- return false;
-
- return true;
- }
- return false;
- }
-
- // std::string to Vector3
- bool ConverterFallback<std::string, orxonox::Vector3>::convert(orxonox::Vector3* output, const std::string& input)
- {
- size_t opening_parenthesis, closing_parenthesis = input.find('}');
- if ((opening_parenthesis = input.find('{')) == std::string::npos)
- opening_parenthesis = 0;
- else
- opening_parenthesis++;
-
- SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis),
- ",", SubString::WhiteSpaces, false, '\\', true, '"', true, '\0', '\0', true, '\0');
- if (tokens.size() >= 3)
- {
- if (!convertValue(&(output->x), tokens[0]))
- return false;
- if (!convertValue(&(output->y), tokens[1]))
- return false;
- if (!convertValue(&(output->z), tokens[2]))
- return false;
-
- return true;
- }
- return false;
- }
-
- // std::string to Vector4
- bool ConverterFallback<std::string, orxonox::Vector4>::convert(orxonox::Vector4* output, const std::string& input)
- {
- size_t opening_parenthesis, closing_parenthesis = input.find('}');
- if ((opening_parenthesis = input.find('{')) == std::string::npos)
- opening_parenthesis = 0;
- else
- opening_parenthesis++;
-
- SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis),
- ",", SubString::WhiteSpaces, false, '\\', true, '"', true, '\0', '\0', true, '\0');
- if (tokens.size() >= 4)
- {
- if (!convertValue(&(output->x), tokens[0]))
- return false;
- if (!convertValue(&(output->y), tokens[1]))
- return false;
- if (!convertValue(&(output->z), tokens[2]))
- return false;
- if (!convertValue(&(output->w), tokens[3]))
- return false;
-
- return true;
- }
- return false;
- }
-
- // std::string to Quaternion
- bool ConverterFallback<std::string, orxonox::Quaternion>::convert(orxonox::Quaternion* output, const std::string& input)
- {
- size_t opening_parenthesis, closing_parenthesis = input.find('}');
- if ((opening_parenthesis = input.find('{')) == std::string::npos)
- opening_parenthesis = 0;
- else
- opening_parenthesis++;
-
- SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis), ",", SubString::WhiteSpaces, false, '\\', true, '"', true, '\0', '\0', true, '\0');
- if (tokens.size() >= 4)
- {
- if (!convertValue(&(output->w), tokens[0]))
- return false;
- if (!convertValue(&(output->x), tokens[1]))
- return false;
- if (!convertValue(&(output->y), tokens[2]))
- return false;
- if (!convertValue(&(output->z), tokens[3]))
- return false;
-
- return true;
- }
- return false;
- }
-
- // std::string to ColourValue
- bool ConverterFallback<std::string, orxonox::ColourValue>::convert(orxonox::ColourValue* output, const std::string& input)
- {
- size_t opening_parenthesis, closing_parenthesis = input.find('}');
- if ((opening_parenthesis = input.find('{')) == std::string::npos)
- opening_parenthesis = 0;
- else
- opening_parenthesis++;
-
- SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis), ",", SubString::WhiteSpaces, false, '\\', true, '"', true, '\0', '\0', true, '\0');
- if (tokens.size() >= 3)
- {
- if (!convertValue(&(output->r), tokens[0]))
- return false;
- if (!convertValue(&(output->g), tokens[1]))
- return false;
- if (!convertValue(&(output->b), tokens[2]))
- return false;
- if (tokens.size() >= 4)
- {
- if (!convertValue(&(output->a), tokens[3]))
- return false;
- }
- else
- output->a = 1.0;
-
- return true;
- }
- return false;
- }
}
Modified: sandbox_qt/src/libraries/util/Math.h
===================================================================
--- sandbox_qt/src/libraries/util/Math.h 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/src/libraries/util/Math.h 2010-09-11 22:47:30 UTC (rev 7421)
@@ -34,7 +34,7 @@
/**
@file
@ingroup Math
- @brief Declaration and implementation of several math-functions, typedefs of some Ogre::Math classes to the orxonox namespace.
+ @brief Declaration and implementation of several math-functions.
*/
#ifndef _Util_Math_H__
@@ -45,13 +45,6 @@
#include <string>
#include <cmath>
-#include <OgreMath.h>
-#include <OgreVector2.h>
-#include <OgreVector3.h>
-#include <OgreVector4.h>
-#include <OgreQuaternion.h>
-#include <OgreColourValue.h>
-
// Certain headers might define unwanted macros...
#undef max
#undef min
@@ -82,18 +75,6 @@
const double sqrt2_2_d = 7.07106781186547524e-1; ///< sqrt(2) / 2 (double)
}
-#if OGRE_VERSION < 0x010603
- _UtilExport std::ostream& operator<<(std::ostream& out, const orxonox::Radian& radian);
- _UtilExport std::ostream& operator<<(std::ostream& out, const orxonox::Degree& degree);
-#endif
- _UtilExport std::istream& operator>>(std::istream& in, orxonox::Radian& radian);
- _UtilExport std::istream& operator>>(std::istream& in, orxonox::Degree& degree);
-
- _UtilExport float getAngle(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& otherposition);
- _UtilExport orxonox::Vector2 get2DViewdirection(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition);
- _UtilExport orxonox::Vector2 get2DViewcoordinates(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition);
- _UtilExport orxonox::Vector3 getPredictedPosition(const orxonox::Vector3& myposition, float projectilespeed, const orxonox::Vector3& targetposition, const orxonox::Vector3& targetvelocity);
-
/**
@brief Returns the sign of the given value.
@param x The value
@@ -178,63 +159,6 @@
}
/**
- @brief Returns a "zero" value for the given type.
- @note This is the default template of the zeroise() function. The template is spezialized for each supported type.
-
- The exact return value of the function depends on the type. For @c int this is 0,
- for @c float it's 0.0f. For a @c std::string the function returns "" and for
- @c Vector3 you get <tt>Vector3(0, 0, 0)</tt>.
- */
- template <typename T>
- inline T zeroise()
- {
- // Default, raise a compiler error without including large boost header cascade.
- T temp();
- *********temp; // If you reach this code, you abused zeroise()!
- return temp;
- }
-
- template <> inline char zeroise<char>() { return 0; }
- template <> inline unsigned char zeroise<unsigned char>() { return 0; }
- template <> inline short zeroise<short>() { return 0; }
- template <> inline unsigned short zeroise<unsigned short>() { return 0; }
- template <> inline int zeroise<int>() { return 0; }
- template <> inline unsigned int zeroise<unsigned int>() { return 0; }
- template <> inline long zeroise<long>() { return 0; }
- template <> inline unsigned long zeroise<unsigned long>() { return 0; }
- template <> inline long long zeroise<long long>() { return 0; }
- template <> inline unsigned long long zeroise<unsigned long long>() { return 0; }
- template <> inline float zeroise<float>() { return 0; }
- template <> inline double zeroise<double>() { return 0; }
- template <> inline long double zeroise<long double>() { return 0; }
- template <> inline bool zeroise<bool>() { return 0; }
- template <> inline void* zeroise<void*>() { return 0; }
- template <> inline std::string zeroise<std::string>() { return std::string(); }
- template <> inline orxonox::Radian zeroise<orxonox::Radian>() { return orxonox::Radian(0.0f); }
- template <> inline orxonox::Degree zeroise<orxonox::Degree>() { return orxonox::Degree(0.0f); }
- template <> inline orxonox::Vector2 zeroise<orxonox::Vector2>() { return orxonox::Vector2 (0, 0) ; }
- template <> inline orxonox::Vector3 zeroise<orxonox::Vector3>() { return orxonox::Vector3 (0, 0, 0) ; }
- template <> inline orxonox::Vector4 zeroise<orxonox::Vector4>() { return orxonox::Vector4 (0, 0, 0, 0); }
- template <> inline orxonox::ColourValue zeroise<orxonox::ColourValue>() { return orxonox::ColourValue(0, 0, 0, 0); }
- template <> inline orxonox::Quaternion zeroise<orxonox::Quaternion>() { return orxonox::Quaternion (0, 0, 0, 0); }
-
- /**
- @brief Provides zero value symbols that can be returned as reference
- @see zeroise()
- */
- template <typename T>
- struct NilValue
- {
- inline operator const T&() const
- {
- return value;
- }
- static T value;
- };
- template <typename T>
- T NilValue<T>::value = zeroise<T>();
-
- /**
@brief Interpolates between two values for a time between 0 and 1.
@param time The time is a value between 0 and 1 - the function returns @a start if @a time is 0, @a end if @a time is 1, and interpolates if @a time is between 0 and 1.
@param start The value at @a time = 0
@@ -296,31 +220,6 @@
}
_UtilExport unsigned long getUniqueNumber();
-
- /**
- @brief A Vector class containing two integers @a x and @a y.
- */
- class IntVector2
- {
- public:
- IntVector2() : x(0), y(0) { }
- IntVector2(int _x, int _y) : x(_x), y(_y) { }
- int x;
- int y;
- };
-
- /**
- @brief A Vector class containing three integers @a x, @a y, and @a z.
- */
- class IntVector3
- {
- public:
- IntVector3() : x(0), y(0), z(0) { }
- IntVector3(int _x, int _y, int _z) : x(_x), y(_y), z(_z) { }
- int x;
- int y;
- int z;
- };
}
#endif /* _Util_Math_H__ */
Modified: sandbox_qt/src/libraries/util/Singleton.h
===================================================================
--- sandbox_qt/src/libraries/util/Singleton.h 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/src/libraries/util/Singleton.h 2010-09-11 22:47:30 UTC (rev 7421)
@@ -144,13 +144,13 @@
}
//! Update method called by ClassSingletonManager (if used)
- void preUpdateSingleton(const Clock& time) { static_cast<T*>(T::singletonPtr_s)->preUpdate(time); }
+ void preUpdateSingleton() { static_cast<T*>(T::singletonPtr_s)->preUpdate(); }
//! Empty update method for the static polymorphism
- void preUpdate(const Clock& time) { }
+ void preUpdate() { }
//! Update method called by ClassSingletonManager (if used)
- void postUpdateSingleton(const Clock& time) { static_cast<T*>(T::singletonPtr_s)->postUpdate(time); }
+ void postUpdateSingleton() { static_cast<T*>(T::singletonPtr_s)->postUpdate(); }
//! Empty update method for the static polymorphism
- void postUpdate(const Clock& time) { }
+ void postUpdate() { }
protected:
//! Constructor sets the singleton instance pointer
Modified: sandbox_qt/src/libraries/util/StringUtils.cc
===================================================================
--- sandbox_qt/src/libraries/util/StringUtils.cc 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/src/libraries/util/StringUtils.cc 2010-09-11 22:47:30 UTC (rev 7421)
@@ -34,7 +34,9 @@
#include "StringUtils.h"
#include <cctype>
-#include <boost/scoped_array.hpp>
+#include <QVarLengthArray>
+#include <QDir>
+
#include "Convert.h"
#include "Math.h"
@@ -492,7 +494,7 @@
{
size_t cols = str1.size() + 1;
size_t rows = str2.size() + 1;
- boost::scoped_array<int> matrix(new int[rows * cols]);
+ QVarLengthArray<int> matrix(rows * cols);
for (size_t r = 0; r < rows; ++r)
for (size_t c = 0; c < cols; ++c)
@@ -515,4 +517,25 @@
return matrix[(rows-1)*cols + cols-1];
}
+
+ QDir& operator/=(QDir& lhs, const QDir& rhs)
+ {
+ lhs.setPath(lhs.path() + QDir::separator() + rhs.path());
+ return lhs;
+ }
+
+ QDir& operator/=(QDir& lhs, const QString& rhs)
+ {
+ return operator/=(lhs, QDir(rhs));
+ }
+
+ QDir operator/(const QDir& lhs, const QDir& rhs)
+ {
+ return (QDir(lhs) /= rhs);
+ }
+
+ QDir operator/(const QDir& lhs, const QString& rhs)
+ {
+ return operator/(lhs, QDir(rhs));
+ }
}
Modified: sandbox_qt/src/libraries/util/UtilPrereqs.h
===================================================================
--- sandbox_qt/src/libraries/util/UtilPrereqs.h 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/src/libraries/util/UtilPrereqs.h 2010-09-11 22:47:30 UTC (rev 7421)
@@ -58,83 +58,44 @@
#endif
//-----------------------------------------------------------------------
-// Enums
-//-----------------------------------------------------------------------
-
-namespace orxonox
-{
- namespace ScopeID
- {
- //!A list of available scopes for the Scope template.
- enum Value
- {
- Root,
- Graphics
- };
- }
-}
-
-//-----------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------
namespace orxonox
{
- class Clock;
class Exception;
- class ExprParser;
- class IntVector2;
- class IntVector3;
- class MultiType;
class OutputHandler;
class OutputListener;
- template <ScopeID::Value>
- class Scope;
- template <class, ScopeID::Value>
- class ScopedSingleton;
- class ScopeListener;
- class SignalHandler;
template <class T>
class Singleton;
class SubString;
}
-namespace Ogre
-{
- class Radian;
- class Degree;
- class Vector2;
- class Vector3;
- class Vector4;
- class Matrix3;
- class Matrix4;
- class Quaternion;
- class ColourValue;
-}
-namespace orxonox
-{
- using Ogre::Radian;
- using Ogre::Degree;
- using Ogre::Vector2;
- using Ogre::Vector3;
- using Ogre::Vector4;
- using Ogre::Matrix3;
- using Ogre::Matrix4;
- using Ogre::Quaternion;
- using Ogre::ColourValue;
-}
-
namespace Loki
{
class ScopeGuardImplBase;
typedef const ScopeGuardImplBase& ScopeGuard;
}
+class QDir;
+class QString;
+
// Just so you don't have to include StringUtils.h everywhere just for this
namespace orxonox
{
extern _UtilExport std::string BLANKSTRING;
}
+//-----------------------------------------------------------------------
+// Functions (implementations in StringUtils.cc)
+//-----------------------------------------------------------------------
+namespace orxonox
+{
+ _UtilExport QDir& operator/=(QDir& lhs, const QDir& rhs);
+ _UtilExport QDir& operator/=(QDir& lhs, const QString& rhs);
+ _UtilExport QDir operator/(const QDir& lhs, const QDir& rhs);
+ _UtilExport QDir operator/(const QDir& lhs, const QString& rhs);
+}
+
#endif /* _UtilPrereqs_H__ */
Modified: sandbox_qt/src/orxonox/CMakeLists.txt
===================================================================
--- sandbox_qt/src/orxonox/CMakeLists.txt 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/src/orxonox/CMakeLists.txt 2010-09-11 22:47:30 UTC (rev 7421)
@@ -23,65 +23,16 @@
)
SET_SOURCE_FILES(ORXONOX_SRC_FILES
- Level.cc
- LevelManager.cc
Main.cc
- MoodManager.cc
- PawnManager.cc
- PlayerManager.cc
- Radar.cc
- ChatHistory.cc
- ChatInputHandler.cc
-# Test.cc
-COMPILATION_BEGIN SceneCompilation.cc
- CameraManager.cc
- Scene.cc
-COMPILATION_END
)
-ADD_SUBDIRECTORY(collisionshapes)
-ADD_SUBDIRECTORY(controllers)
-ADD_SUBDIRECTORY(gamestates)
-ADD_SUBDIRECTORY(gametypes)
-ADD_SUBDIRECTORY(graphics)
-ADD_SUBDIRECTORY(infos)
-ADD_SUBDIRECTORY(interfaces)
-ADD_SUBDIRECTORY(items)
-ADD_SUBDIRECTORY(overlays)
-ADD_SUBDIRECTORY(pickup)
-ADD_SUBDIRECTORY(sound)
-ADD_SUBDIRECTORY(weaponsystem)
-ADD_SUBDIRECTORY(worldentities)
+#ADD_SUBDIRECTORY(subdir)
ORXONOX_ADD_LIBRARY(orxonox
FIND_HEADER_FILES
- TOLUA_FILES
- ChatInputHandler.h
- LevelManager.h
- MoodManager.h
- controllers/HumanController.h
- interfaces/Pickupable.h
- infos/PlayerInfo.h
- sound/SoundManager.h
- PCH_FILE
- OrxonoxPrecompiledHeaders.h
LINK_LIBRARIES
- ${Boost_FILESYSTEM_LIBRARY}
- ${Boost_SYSTEM_LIBRARY} # Filesystem dependency
- ${Boost_THREAD_LIBRARY}
- ${Boost_DATE_TIME_LIBRARY} # Thread dependency
- ${OGRE_LIBRARY}
- ${OPENAL_LIBRARY}
- ${ALUT_LIBRARY}
- ${VORBISFILE_LIBRARY}
- ${VORBIS_LIBRARY}
- ${OGG_LIBRARY}
- tinyxml_orxonox
- tolua_orxonox
- bullet_orxonox
+ ${QT_QTCORE_LIBRARY}
util
core
- network
- tools
SOURCE_FILES ${ORXONOX_SRC_FILES}
)
Modified: sandbox_qt/src/orxonox/Main.cc
===================================================================
--- sandbox_qt/src/orxonox/Main.cc 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/src/orxonox/Main.cc 2010-09-11 22:47:30 UTC (rev 7421)
@@ -35,28 +35,11 @@
#include "OrxonoxPrereqs.h"
-#include "core/CommandLineParser.h"
#include "core/Game.h"
-#include "core/LuaState.h"
-#include "ToluaBindOrxonox.h"
-#include "ToluaBindNetwork.h"
#include "Main.h"
-DeclareToluaInterface(Orxonox);
-DeclareToluaInterface(Network);
-
namespace orxonox
{
- SetCommandLineSwitch(console).information("Start in console mode (text IO only)");
- SetCommandLineSwitch(server).information("Start in server mode");
- SetCommandLineSwitch(client).information("Start in client mode");
- SetCommandLineSwitch(dedicated).information("Start in dedicated server mode");
- SetCommandLineSwitch(standalone).information("Start in standalone mode");
- SetCommandLineSwitch(dedicatedClient).information("Start in dedicated client mode");
-
- SetCommandLineArgument(generateDoc, "")
- .information("Generates a Doxygen file from things like SetConsoleCommand");
-
/**
@brief
Starting point of orxonox (however not the entry point of the program!)
@@ -65,40 +48,9 @@
{
Game* game = new Game(strCmdLine);
- if (CommandLineParser::getValue("generateDoc").getString().empty())
- {
- game->setStateHierarchy(
- "root"
- " graphics"
- " mainMenu"
- " standalone,server,client"
- " level"
- " server,client"
- " level"
- );
+ //if (CommandLineParser::getValue("generateDoc").getString().empty())
+ // game->run();
- game->requestState("root");
-
- // Some development hacks (not really, but in the future, these calls won't make sense anymore)
- if (CommandLineParser::getValue("standalone").getBool())
- Game::getInstance().requestStates("graphics, standalone, level");
- else if (CommandLineParser::getValue("server").getBool())
- Game::getInstance().requestStates("graphics, server, level");
- else if (CommandLineParser::getValue("client").getBool())
- Game::getInstance().requestStates("graphics, client, level");
- else if (CommandLineParser::getValue("dedicated").getBool())
- Game::getInstance().requestStates("server, level");
- else if (CommandLineParser::getValue("dedicatedClient").getBool())
- Game::getInstance().requestStates("client, level");
- else
- {
- if (!CommandLineParser::getValue("console").getBool())
- Game::getInstance().requestStates("graphics, mainMenu");
- }
-
- game->run();
- }
-
delete game;
return 0;
Modified: sandbox_qt/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- sandbox_qt/src/orxonox/OrxonoxPrereqs.h 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/src/orxonox/OrxonoxPrereqs.h 2010-09-11 22:47:30 UTC (rev 7421)
@@ -36,7 +36,6 @@
#define _OrxonoxPrereqs_H__
#include "OrxonoxConfig.h"
-#include "tools/ToolsPrereqs.h"
//-----------------------------------------------------------------------
// Shared library settings
@@ -64,147 +63,6 @@
namespace orxonox
{
- class CameraManager;
- class Level;
- class LevelManager;
- class PawnManager;
- class PlayerManager;
- class Radar;
- class Scene;
-
- // collisionshapes
- class CollisionShape;
- class CompoundCollisionShape;
- class WorldEntityCollisionShape;
-
- // controllers
- class AIController;
- class ArtificialController;
- class Controller;
- class DroneController;
- class HumanController;
- class ScriptController;
- class WaypointController;
- class WaypointPatrolController;
-
- // gametypes
- class Asteroids;
- class Deathmatch;
- class Dynamicmatch;
- class Gametype;
- class TeamBaseMatch;
- class TeamDeathmatch;
- class UnderAttack;
-
- // graphics
- class Backlight;
- class Billboard;
- class BlinkingBillboard;
- class Camera;
- class FadingBillboard;
- class GlobalShader;
- class Light;
- class Model;
- class ParticleEmitter;
- class ParticleSpawner;
-
- // infos
- class Bot;
- class GametypeInfo;
- class HumanPlayer;
- class Info;
- class PlayerInfo;
-
- // interfaces
- class GametypeMessageListener;
- class NotificationListener;
- class Pickupable;
- class PickupCarrier;
- class PlayerTrigger;
- class RadarListener;
- class RadarViewable;
- class Rewardable;
- class TeamColourable;
-
- // items
- class Engine;
- class Item;
- class MultiStateEngine;
-
- // overlays
- class InGameConsole;
- class Map;
- class OrxonoxOverlay;
- class OverlayGroup;
-
- // pickup
- class PickupIdentifier;
-
- //sound
- class AmbientSound;
- class BaseSound;
- class SoundBuffer;
- class SoundManager;
- class SoundStreamer;
- class WorldSound;
-
- // weaponsystem
- class DefaultWeaponmodeLink;
- class Munition;
- class Weapon;
- class WeaponMode;
- class WeaponPack;
- class WeaponSet;
- class WeaponSlot;
- class WeaponSystem;
-
- // worldentities
- class BigExplosion;
- class CameraPosition;
- class ControllableEntity;
- class Drone;
- class EffectContainer;
- class ExplosionChunk;
- class MobileEntity;
- class MovableEntity;
- class SpawnPoint;
- class StaticEntity;
- class TeamSpawnPoint;
- class WorldEntity;
- class Rocket;
- // worldentities, pawns
- class Destroyer;
- class Pawn;
- class SpaceShip;
- class Spectator;
- class TeamBaseMatchBase;
}
-// Bullet Physics Engine
-class btTransform;
-class btVector3;
-
-class btRigidBody;
-class btCollisionObject;
-class btGhostObject;
-class btManifoldPoint;
-
-class btCollisionShape;
-class btSphereShape;
-class btCompoundShape;
-class btStaticPlaneShape;
-
-class btDiscreteDynamicsWorld;
-class bt32BitAxisSweep3;
-class btDefaultCollisionConfiguration;
-class btCollisionDispatcher;
-class btSequentialImpulseConstraintSolver;
-
-// ALUT
-typedef struct ALCcontext_struct ALCcontext;
-typedef struct ALCdevice_struct ALCdevice;
-typedef unsigned int ALuint;
-typedef int ALint;
-typedef int ALenum;
-
#endif /* _OrxonoxPrereqs_H__ */
Modified: sandbox_qt/src/orxonox-main.vcproj.user.in
===================================================================
--- sandbox_qt/src/orxonox-main.vcproj.user.in 2010-09-11 22:07:23 UTC (rev 7420)
+++ sandbox_qt/src/orxonox-main.vcproj.user.in 2010-09-11 22:47:30 UTC (rev 7421)
@@ -10,7 +10,7 @@
>
<DebugSettings
WorkingDirectory="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(OutDir)"
- Environment="Path=${RUNTIME_LIBRARY_DIRECTORY}"
+ Environment="PATH=${RUNTIME_LIBRARY_DIRECTORY};%PATH%"
EnvironmentMerge="true"
/>
</Configuration>
@@ -19,7 +19,7 @@
>
<DebugSettings
WorkingDirectory="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(OutDir)"
- Environment="Path=${RUNTIME_LIBRARY_DIRECTORY}"
+ Environment="PATH=${RUNTIME_LIBRARY_DIRECTORY};%PATH%"
EnvironmentMerge="true"
/>
</Configuration>
@@ -28,7 +28,7 @@
>
<DebugSettings
WorkingDirectory="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(OutDir)"
- Environment="Path=${RUNTIME_LIBRARY_DIRECTORY}"
+ Environment="PATH=${RUNTIME_LIBRARY_DIRECTORY};%PATH%"
EnvironmentMerge="true"
/>
</Configuration>
@@ -37,7 +37,7 @@
>
<DebugSettings
WorkingDirectory="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(OutDir)"
- Environment="Path=${RUNTIME_LIBRARY_DIRECTORY}"
+ Environment="PATH=${RUNTIME_LIBRARY_DIRECTORY};%PATH%"
EnvironmentMerge="true"
/>
</Configuration>
More information about the Orxonox-commit
mailing list