CUGL
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 zlib 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_MAC_OSX 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 //defined (__ORDER_LITTLE_ENDIAN__) || defined (__WINDOWS__)
79  #define CU_MEMORY_ORDER CU_ORDER_REVERSED
80 #else
81  #define CU_MEMORY_ORDER CU_ORDER_STANDARD
82 #endif
83 
84 
85 // OpenGL support
87 #define CU_GL_OPENGL 0
88 
89 #define CU_GL_OPENGLES 1
90 
91 // Load the libraries and define the platform
92 #if defined (__IPHONEOS__)
93  #include <OpenGLES/ES3/gl.h>
94  #include <OpenGLES/ES3/glext.h>
96  #define CU_GL_PLATFORM CU_GL_OPENGLES
97 #elif defined (__ANDROID__)
98  #include <GLES3/gl3platform.h>
99  #include <GLES3/gl3.h>
100  #include <GLES3/gl3ext.h>
102  #define CU_GL_PLATFORM CU_GL_OPENGLES
103 #elif defined (__MACOSX__)
104  #include <OpenGL/OpenGL.h>
105  #include <OpenGL/gl3.h>
106  #include <OpenGL/gl3ext.h>
108  #define CU_GL_PLATFORM CU_GL_OPENGL
109 #elif defined (__WINDOWS__)
110  #define NOMINMAX
111  #include <windows.h>
112  #include <GL/glew.h>
113  #include <SDL/SDL_opengl.h>
114  #include <GL/gl.h>
115  #include <GL/glu.h>
117  #define CU_GL_PLATFORM CU_GL_OPENGL
118 #endif
119 
120 // Macros to disable copying for select classes.
121 #if defined(__GNUC__) && ((__GNUC__ >= 5) || ((__GNUG__ == 4) && (__GNUC_MINOR__ >= 4))) \
122 || (defined(__clang__) && (__clang_major__ >= 3)) || (_MSC_VER >= 1800)
123 #define CU_DISALLOW_COPY_AND_ASSIGN(TypeName) \
124 TypeName(const TypeName &) = delete; \
125 TypeName &operator =(const TypeName &) = delete;
126 #else
127 #define CU_DISALLOW_COPY_AND_ASSIGN(TypeName) \
128 TypeName(const TypeName &); \
129 TypeName &operator =(const TypeName &);
130 #endif
131 
132 #endif /* __CU_BASE_H__ */