Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1652 for code/branches/gui


Ignore:
Timestamp:
Jul 28, 2008, 8:45:31 PM (16 years ago)
Author:
rgrieder
Message:
  • clean up in OrxonoxPlatform.h
  • that's it
Location:
code/branches/gui
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gui/src/core/Exception.h

    r1645 r1652  
    5353            FileNotFound,
    5454            PluginsNotFound,
     55            InitialisationFailed,
    5556            NotImplemented
    5657        };
     
    114115            case Exception::PluginsNotFound:
    115116                return "PluginsNotFound";
     117            case Exception::InitialisationFailed:
     118                return "InitialisationFailed";
    116119            case Exception::NotImplemented:
    117120                return "NotImplemented";
     
    125128    typedef SpecificException<Exception::FileNotFound> FileNotFoundException;
    126129    typedef SpecificException<Exception::PluginsNotFound> PluginsNotFoundException;
     130    typedef SpecificException<Exception::InitialisationFailed> InitialisationFailedException;
    127131    typedef SpecificException<Exception::NotImplemented> NotImplementedException;
    128132
  • code/branches/gui/src/network/PacketManager.h

    r1505 r1652  
    3535#include <enet/enet.h>
    3636
     37#include "util/Integers.h"
    3738#include "core/CoreIncludes.h"
    3839
  • code/branches/gui/src/orxonox/GraphicsEngine.cc

    r1651 r1652  
    267267    }
    268268
    269     bool GraphicsEngine::loadRenderer()
     269    void GraphicsEngine::loadRenderer()
    270270    {
    271271        CCOUT(4) << "Configuring Renderer" << std::endl;
     
    286286        if (!root_->restoreConfig())
    287287            if (!root_->showConfigDialog())
    288                 return false;
     288                ThrowException(InitialisationFailed, "Could not show Ogre configuration dialogue.");
    289289
    290290        CCOUT(4) << "Creating render window" << std::endl;
    291         try
    292         {
    293             this->renderWindow_ = root_->initialise(true, "OrxonoxV2");
    294         }
    295         catch (std::exception& ex)
    296         {
    297             COUT(2) << "Error: There was an exception when initialising Ogre Root." << std::endl;
    298                         COUT(1) << ex.what() << std::endl;
    299             return false;
    300         }
    301 
    302         if (!root_->isInitialised())
    303         {
    304             CCOUT(2) << "Error: Initialising Ogre root object failed." << std::endl;
    305             return false;
    306         }
     291
     292        this->renderWindow_ = root_->initialise(true, "OrxonoxV2");
     293
    307294        Ogre::WindowEventUtilities::addWindowEventListener(this->renderWindow_, this);
     295
    308296        //Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);
    309297
    310         // create a full screen viewport
     298        // create a full screen default viewport
    311299        this->viewport_ = this->renderWindow_->addViewport(0, 0);
    312 
    313         return true;
    314300    }
    315301
  • code/branches/gui/src/orxonox/GraphicsEngine.h

    r1641 r1652  
    4747#include "core/OrxonoxClass.h"
    4848
    49 
    5049namespace orxonox
    5150{
     
    6261        void setup();
    6362        void declareRessourceLocations();
    64         bool loadRenderer();
     63        void loadRenderer();
    6564        bool initialiseResources();
    6665        bool createNewScene();
  • code/branches/gui/src/util/ArgReader.cc

    r1638 r1652  
    3535#include "ArgReader.h"
    3636#include "SubString.h"
     37
    3738
    3839std::string ArgReader::parse(int argc, char **argv)
  • code/branches/gui/src/util/OrxonoxPlatform.h

    r1638 r1652  
    2525 *      Reto Grieder
    2626 *
     27 *   Original code: OgrePlatform.h, licensed under the LGPL. The code
     28 *   has changed quite a bit however.
     29 *
    2730 */
    2831
    2932/**
    3033 @file
    31  @brief Various constants for compiler, architecture and platform. It's a mere
    32         copy of the file found in the Ogre source code (OgrePlatform.h).
     34 @brief
     35    Various constants for compiler, architecture and platform.
    3336 */
    3437
     
    3639#define _OrxonoxPlatform_H__
    3740
    38 /* Initial platform/compiler-related stuff to set.
    39 */
     41/* Initial platform/compiler-related stuff to set. */
     42
    4043#define ORXONOX_PLATFORM_WIN32 1
    4144#define ORXONOX_PLATFORM_LINUX 2
     
    5255#define ORXONOX_ARCHITECTURE_64 2
    5356
    54 /* Finds the compiler type and version.
    55 */
     57
     58/* Finds the compiler type and version. */
     59
    5660#if defined( _MSC_VER )
    5761#  define ORXONOX_COMPILER ORXONOX_COMPILER_MSVC
     
    7377#endif
    7478
     79
    7580/* See if we can use __forceinline or if we need to use __inline instead */
    7681#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
     
    8792
    8893/* Finds the current platform */
    89 
    9094#if defined( __WIN32__ ) || defined( _WIN32 )
    9195#  define ORXONOX_PLATFORM ORXONOX_PLATFORM_WIN32
    92 
    9396#elif defined( __APPLE_CC__)
    9497#  define ORXONOX_PLATFORM ORXONOX_PLATFORM_APPLE
    95 
    9698#else
    9799#  define ORXONOX_PLATFORM ORXONOX_PLATFORM_LINUX
    98100#endif
    99101
    100     /* Find the arch type */
     102/* Find the arch type */
    101103#if defined(__x86_64__) || defined(_M_X64) || defined(__powerpc64__) || defined(__alpha__) || defined(__ia64__) || defined(__s390__) || defined(__s390x__)
    102104#  define ORXONOX_ARCH_TYPE ORXONOX_ARCHITECTURE_64
     
    105107#endif
    106108
    107 // try to define function information
     109/* Try to define function information */
    108110#ifndef __FUNCTIONNAME__
    109111#  if ORXONOX_COMPILER == ORXONOX_COMPILER_BORL
     
    118120#endif
    119121
    120 // For generating compiler warnings - should work on any compiler
    121 // As a side note, if you start your message with 'Warning: ', the MSVC
    122 // IDE actually does catch a warning :)
    123 // FIXME: Try this on linux box. Doesn't work with msvc
    124 //#define ORXONOX_QUOTE_INPLACE(x) # x
    125 //#define ORXONOX_QUOTE(x) ORXONOX_QUOTE_INPLACE(x)
    126 //#define ORXONOX_WARN( x )  message( __FILE__ "(" QUOTE( __LINE__ ) ") : " x "\n" )
    127 
    128 //----------------------------------------------------------------------------
    129 // Windows Settings
     122/* Determine whether we're building in debug mode */
     123#if defined(_DEBUG) || defined(DEBUG)
     124#  define ORXONOX_DEBUG_MODE 1
     125#else
     126#  define ORXONOX_DEBUG_MODE 0
     127#endif
     128
     129/* Define configurable floating point type */
     130namespace orxonox
     131{
     132#ifdef ORXONOX_DOUBLE_PRECISION
     133    typedef double Real;
     134#else
     135    typedef float  Real;
     136#endif
     137}
     138
     139
     140
     141/*---------------------------------
     142 * Windows Settings
     143 *-------------------------------*/
    130144#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32
    131 
    132 // Win32 compilers use _DEBUG for specifying debug builds.
    133 #  ifdef _DEBUG
    134 #    define ORXONOX_DEBUG_MODE 1
    135 #  else
    136 #    define ORXONOX_DEBUG_MODE 0
    137 #  endif
    138 
    139 // Disable unicode support on MingW at the moment, poorly supported in stdlibc++
    140 // STLPORT fixes this though so allow if found
    141 // MinGW C++ Toolkit supports unicode and sets the define __MINGW32_TOOLKIT_UNICODE__ in _mingw.h
     145/* Disable unicode support on MingW at the moment, poorly supported in stdlibc++
     146 * STLPORT fixes this though so allow if found
     147 * MinGW C++ Toolkit supports unicode and sets the define __MINGW32_TOOLKIT_UNICODE__ in _mingw.h */
    142148#  if defined( __MINGW32__ ) && !defined(_STLPORT_VERSION)
    143149#    include<_mingw.h>
     
    150156#    define ORXONOX_UNICODE_SUPPORT 1
    151157#  endif
    152 
    153158#endif /* Platform Win32 */
    154 //----------------------------------------------------------------------------
    155 
    156 //----------------------------------------------------------------------------
    157 // Linux/Apple Settings
     159
     160
     161/*---------------------------------
     162 * Linux/Apple Settings
     163 *-------------------------------*/
    158164#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_LINUX || ORXONOX_PLATFORM == ORXONOX_PLATFORM_APPLE
    159165
    160 
    161 // A quick define to overcome different names for the same function
     166/* A quick define to overcome different names for the same function */
    162167#  define stricmp strcasecmp
    163168
    164 // Unlike the Win32 compilers, Linux compilers seem to use DEBUG for when
    165 // specifying a debug build.
    166 // (??? this is wrong, on Linux debug builds aren't marked in any way unless
    167 // you mark it yourself any way you like it -- zap ???)
    168 #  ifdef DEBUG
    169 #    define ORXONOX_DEBUG_MODE 1
    170 #  else
    171 #    define ORXONOX_DEBUG_MODE 0
    172 #  endif
    173 
    174 /* FIXME: Check what this actually is and whether we need it or not
     169/* TODO: Check what this actually is and whether we need it or not */
     170#if 0
    175171#  if ORXONOX_PLATFORM == ORXONOX_PLATFORM_APPLE
    176172#    define ORXONOX_PLATFORM_LIB "OrxonoxPlatform.bundle"
    177173#  else
    178 // ORXONOX_PLATFORM_LINUX
     174/* ORXONOX_PLATFORM_LINUX */
    179175#    define ORXONOX_PLATFORM_LIB "libOrxonoxPlatform.so"
    180176#  endif
    181 */
    182 
    183 // Always enable unicode support for the moment
    184 // Perhaps disable in old versions of gcc if necessary
     177#endif
     178
     179/* Always enable unicode support for the moment
     180 * Perhaps disable in old versions of gcc if necessary */
    185181#  define ORXONOX_UNICODE_SUPPORT 1
    186182
    187183#endif /* Patform Linux/Apple */
    188184
    189 //For apple, we always have a custom config.h file
     185
     186/*---------------------------------
     187 * Apple Settings
     188 *-------------------------------*/
     189/* For apple, we always have a custom config.h file */
    190190#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_APPLE
    191191#  include "config.h"
    192192#endif
    193193
    194 //----------------------------------------------------------------------------
    195 
    196 //----------------------------------------------------------------------------
    197 // Endian Settings
    198 // check for BIG_ENDIAN config flag, set ORXONOX_ENDIAN correctly
    199 #ifdef ORXONOX_CONFIG_BIG_ENDIAN
    200 #  define ORXONOX_ENDIAN ORXONOX_ENDIAN_BIG
    201 #else
    202 #  define ORXONOX_ENDIAN ORXONOX_ENDIAN_LITTLE
    203 #endif
    204 
    205 //-----------------------------------------------------------------------
    206 // fixed width integers
    207 //-----------------------------------------------------------------------
     194
     195/*---------------------------------
     196 * Visual Studio Settings
     197 *-------------------------------*/
    208198#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
    209 typedef __int8            int8_t;
    210 typedef __int16           int16_t;
    211 typedef __int32           int32_t;
    212 typedef __int64           int64_t;
    213 typedef unsigned __int8   uint8_t;
    214 typedef unsigned __int16  uint16_t;
    215 typedef unsigned __int32  uint32_t;
    216 typedef unsigned __int64  uint64_t;
    217 #else
    218 # include "inttypes.h"
    219 #endif
    220 
    221 namespace orxonox {
    222 #ifdef ORXONOX_DOUBLE_PRECISION
    223 typedef double Real;
    224 #else
    225 typedef float Real;
    226 #endif
    227 }
    228 
    229 
    230 #if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
    231 // Turn off warnings generated by long std templates
    232 // This warns about truncation to 255 characters in debug/browse info
    233 //#   pragma warning (disable : 4786)
    234 
    235 // Turn off warnings generated by long std templates
    236 // This warns about truncation to 255 characters in debug/browse info
    237 //#   pragma warning (disable : 4503)
    238 
    239 // disable: conversion from 'double' to 'float', possible loss of data
    240 // disable: conversion from 'ogg_int64_t' to 'long', possible loss of data
    241 // This has been dealt with in base_properties of the solution since the
    242 // warning primarily occurs in library header files (which are mostly
    243 // included before OrxonoxPlatform.h is)
    244 //#   pragma warning (disable : 4244)
    245 
    246 // disable: "conversion from 'size_t' to 'unsigned int', possible loss of data
    247 //#   pragma warning (disable : 4267)
    248 
    249 // disable: "truncation from 'double' to 'float'
    250 //#   pragma warning (disable : 4305)
    251 
    252 // set to level 4: "<type> needs to have dll-interface to be used by clients'
    253 // Happens on STL member variables which are not public therefore is ok
     199/* Turn off warnings generated by long std templates
     200 * This warns about truncation to 255 characters in debug/browse info */
     201/*#   pragma warning (disable : 4786)*/
     202
     203/* Turn off warnings generated by long std templates
     204 * This warns about truncation to 255 characters in debug/browse info */
     205/*#   pragma warning (disable : 4503)*/
     206
     207/* disable: conversion from 'double' to 'float', possible loss of data
     208 * disable: conversion from 'ogg_int64_t' to 'long', possible loss of data
     209 * This has been dealt with in base_properties of the solution since the
     210 * warning primarily occurs in library header files (which are mostly
     211 * included before OrxonoxPlatform.h is) */
     212/*#   pragma warning (disable : 4244)*/
     213
     214/* disable: "conversion from 'size_t' to 'unsigned int', possible loss of data */
     215/*#   pragma warning (disable : 4267)*/
     216
     217/* disable: "truncation from 'double' to 'float' */
     218/*#   pragma warning (disable : 4305)*/
     219
     220/* set to level 4: "<type> needs to have dll-interface to be used by clients'
     221 * Happens on STL member variables which are not public therefore is ok */
    254222#   pragma warning (disable : 4251)
    255223
    256 // disable: 'MultiTypeString' : multiple assignment operators specified
    257 // Used in MultiType and works fine so far
    258 //#   pragma warning (disable : 4522)
    259 
    260 // disable: "non dll-interface class used as base for dll-interface class"
    261 // Happens when deriving from Singleton because bug in compiler ignores
    262 // template export
    263 //#   pragma warning (disable : 4275)
    264 
    265 // disable: "C++ Exception Specification ignored"
    266 // This is because MSVC 6 did not implement all the C++ exception
    267 // specifications in the ANSI C++ draft.
    268 //#   pragma warning( disable : 4290 )
    269 
    270 // disable: "no suitable definition provided for explicit template
    271 // instantiation request" Occurs in VC7 for no justifiable reason on all
    272 // #includes of Singleton
    273 //#   pragma warning( disable: 4661)
    274 
    275 // disable: deprecation warnings when using CRT calls in VC8
    276 // These show up on all C runtime lib code in VC8, disable since they clutter
    277 // the warnings with things we may not be able to do anything about (e.g.
    278 // generated code from nvparse etc). I doubt very much that these calls
    279 // will ever be actually removed from VC anyway, it would break too much code.
    280 //# pragma warning( disable: 4996)
    281 
    282 // disable: "conditional expression constant", always occurs on
    283 // ORXONOX_MUTEX_CONDITIONAL when no threading enabled
    284 //#   pragma warning (disable : 201)
    285 
    286 
    287 // Define the english written operators like and, or, xor
     224/* disable: 'MultiTypeString' : multiple assignment operators specified
     225 * Used in MultiType and works fine so far */
     226/*#   pragma warning (disable : 4522)*/
     227
     228/* disable: "non dll-interface class used as base for dll-interface class"
     229 * Happens when deriving from Singleton because bug in compiler ignores
     230 * template export */
     231/*#   pragma warning (disable : 4275)*/
     232
     233/* disable: "C++ Exception Specification ignored"
     234 * This is because MSVC 6 did not implement all the C++ exception
     235 * specifications in the ANSI C++ draft. */
     236/*#   pragma warning( disable : 4290 )*/
     237
     238/* disable: "no suitable definition provided for explicit template
     239 * instantiation request" Occurs in VC7 for no justifiable reason on all
     240 * #includes of Singleton */
     241/*#   pragma warning( disable: 4661)*/
     242
     243/* disable: deprecation warnings when using CRT calls in VC8
     244 * These show up on all C runtime lib code in VC8, disable since they clutter
     245 * the warnings with things we may not be able to do anything about (e.g.
     246 * generated code from nvparse etc). I doubt very much that these calls
     247 * will ever be actually removed from VC anyway, it would break too much code. */
     248/*# pragma warning( disable: 4996)*/
     249
     250/* disable: "conditional expression constant", always occurs on
     251 * ORXONOX_MUTEX_CONDITIONAL when no threading enabled */
     252/*#   pragma warning (disable : 201)*/
     253
     254
     255/* Define the english written operators like and, or, xor */
    288256#include <iso646.h>
    289257
     258/* include visual leak detector to search for memory leaks */
     259/* #include <vld.h> */
     260
    290261#endif /* ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC */
    291262
    292 // include visual leak detector to search for memory leaks
    293 //#include <vld.h>
    294 
    295263#endif /* _OrxonoxPlatform_H__ */
  • code/branches/gui/src/util/Sleep.h

    r1638 r1652  
    2828
    2929/**
    30  @file  Sleep.h
    31  @brief Functions for using sleep() and usleep() under windows
     30 @file
     31 @brief
     32    Functions for using sleep() and usleep() under windows.
    3233 */
    3334
    34 #include "UtilPrereqs.h"
     35#ifndef _Sleep_H__
     36#define _Sleep_H__
     37
     38#include "OrxonoxPlatform.h"
    3539
    3640#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32
    37 #  ifndef WIN32_LEAN_AND_MEAN
    38 #    define WIN32_LEAN_AND_MEAN
    39 #  endif
    40 #  include <windows.h>
     41
     42#ifndef WIN32_LEAN_AND_MEAN
     43# define WIN32_LEAN_AND_MEAN
     44#endif
     45#include <windows.h>
     46
    4147inline void usleep(DWORD dwMicroseconds)
    4248{
    4349  Sleep(dwMicroseconds / 1000);
    4450}
     51
    4552inline void msleep(DWORD dwMilliseconds)
    4653{
    4754  Sleep(dwMilliseconds);
    4855}
     56
    4957inline void sleep(DWORD dwSeconds)
    5058{
    5159  Sleep(dwSeconds * 1000);
    5260}
    53 #else
    54 #  include <unistd.h>
     61
     62#else /* Linux/Apple */
     63
     64#include <unistd.h>
     65
    5566inline void msleep(unsigned long msec)
    5667{
    5768  usleep(msec * 1000);
    5869}
     70
    5971#endif
     72
     73#endif /* _Sleep_H__ */
  • code/branches/gui/visual_studio/vc8/util.vcproj

    r1625 r1652  
    207207                        </File>
    208208                        <File
     209                                RelativePath="..\..\src\util\Integers.h"
     210                                >
     211                        </File>
     212                        <File
    209213                                RelativePath="..\..\src\util\Math.h"
    210214                                >
Note: See TracChangeset for help on using the changeset viewer.