Documentation de SFML 1.6

Attention: cette page se réfère à une ancienne version de SFML. Cliquez ici pour passer à la dernière version.
Config.hpp
1 
2 //
3 // SFML - Simple and Fast Multimedia Library
4 // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
5 //
6 // This software is provided 'as-is', without any express or implied warranty.
7 // In no event will the authors be held liable for any damages arising from the use of this software.
8 //
9 // Permission is granted to anyone to use this software for any purpose,
10 // including commercial applications, and to alter it and redistribute it freely,
11 // subject to the following restrictions:
12 //
13 // 1. The origin of this software must not be misrepresented;
14 // you must not claim that you wrote the original software.
15 // If you use this software in a product, an acknowledgment
16 // in the product documentation would be appreciated but is not required.
17 //
18 // 2. Altered source versions must be plainly marked as such,
19 // and must not be misrepresented as being the original software.
20 //
21 // 3. This notice may not be removed or altered from any source distribution.
22 //
24 
25 #ifndef SFML_CONFIG_HPP
26 #define SFML_CONFIG_HPP
27 
29 // Identify the operating system
31 #if defined(_WIN32) || defined(__WIN32__)
32 
33  // Windows
34  #define SFML_SYSTEM_WINDOWS
35  #ifndef WIN32_LEAN_AND_MEAN
36  #define WIN32_LEAN_AND_MEAN
37  #endif
38  #ifndef NOMINMAX
39  #define NOMINMAX
40  #endif
41 
42 #elif defined(linux) || defined(__linux)
43 
44  // Linux
45  #define SFML_SYSTEM_LINUX
46 
47 #elif defined(__APPLE__) || defined(MACOSX) || defined(macintosh) || defined(Macintosh)
48 
49  // MacOS
50  #define SFML_SYSTEM_MACOS
51 
52 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
53 
54  // FreeBSD
55  #define SFML_SYSTEM_FREEBSD
56 
57 #else
58 
59  // Unsupported system
60  #error This operating system is not supported by SFML library
61 
62 #endif
63 
64 
66 // Define a portable debug macro
68 #if !defined(NDEBUG)
69 
70  #define SFML_DEBUG
71 
72 #endif
73 
74 
76 // Define portable import / export macros
78 #if defined(SFML_SYSTEM_WINDOWS)
79 
80  #ifdef SFML_DYNAMIC
81 
82  // Windows platforms
83  #ifdef SFML_EXPORTS
84 
85  // From DLL side, we must export
86  #define SFML_API __declspec(dllexport)
87 
88  #else
89 
90  // From client application side, we must import
91  #define SFML_API __declspec(dllimport)
92 
93  #endif
94 
95  // For Visual C++ compilers, we also need to turn off this annoying C4251 warning.
96  // You can read lots ot different things about it, but the point is the code will
97  // just work fine, and so the simplest way to get rid of this warning is to disable it
98  #ifdef _MSC_VER
99 
100  #pragma warning(disable : 4251)
101 
102  #endif
103 
104  #else
105 
106  // No specific directive needed for static build
107  #define SFML_API
108 
109  #endif
110 
111 #else
112 
113  // Other platforms don't need to define anything
114  #define SFML_API
115 
116 #endif
117 
118 
120 // Define portable fixed-size types
122 #include <climits>
123 
124 namespace sf
125 {
126  // 8 bits integer types
127  #if UCHAR_MAX == 0xFF
128  typedef signed char Int8;
129  typedef unsigned char Uint8;
130  #else
131  #error No 8 bits integer type for this platform
132  #endif
133 
134  // 16 bits integer types
135  #if USHRT_MAX == 0xFFFF
136  typedef signed short Int16;
137  typedef unsigned short Uint16;
138  #elif UINT_MAX == 0xFFFF
139  typedef signed int Int16;
140  typedef unsigned int Uint16;
141  #elif ULONG_MAX == 0xFFFF
142  typedef signed long Int16;
143  typedef unsigned long Uint16;
144  #else
145  #error No 16 bits integer type for this platform
146  #endif
147 
148  // 32 bits integer types
149  #if USHRT_MAX == 0xFFFFFFFF
150  typedef signed short Int32;
151  typedef unsigned short Uint32;
152  #elif UINT_MAX == 0xFFFFFFFF
153  typedef signed int Int32;
154  typedef unsigned int Uint32;
155  #elif ULONG_MAX == 0xFFFFFFFF
156  typedef signed long Int32;
157  typedef unsigned long Uint32;
158  #else
159  #error No 32 bits integer type for this platform
160  #endif
161 
162 } // namespace sf
163 
164 
165 #endif // SFML_CONFIG_HPP