13
13
#include < chrono>
14
14
#include < fstream>
15
15
16
+ #ifndef NDEBUG
17
+ #define FLOX_SHOW_DEBUG_INFO
18
+ #endif
19
+
16
20
using namespace lwvl ::debug;
17
21
using namespace std ::chrono;
18
22
@@ -94,16 +98,16 @@ int run() {
94
98
Window window (width, height, " Ultimate Flox" );
95
99
96
100
lwvl::Program::clear ();
97
- #ifndef NDEBUG
101
+ #ifdef FLOX_SHOW_DEBUG_INFO
98
102
GLEventListener listener (
99
103
[](
100
104
Source source, Type type,
101
105
Severity severity, unsigned int id, int length,
102
106
const char *message, const void *userState
103
107
) {
104
- // if (type != Type::OTHER){
108
+ if (type != Type::OTHER){
105
109
std::cout << " [OpenGL] " << message << std::endl;
106
- // }
110
+ }
107
111
}
108
112
);
109
113
@@ -165,13 +169,13 @@ int run() {
165
169
VisionShader visionShader{projection};
166
170
BoidShader *activeShader = &defaultBoidShader;
167
171
168
- #ifndef NDEBUG
172
+ #ifdef FLOX_SHOW_DEBUG_INFO
169
173
std::cout << " Setup took " << delta (setupStart) << " seconds." << std::endl;
170
174
#endif
171
175
auto secondStart = high_resolution_clock::now ();
172
176
auto frameStart = high_resolution_clock::now ();
173
177
174
- #ifndef NDEBUG
178
+ #ifdef FLOX_SHOW_DEBUG_INFO
175
179
double eventDurationAverage = 0.0 ;
176
180
double updateDurationAverage = 0.0 ;
177
181
double renderDurationAverage = 0.0 ;
@@ -193,7 +197,7 @@ int run() {
193
197
L.validate (onFrameStart.call ());
194
198
}
195
199
196
- #ifndef NDEBUG
200
+ #ifdef FLOX_SHOW_DEBUG_INFO
197
201
auto averageStart = high_resolution_clock::now ();
198
202
#endif
199
203
@@ -269,9 +273,9 @@ int run() {
269
273
}
270
274
}
271
275
272
- #ifndef NDEBUG
276
+ #ifdef FLOX_SHOW_DEBUG_INFO
273
277
eventDurationAverage += delta (averageStart);
274
- averageStart = high_resolution_clock::now ();
278
+ averageStart = high_resolution_clock::now ();
275
279
#endif
276
280
277
281
// Update engine
@@ -280,9 +284,9 @@ int run() {
280
284
flock.update (algorithm, dt);
281
285
}
282
286
283
- #ifndef NDEBUG
287
+ #ifdef FLOX_SHOW_DEBUG_INFO
284
288
updateDurationAverage += delta (averageStart);
285
- averageStart = high_resolution_clock::now ();
289
+ averageStart = high_resolution_clock::now ();
286
290
#endif
287
291
288
292
// Rendering
@@ -315,7 +319,7 @@ int run() {
315
319
316
320
window.swapBuffers ();
317
321
318
- #ifndef NDEBUG
322
+ #ifdef FLOX_SHOW_DEBUG_INFO
319
323
renderDurationAverage += delta (averageStart);
320
324
#endif
321
325
@@ -331,7 +335,7 @@ int run() {
331
335
}
332
336
333
337
secondStart = high_resolution_clock::now ();
334
- #ifndef NDEBUG
338
+ #ifdef FLOX_SHOW_DEBUG_INFO
335
339
std::cout << " Average framerate for last " << frameCount << " frames: " << fps << " | " << 1.0 / fps << ' s' << std::endl;
336
340
337
341
const auto frameth = 1.0 / static_cast <double >(frameCount);
0 commit comments