Nxna2
 All Classes Namespaces Functions Enumerations Enumerator Pages
Nxna2.h
1 /*
2 
3 Defining each of these changes how NXNA is built
4 
5 NXNA_ENABLE_MATH - enabled Vector2, Vector3, and Matrix classes
6 NXNA_ENABLE_RENDERER - enables GraphicsDevice and all the related classes
7 NXNA_ENABLE_INPUT - enables the Input related classes
8 
9 NXNA_ENABLE_DIRECT3D11 - Enables the Direct3D11 renderer. (no effect on non-Windows platforms)
10 
11 NXNA_DISABLE_VALIDATION - Disables some extra run-time checks
12 
13 */
14 
94 #ifndef NXNA2_H
95 #define NXNA2_H
96 
97 #include "NxnaCommon.h"
98 
99 
100 #ifdef NXNA_ENABLE_MATH
101 #include "Vector2.h"
102 #include "Vector3.h"
103 #include "Vector4.h"
104 #include "Matrix.h"
105 #include "Quaternion.h"
106 #endif
107 
108 
109 // the basics
110 namespace Nxna
111 {
112  struct Rectangle
113  {
114  int X, Y, Width, Height;
115 
116  Rectangle()
117  {
118  X = Y = Width = Height = 0;
119  }
120 
121  Rectangle(int x, int y, int width, int height)
122  {
123  X = x;
124  Y = y;
125  Width = width;
126  Height = height;
127  }
128 
129 #ifdef NXNA_ENABLE_MATH
130  Vector2 GetCenter()
131  {
132  return Vector2(X + Width * 0.5f, Y + Height * 0.5f);
133  }
134 #endif
135  void GetCenter(float* centerX, float* centerY)
136  {
137  if (centerX != nullptr) *centerX = X + Width * 0.5f;
138  if (centerY != nullptr) *centerY = Y + Height * 0.5f;
139  }
140  };
141 }
142 
143 
144 #ifdef NXNA_ENABLE_RENDERER
145 #include "Graphics/GraphicsDevice.h"
146 #include "Graphics/PipelineState.h"
147 #include "Color.h"
148 #endif
149 
150 #ifdef NXNA_ENABLE_INPUT
151 #include "Input/Mouse.h"
152 #endif
153 
154 #ifdef NXNA_ENABLE_SPRITEBATCH
155 #ifndef NXNA_ENABLE_RENDERER
156 #error NXNA_ENABLE_SPRITEBATCH requires NXNA_ENABLE_RENDERER
157 #endif
158 #include "Graphics/SpriteBatch.h"
159 #endif
160 
161 #ifdef NXNA_ENABLE_SPRITEFONT
162 #ifndef NXNA_ENABLE_SPRITEBATCH
163 #error NXNA_ENABLE_SPRITEFONT requries NXNA_ENABLE_SPRITEBATCH
164 #endif
165 #include "Graphics/SpriteFont.h"
166 #endif
167 
168 #endif // NXNA2_H
169 
170 #ifdef NXNA2_IMPLEMENTATION
171 
172 #ifdef NXNA_ENABLE_MATH
173 #include "Vector2.cpp"
174 #include "Vector3.cpp"
175 #include "Matrix.cpp"
176 #include "Quaternion.cpp"
177 #endif
178 
179 #ifdef NXNA_ENABLE_RENDERER
180 #include "Graphics/GraphicsDevice.cpp"
181 #include "Graphics/OpenGL.cpp"
182 #include "Graphics/PipelineState.cpp"
183 #endif
184 
185 #ifdef NXNA_ENABLE_INPUT
186 #include "Input/Mouse.cpp"
187 #endif
188 
189 #ifdef NXNA_ENABLE_SPRITEBATCH
190 #include "Graphics/SpriteBatch.cpp"
191 #endif
192 
193 #endif // NXNA2_IMPLEMENTATION
Definition: Nxna2.h:112
Definition: Vector2.h:12