CUGL 1.3
Cornell University Game Library
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
CUBase.h
1 //
2 // CUBase.h
3 // Cornell University Game Library (CUGL)
4 //
5 // This header includes the bear minimum defines that any CUGL class needs.
6 //
7 // CUGL MIT License:
8 // This software is provided 'as-is', without any express or implied
9 // warranty. In no event will the authors be held liable for any damages
10 // arising from the use of this software.
11 //
12 // Permission is granted to anyone to use this software for any purpose,
13 // including commercial applications, and to alter it and redistribute it
14 // freely, subject to the following restrictions:
15 //
16 // 1. The origin of this software must not be misrepresented; you must not
17 // claim that you wrote the original software. If you use this software
18 // in a product, an acknowledgment in the product documentation would be
19 // appreciated but is not required.
20 //
21 // 2. Altered source versions must be plainly marked as such, and must not
22 // be misrepresented as being the original software.
23 //
24 // 3. This notice may not be removed or altered from any source distribution.
25 //
26 // Author: Walker White
27 // Version: 5/30/16
28 
29 #ifndef __CU_BASE_H__
30 #define __CU_BASE_H__
31 
32 #include <memory>
33 #include <string>
34 #include <SDL/SDL.h>
35 
36 // The platforms
38 #define CU_PLATFORM_UNKNOWN 0
39 
40 #define CU_PLATFORM_MACOS 1
41 
42 #define CU_PLATFORM_IPHONE 2
43 
44 #define CU_PLATFORM_ANDROID 3
45 
46 #define CU_PLATFORM_WINDOWS 4
47 // Windows RT is discontinued, so we will not support it
48 
49 // Determine the correct platform
50 #if defined (__MACOSX__)
51 
52  #define CU_PLATFORM 1
53 #elif defined (__IPHONEOS__)
54 
55  #define CU_TOUCH_SCREEN 1
56  #define CU_PLATFORM 2
57 #elif defined (__ANDROID__)
58 
59  #define CU_TOUCH_SCREEN 1
60  #define CU_PLATFORM 3
61 #elif defined (__WINDOWS__)
62 
63  #define CU_PLATFORM 4
64 #else
65 
66  #define CU_PLATFORM 0
67 #endif
68 
69 
70 // Memory representation
72 #define CU_ORDER_STANDARD 0
73 
74 #define CU_ORDER_REVERSED 1
75 
76 // I have absolutely no idea what is going on with Windows
77 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
78  #define CU_MEMORY_ORDER CU_ORDER_REVERSED
79 #else
80  #define CU_MEMORY_ORDER CU_ORDER_STANDARD
81 #endif
82 
83 
84 // OpenGL support
86 #define CU_GL_OPENGL 0
87 
88 #define CU_GL_OPENGLES 1
89 
90 // Load the libraries and define the platform
91 #if defined (__IPHONEOS__)
92  #include <OpenGLES/ES3/gl.h>
93  #include <OpenGLES/ES3/glext.h>
95  #define CU_GL_PLATFORM CU_GL_OPENGLES
96 #elif defined (__ANDROID__)
97  #include <GLES3/gl3platform.h>
98  #include <GLES3/gl3.h>
99  #include <GLES3/gl3ext.h>
101  #define CU_GL_PLATFORM CU_GL_OPENGLES
102 #elif defined (__MACOSX__)
103  #include <OpenGL/OpenGL.h>
104  #include <OpenGL/gl3.h>
105  #include <OpenGL/gl3ext.h>
107  #define CU_GL_PLATFORM CU_GL_OPENGL
108 #elif defined (__WINDOWS__)
109  #define NOMINMAX
110  #include <windows.h>
111  #include <GL/glew.h>
112  #include <SDL/SDL_opengl.h>
113  #include <GL/gl.h>
114  #include <GL/glu.h>
116  #define CU_GL_PLATFORM CU_GL_OPENGL
117 #endif
118 
119 #ifdef _MSC_VER
120  //not #if defined(_WIN32) || defined(_WIN64) because we have strncasecmp in mingw
121 #define strncasecmp _strnicmp
122 #define strcasecmp _stricmp
123 #endif
124 
125 // Macros to disable copying for select classes.
126 #if defined(__GNUC__) && ((__GNUC__ >= 5) || ((__GNUG__ == 4) && (__GNUC_MINOR__ >= 4))) \
127 || (defined(__clang__) && (__clang_major__ >= 3)) || (_MSC_VER >= 1800)
128 #define CU_DISALLOW_COPY_AND_ASSIGN(TypeName) \
129 TypeName(const TypeName &) = delete; \
130 TypeName &operator =(const TypeName &) = delete;
131 #else
132 #define CU_DISALLOW_COPY_AND_ASSIGN(TypeName) \
133 TypeName(const TypeName &); \
134 TypeName &operator =(const TypeName &);
135 #endif
136 
137 #endif /* __CU_BASE_H__ */