Crazy Eddies GUI System  0.7.9
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
CEGUIBase.h
1 /***********************************************************************
2  filename: CEGUIBase.h
3  created: 20/2/2004
4  author: Paul D Turner
5 
6  purpose: Base include used within the system
7  This contains various lower level bits required
8  by other parts of the system. All other library
9  headers will include this file.
10 *************************************************************************/
11 /***************************************************************************
12  * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
13  *
14  * Permission is hereby granted, free of charge, to any person obtaining
15  * a copy of this software and associated documentation files (the
16  * "Software"), to deal in the Software without restriction, including
17  * without limitation the rights to use, copy, modify, merge, publish,
18  * distribute, sublicense, and/or sell copies of the Software, and to
19  * permit persons to whom the Software is furnished to do so, subject to
20  * the following conditions:
21  *
22  * The above copyright notice and this permission notice shall be
23  * included in all copies or substantial portions of the Software.
24  *
25  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
28  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
29  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
30  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
31  * OTHER DEALINGS IN THE SOFTWARE.
32  ***************************************************************************/
33 #ifndef _CEGUIBase_h_
34 #define _CEGUIBase_h_
35 
36 #include <cassert>
37 
38 // bring in configuration options
39 #include "CEGUIConfig.h"
40 
41 // add CEGUI version defines
42 #include "CEGUIVersion.h"
43 
44 /*************************************************************************
45  Dynamic Library import / export control conditional
46  (Define CEGUIBASE_EXPORTS to export symbols, else they are imported)
47 *************************************************************************/
48 #if (defined( __WIN32__ ) || defined( _WIN32 )) && !defined(CEGUI_STATIC)
49 # ifdef CEGUIBASE_EXPORTS
50 # define CEGUIEXPORT __declspec(dllexport)
51 # else
52 # define CEGUIEXPORT __declspec(dllimport)
53 # endif
54 # define CEGUIPRIVATE
55 #else
56 # define CEGUIEXPORT
57 # define CEGUIPRIVATE
58 #endif
59 
60 
61 // totally kill this warning (debug info truncated to 255 chars etc...) on <= VC6
62 #if defined(_MSC_VER) && (_MSC_VER <= 1200)
63 # pragma warning(disable : 4786)
64 #endif
65 
66 
67 // Detect macros for min / max and undefine (with a warning where possible)
68 #if defined(max)
69 # if defined(_MSC_VER)
70 # pragma message("Macro definition of max detected - undefining")
71 # elif defined (__GNUC__)
72 # warning ("Macro definition of max detected - undefining")
73 # endif
74 # undef max
75 #endif
76 #if defined(min)
77 # if defined(_MSC_VER)
78 # pragma message("Macro definition of min detected - undefining")
79 # elif defined (__GNUC__)
80 # warning ("Macro definition of min detected - undefining")
81 # endif
82 # undef min
83 #endif
84 
85 
86 // include this to see if it defines _STLPORT_VERION
87 # include <string>
88 
89 // fix to undefine _STLP_DEBUG if STLport is not actually being used
90 // (resolves some unresolved externals concerning boost)
91 #if defined(_STLP_DEBUG) && defined(_MSC_VER) && (_MSC_VER >= 1200)
92 # if !defined(_STLPORT_VERSION)
93 # undef _STLP_DEBUG
94 # endif
95 #endif
96 
97 
98 // The following defines macros used within CEGUI for std::min/std::max
99 // usage, and is done as a compatibility measure for VC6 with native STL.
100 #if defined(_MSC_VER) && (_MSC_VER <= 1200) && !defined(_STLPORT_VERSION)
101 # define ceguimin std::_cpp_min
102 # define ceguimax std::_cpp_max
103 #else
104 # define ceguimin std::min
105 # define ceguimax std::max
106 #endif
107 
108 // CEGUI's Exception macros
109 // This provides a mechanism to override how exception handling is used. Note
110 // that in general this facility _should not be used_. Attempts to use this
111 // to disable exceptions to 'make things easier' are doomed to failure. CEGUI
112 // becomes less robust without exceptions (because they are used internally by
113 // CEGUI). In addition, overriding the exception mechanism will also cause
114 // memory leaks in various places. This is your only warning about such things,
115 // if you decide to continue anyway you hereby waive any right to complain :-p
116 #ifndef CEGUI_TRY
117 # define CEGUI_TRY try
118 #endif
119 #ifndef CEGUI_CATCH
120 # define CEGUI_CATCH(e) catch (e)
121 #endif
122 #ifndef CEGUI_THROW
123 # define CEGUI_THROW(e) throw e
124 #endif
125 #ifndef CEGUI_RETHROW
126 # define CEGUI_RETHROW throw
127 #endif
128 
129 /*************************************************************************
130  Documentation for the CEGUI namespace itself
131 *************************************************************************/
139 namespace CEGUI
140 {
141 
142 /*************************************************************************
143  Simplification of some 'unsigned' types
144 *************************************************************************/
145 typedef unsigned long ulong;
146 typedef unsigned short ushort;
147 typedef unsigned int uint;
148 typedef unsigned char uchar;
149 
150 typedef unsigned int uint32;
151 typedef unsigned short uint16;
152 typedef unsigned char uint8;
153 
154 
155 /*************************************************************************
156  System wide constants
157 *************************************************************************/
158 static const float DefaultNativeHorzRes = 640.0f;
159 static const float DefaultNativeVertRes = 480.0f;
160 
161 
162 /*************************************************************************
163  Additional typedefs
164 *************************************************************************/
165 typedef std::ostream OutStream;
166 } // end of CEGUI namespace section
167 
168 
170 // Comment this line to remove the alignment of elements to pixel
171 // boundaries. This may give you a performance boost at the expense
172 // of visual quality
174 #define CEGUI_ALIGN_ELEMENTS_TO_PIXELS 1
175 
189 #if defined(CEGUI_ALIGN_ELEMENTS_TO_PIXELS)
190 # define PixelAligned(x) ( (float)(int)(( x ) + (( x ) > 0.0f ? 0.5f : -0.5f)) )
191 #else
192 # define PixelAligned(x) ( x )
193 #endif
194 
195 
196 /*************************************************************************
197  Bring in forward references to all GUI base system classes
198 *************************************************************************/
199 #include "CEGUIForwardRefs.h"
200 
201 
202 #endif // end of guard _CEGUIBase_h_