Crazy Eddies GUI System: CEGUIBase.h Source File

Crazy Eddies GUI System 0.7.6

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

CEGUIBase.h

    00001 /***********************************************************************
    00002         filename:       CEGUIBase.h
    00003         created:        20/2/2004
    00004         author:         Paul D Turner
    00005
    00006         purpose:        Base include used within the system
    00007                                 This contains various lower level bits required
    00008                                 by other parts of the system.  All other library
    00009                                 headers will include this file.
    00010 *************************************************************************/
    00011 /***************************************************************************
    00012  *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
    00013  *
    00014  *   Permission is hereby granted, free of charge, to any person obtaining
    00015  *   a copy of this software and associated documentation files (the
    00016  *   "Software"), to deal in the Software without restriction, including
    00017  *   without limitation the rights to use, copy, modify, merge, publish,
    00018  *   distribute, sublicense, and/or sell copies of the Software, and to
    00019  *   permit persons to whom the Software is furnished to do so, subject to
    00020  *   the following conditions:
    00021  *
    00022  *   The above copyright notice and this permission notice shall be
    00023  *   included in all copies or substantial portions of the Software.
    00024  *
    00025  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    00026  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    00027  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
    00028  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
    00029  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
    00030  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
    00031  *   OTHER DEALINGS IN THE SOFTWARE.
    00032  ***************************************************************************/
    00033 #ifndef _CEGUIBase_h_
    00034 #define _CEGUIBase_h_
    00035
    00036 #include <cassert>
    00037
    00038 // bring in configuration options
    00039 #include "CEGUIConfig.h"
    00040
    00041 // add CEGUI version defines
    00042 #include "CEGUIVersion.h"
    00043
    00044 /*************************************************************************
    00045         Dynamic Library import / export control conditional
    00046         (Define CEGUIBASE_EXPORTS to export symbols, else they are imported)
    00047 *************************************************************************/
    00048 #if (defined( __WIN32__ ) || defined( _WIN32 )) && !defined(CEGUI_STATIC)
    00049 #   ifdef CEGUIBASE_EXPORTS
    00050 #       define CEGUIEXPORT __declspec(dllexport)
    00051 #   else
    00052 #       define CEGUIEXPORT __declspec(dllimport)
    00053 #   endif
    00054 #       define CEGUIPRIVATE
    00055 #else
    00056 #       define CEGUIEXPORT
    00057 #       define CEGUIPRIVATE
    00058 #endif
    00059
    00060
    00061 // totally kill this warning (debug info truncated to 255 chars etc...) on <= VC6
    00062 #if defined(_MSC_VER) && (_MSC_VER <= 1200)
    00063 #   pragma warning(disable : 4786)
    00064 #endif
    00065
    00066
    00067 // Detect macros for min / max and undefine (with a warning where possible)
    00068 #if defined(max)
    00069 #   if defined(_MSC_VER)
    00070 #       pragma message("Macro definition of max detected - undefining")
    00071 #   elif defined (__GNUC__)
    00072 #       warning ("Macro definition of max detected - undefining")
    00073 #   endif
    00074 #   undef max
    00075 #endif
    00076 #if defined(min)
    00077 #   if defined(_MSC_VER)
    00078 #       pragma message("Macro definition of min detected - undefining")
    00079 #   elif defined (__GNUC__)
    00080 #       warning ("Macro definition of min detected - undefining")
    00081 #   endif
    00082 #   undef min
    00083 #endif
    00084
    00085
    00086 // include this to see if it defines _STLPORT_VERION
    00087 #       include <string>
    00088
    00089 // fix to undefine _STLP_DEBUG if STLport is not actually being used
    00090 // (resolves some unresolved externals concerning boost)
    00091 #if defined(_STLP_DEBUG) && defined(_MSC_VER) && (_MSC_VER >= 1200)
    00092 #       if !defined(_STLPORT_VERSION)
    00093 #               undef _STLP_DEBUG
    00094 #       endif
    00095 #endif
    00096
    00097
    00098 // The following defines macros used within CEGUI for std::min/std::max
    00099 // usage, and is done as a compatibility measure for VC6 with native STL.
    00100 #if defined(_MSC_VER) && (_MSC_VER <= 1200) && !defined(_STLPORT_VERSION)
    00101 #    define ceguimin    std::_cpp_min
    00102 #    define ceguimax    std::_cpp_max
    00103 #else
    00104 #    define ceguimin    std::min
    00105 #    define ceguimax    std::max
    00106 #endif
    00107
    00108 // CEGUI's Exception macros
    00109 // This provides a mechanism to override how exception handling is used.  Note
    00110 // that in general this facility _should not be used_.  Attempts to use this
    00111 // to disable exceptions to 'make things easier' are doomed to failure.  CEGUI
    00112 // becomes less robust without exceptions (because they are used internally by
    00113 // CEGUI).  In addition, overriding the exception mechanism will also cause
    00114 // memory leaks in various places.  This is your only warning about such things,
    00115 // if you decide to continue anyway you hereby waive any right to complain :-p
    00116 #ifndef CEGUI_TRY
    00117 #   define CEGUI_TRY try
    00118 #endif
    00119 #ifndef CEGUI_CATCH
    00120 #   define CEGUI_CATCH(e) catch (e)
    00121 #endif
    00122 #ifndef CEGUI_THROW
    00123 #   define CEGUI_THROW(e) throw e
    00124 #endif
    00125 #ifndef CEGUI_RETHROW
    00126 #   define CEGUI_RETHROW throw
    00127 #endif
    00128
    00129 /*************************************************************************
    00130         Documentation for the CEGUI namespace itself
    00131 *************************************************************************/
    00139 namespace CEGUI
    00140 {
    00141
    00142 /*************************************************************************
    00143         Simplification of some 'unsigned' types
    00144 *************************************************************************/
    00145 typedef unsigned long   ulong;
    00146 typedef unsigned short  ushort;
    00147 typedef unsigned int    uint;
    00148 typedef unsigned char   uchar;
    00149
    00150 typedef unsigned int    uint32;
    00151 typedef unsigned short  uint16;
    00152 typedef unsigned char   uint8;
    00153
    00154
    00155 /*************************************************************************
    00156         System wide constants
    00157 *************************************************************************/
    00158 static const float              DefaultNativeHorzRes    = 640.0f;
    00159 static const float              DefaultNativeVertRes    = 480.0f;
    00160
    00161
    00162 /*************************************************************************
    00163     Additional typedefs
    00164 *************************************************************************/
    00165 typedef std::ostream OutStream;
    00166 }  // end of CEGUI namespace section
    00167
    00168
    00170 // Comment this line to remove the alignment of elements to pixel
    00171 // boundaries.  This may give you a performance boost at the expense
    00172 // of visual quality
    00174 #define CEGUI_ALIGN_ELEMENTS_TO_PIXELS 1
    00175
    00189 #if defined(CEGUI_ALIGN_ELEMENTS_TO_PIXELS)
    00190 #       define PixelAligned(x)  ( (float)(int)(( x ) + (( x ) > 0.0f ? 0.5f : -0.5f)) )
    00191 #else
    00192 #       define PixelAligned(x)  ( x )
    00193 #endif
    00194
    00195
    00196 /*************************************************************************
    00197         Bring in forward references to all GUI base system classes
    00198 *************************************************************************/
    00199 #include "CEGUIForwardRefs.h"
    00200
    00201
    00202 #endif  // end of guard _CEGUIBase_h_