Debian Codegraph @

src/debug_renderer.cpp

raw
1 #ifdef HAVE_CONFIG_H
2 #include <config.h>
3 #endif
4
5 #include "debug_renderer.h"
6 #include "debug.h"
7 #include "game_state.h"
8 #include "game_engine.h"
9 #include "live_sprites_manager.h"
10 #include "input.h"
11 #include "gfx_fonts.h"
12 #include "log.h"
13
14 void debug_renderer_render() {
15 if (debug_mode)
16 {
17 char msg[100];
18 FONTS_SetTextColor(200, 200, 200);
19 if (mode == 0) strcpy(msg,"");
20 if (mode == 1)
21 {
22 int x;
23 sprintf(msg,"X is %d y is %d FPS: %d", spr[1].x, spr[1].y, fps);
24 //let's add the key info to it.
25 for (x = 0; x < 256; x++)
26 if (input_getcharstate(x))
27 sprintf(msg + strlen(msg), " (Key %i)", x);
28 }
29 if (mode == 3)
30 {
31 sprintf(msg, "Sprites: %d FPS: %d"
32 " Moveman X%d X%d: %d Y%d Y%d Map %d",
33 last_sprite_created, fps/*_show*/,
34 spr[1].lpx[0], spr[1].lpy[0], spr[1].moveman,
35 spr[1].lpx[1], spr[1].lpy[1], *pplayer_map);
36 }
37
38 print_text_wrap_debug(msg, 0, 0);
39 const char* lastLog = log_getLastLog();
40 if (strlen(lastLog) > 0)
41 {
42 //let's also draw this...
43 print_text_wrap_debug(lastLog, 0, 20);
44 }
45 }
46 }