|
@@ -6,6 +6,7 @@
|
6
|
6
|
*/
|
7
|
7
|
|
8
|
8
|
#include <algorithm>
|
|
9
|
+#include <cstring>
|
9
|
10
|
|
10
|
11
|
#include "global.h"
|
11
|
12
|
#include "Console.h"
|
|
@@ -186,15 +187,15 @@ void UI::display() {
|
186
|
187
|
Console::display();
|
187
|
188
|
|
188
|
189
|
if (ImGui::Begin("Engine")) {
|
189
|
|
- if (ImGui::CollapsingHeader("RunTime Info")) {
|
|
190
|
+ if (ImGui::CollapsingHeader("Engine Info")) {
|
190
|
191
|
ImGui::Text("Uptime: %lums", systemTimerGet());
|
191
|
192
|
ImGui::Text("Frames per Second: %luFPS", getRunTime().getFPS());
|
192
|
193
|
if (getRunTime().getHistoryFPS().size() > 1) {
|
193
|
194
|
static bool scroll = true;
|
194
|
195
|
if (scroll) {
|
195
|
196
|
int offset = getRunTime().getHistoryFPS().size() - 1;
|
196
|
|
- if (offset > 15)
|
197
|
|
- offset = 15;
|
|
197
|
+ if (offset > 10)
|
|
198
|
+ offset = 10;
|
198
|
199
|
ImGui::PlotLines("FPS", &getRunTime().getHistoryFPS()[1],
|
199
|
200
|
getRunTime().getHistoryFPS().size() - 1,
|
200
|
201
|
getRunTime().getHistoryFPS().size() - offset - 1);
|
|
@@ -207,8 +208,105 @@ void UI::display() {
|
207
|
208
|
}
|
208
|
209
|
}
|
209
|
210
|
|
|
211
|
+ if (ImGui::CollapsingHeader("RunTime Settings")) {
|
|
212
|
+ bool showFPS = getRunTime().getShowFPS();
|
|
213
|
+ if (ImGui::Checkbox("Show FPS##runtime", &showFPS)) {
|
|
214
|
+ getRunTime().setShowFPS(showFPS);
|
|
215
|
+ }
|
|
216
|
+ ImGui::SameLine();
|
|
217
|
+ bool running = getRunTime().isRunning();
|
|
218
|
+ if (ImGui::Checkbox("Running (!)##runtime", &running)) {
|
|
219
|
+ getRunTime().setRunning(running);
|
|
220
|
+ }
|
|
221
|
+ ImGui::SameLine();
|
|
222
|
+ bool sound = getSound().getEnabled();
|
|
223
|
+ if (ImGui::Checkbox("Sound##runtime", &sound)) {
|
|
224
|
+ getSound().setEnabled(sound);
|
|
225
|
+ }
|
|
226
|
+ ImGui::SameLine();
|
|
227
|
+ bool fullscreen = getWindow().getFullscreen();
|
|
228
|
+ if (ImGui::Checkbox("Fullscreen##runtime", &fullscreen)) {
|
|
229
|
+ getWindow().setFullscreen(fullscreen);
|
|
230
|
+ }
|
|
231
|
+
|
|
232
|
+ float vol = getSound().getVolume();
|
|
233
|
+ if (ImGui::InputFloat("Volume##runtime", &vol, 0.0f, 0.0f, 3, ImGuiInputTextFlags_EnterReturnsTrue)) {
|
|
234
|
+ if (vol < 0.0f)
|
|
235
|
+ vol = 0.0f;
|
|
236
|
+ if (vol > 1.0f)
|
|
237
|
+ vol = 1.0f;
|
|
238
|
+ getSound().setVolume(vol);
|
|
239
|
+ }
|
|
240
|
+
|
|
241
|
+ int w = getWindow().getWidth();
|
|
242
|
+ if (ImGui::InputInt("Width##runtime", &w, 10, 100, ImGuiInputTextFlags_EnterReturnsTrue)) {
|
|
243
|
+ if (w < 1)
|
|
244
|
+ w = 1;
|
|
245
|
+ getWindow().setSize(w, getWindow().getHeight());
|
|
246
|
+ }
|
|
247
|
+ int h = getWindow().getHeight();
|
|
248
|
+ if (ImGui::InputInt("Height##runtime", &h, 10, 100, ImGuiInputTextFlags_EnterReturnsTrue)) {
|
|
249
|
+ if (h < 1)
|
|
250
|
+ h = 1;
|
|
251
|
+ getWindow().setSize(getWindow().getWidth(), h);
|
|
252
|
+ }
|
|
253
|
+
|
|
254
|
+ static int fr = 0;
|
|
255
|
+ char buff[1024];
|
|
256
|
+ strncpy(buff, getRunTime().getBaseDir().c_str(), 1024);
|
|
257
|
+ if (ImGui::InputText("BaseDir##runtime", buff, 1024, ImGuiInputTextFlags_EnterReturnsTrue)) {
|
|
258
|
+ getRunTime().setBaseDir(buff);
|
|
259
|
+ fr = getRunTime().getFPS();
|
|
260
|
+ }
|
|
261
|
+ if (fr > 0) {
|
|
262
|
+ ImGui::SameLine();
|
|
263
|
+ ImGui::Text("Done!##runtime1");
|
|
264
|
+ fr--;
|
|
265
|
+ }
|
|
266
|
+
|
|
267
|
+ static int fr2 = 0;
|
|
268
|
+ char buff2[1024];
|
|
269
|
+ strncpy(buff2, getRunTime().getPakDir().c_str(), 1024);
|
|
270
|
+ if (ImGui::InputText("PakDir##runtime", buff2, 1024, ImGuiInputTextFlags_EnterReturnsTrue)) {
|
|
271
|
+ getRunTime().setPakDir(buff2);
|
|
272
|
+ fr2 = getRunTime().getFPS();
|
|
273
|
+ }
|
|
274
|
+ if (fr2 > 0) {
|
|
275
|
+ ImGui::SameLine();
|
|
276
|
+ ImGui::Text("Done!##runtime2");
|
|
277
|
+ fr2--;
|
|
278
|
+ }
|
|
279
|
+
|
|
280
|
+ static int fr3 = 0;
|
|
281
|
+ char buff3[1024];
|
|
282
|
+ strncpy(buff3, getRunTime().getAudioDir().c_str(), 1024);
|
|
283
|
+ if (ImGui::InputText("AudioDir##runtime", buff3, 1024, ImGuiInputTextFlags_EnterReturnsTrue)) {
|
|
284
|
+ getRunTime().setAudioDir(buff3);
|
|
285
|
+ fr3 = getRunTime().getFPS();
|
|
286
|
+ }
|
|
287
|
+ if (fr3 > 0) {
|
|
288
|
+ ImGui::SameLine();
|
|
289
|
+ ImGui::Text("Done!##runtime3");
|
|
290
|
+ fr3--;
|
|
291
|
+ }
|
|
292
|
+
|
|
293
|
+ static int fr4 = 0;
|
|
294
|
+ char buff4[1024];
|
|
295
|
+ strncpy(buff4, getRunTime().getDataDir().c_str(), 1024);
|
|
296
|
+ if (ImGui::InputText("DataDir##runtime", buff4, 1024, ImGuiInputTextFlags_EnterReturnsTrue)) {
|
|
297
|
+ getRunTime().setDataDir(buff4);
|
|
298
|
+ fr4 = getRunTime().getFPS();
|
|
299
|
+ }
|
|
300
|
+ if (fr4 > 0) {
|
|
301
|
+ ImGui::SameLine();
|
|
302
|
+ ImGui::Text("Done!##runtime4");
|
|
303
|
+ fr4--;
|
|
304
|
+ }
|
|
305
|
+ }
|
|
306
|
+
|
210
|
307
|
static bool visibleTex = false;
|
211
|
308
|
static bool visibleTile = false;
|
|
309
|
+ static bool visibleAnim = false;
|
212
|
310
|
if (ImGui::CollapsingHeader("Texture Viewer")) {
|
213
|
311
|
static bool game = getGame().isLoaded();
|
214
|
312
|
static int index = 0;
|
|
@@ -245,6 +343,7 @@ void UI::display() {
|
245
|
343
|
if (ImGui::Button("Show##texshow")) {
|
246
|
344
|
visibleTex = true;
|
247
|
345
|
visibleTile = false;
|
|
346
|
+ visibleAnim = false;
|
248
|
347
|
}
|
249
|
348
|
ImGui::SameLine();
|
250
|
349
|
if (ImGui::Button("Clear##texclear")) {
|
|
@@ -285,6 +384,7 @@ void UI::display() {
|
285
|
384
|
if (ImGui::Button("Show##tileshow")) {
|
286
|
385
|
visibleTile = true;
|
287
|
386
|
visibleTex = false;
|
|
387
|
+ visibleAnim = false;
|
288
|
388
|
}
|
289
|
389
|
ImGui::SameLine();
|
290
|
390
|
if (ImGui::Button("Clear##tileclear")) {
|
|
@@ -301,7 +401,62 @@ void UI::display() {
|
301
|
401
|
(ImGui::GetWindowWidth() / 2), (ImGui::GetWindowWidth() / 2));
|
302
|
402
|
}
|
303
|
403
|
} else {
|
304
|
|
- ImGui::Text("Please load a level!");
|
|
404
|
+ ImGui::Text("Please load a level using the new loader!");
|
|
405
|
+ }
|
|
406
|
+ }
|
|
407
|
+
|
|
408
|
+ if (ImGui::CollapsingHeader("Animated Textile Viewer")) {
|
|
409
|
+ if (getTextureManager().numAnimatedTiles() > 0) {
|
|
410
|
+ static int index = 0;
|
|
411
|
+ static int tile = getTextureManager().getFirstTileAnimation(index);
|
|
412
|
+ ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.5f);
|
|
413
|
+ if (ImGui::SliderInt("##animslide", &index, 0, getTextureManager().numAnimatedTiles() - 1)) {
|
|
414
|
+ tile = getTextureManager().getFirstTileAnimation(index);
|
|
415
|
+ }
|
|
416
|
+ ImGui::PopItemWidth();
|
|
417
|
+ ImGui::SameLine();
|
|
418
|
+ if (ImGui::Button("+##animplus", ImVec2(0, 0), true)) {
|
|
419
|
+ if (index < (getTextureManager().numAnimatedTiles() - 1))
|
|
420
|
+ index++;
|
|
421
|
+ else
|
|
422
|
+ index = 0;
|
|
423
|
+ tile = getTextureManager().getFirstTileAnimation(index);
|
|
424
|
+ }
|
|
425
|
+ ImGui::SameLine();
|
|
426
|
+ if (ImGui::Button("-##animminus", ImVec2(0, 0), true)) {
|
|
427
|
+ if (index > 0)
|
|
428
|
+ index--;
|
|
429
|
+ else
|
|
430
|
+ index = getTextureManager().numAnimatedTiles() - 1;
|
|
431
|
+ tile = getTextureManager().getFirstTileAnimation(index);
|
|
432
|
+ }
|
|
433
|
+ ImGui::SameLine();
|
|
434
|
+ static int fr = 0;
|
|
435
|
+ if (ImGui::Button("Show##animshow")) {
|
|
436
|
+ visibleAnim = true;
|
|
437
|
+ visibleTex = false;
|
|
438
|
+ visibleTile = false;
|
|
439
|
+ }
|
|
440
|
+ ImGui::SameLine();
|
|
441
|
+ if (ImGui::Button("Clear##animclear")) {
|
|
442
|
+ getRender().debugDisplayTextile();
|
|
443
|
+ visibleAnim = false;
|
|
444
|
+ }
|
|
445
|
+ if (visibleAnim) {
|
|
446
|
+ if (fr > 0) {
|
|
447
|
+ fr--;
|
|
448
|
+ } else {
|
|
449
|
+ getRender().debugDisplayTextile(tile,
|
|
450
|
+ ImGui::GetWindowPos().x - (ImGui::GetWindowWidth() / 2),
|
|
451
|
+ ImGui::GetWindowPos().y,
|
|
452
|
+ (ImGui::GetWindowWidth() / 2), (ImGui::GetWindowWidth() / 2));
|
|
453
|
+ fr = getRunTime().getFPS() / 2;
|
|
454
|
+ tile = getTextureManager().getNextTileAnimation(tile);
|
|
455
|
+ }
|
|
456
|
+ ImGui::Text("Current Tile: %d", tile);
|
|
457
|
+ }
|
|
458
|
+ } else {
|
|
459
|
+ ImGui::Text("Please load a level with animated textures!");
|
305
|
460
|
}
|
306
|
461
|
}
|
307
|
462
|
|
|
@@ -339,11 +494,9 @@ void UI::display() {
|
339
|
494
|
}
|
340
|
495
|
}
|
341
|
496
|
|
342
|
|
- /*
|
343
|
|
- if (ImGui::CollapsingHeader("UI Help")) {
|
|
497
|
+ if (ImGui::CollapsingHeader("ImGui UI Help")) {
|
344
|
498
|
ImGui::ShowUserGuide();
|
345
|
499
|
}
|
346
|
|
- */
|
347
|
500
|
}
|
348
|
501
|
ImGui::End();
|
349
|
502
|
|