xlib_playground

Xlib playground for experiments.
Log | Files | Refs

commit b16e78a9086da907290ff39cc6321109a4f5d70b
parent 13ccb0ba5bb24f011e9c5a6df75c9fd1a7c51dec
Author: Matsuda Kenji <info@mtkn.jp>
Date:   Sat, 14 Jan 2023 19:19:22 +0900

add debug message

Diffstat:
Mex9/main.c | 11++++-------
1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/ex9/main.c b/ex9/main.c @@ -51,6 +51,7 @@ enum debug_msg { DONFLOOR, DPOS, DVEL, + DMEM, NDMSG, DMAXLEN = 128, }; @@ -278,12 +279,7 @@ game_play(void) } - printf("------------------------\n"); - getrusage(RUSAGE_SELF, &rusage); - printf("0 maxrss: %ld\n", rusage.ru_maxrss); lhandle_collision(ol); - getrusage(RUSAGE_SELF, &rusage); - printf("1 maxrss: %ld\n", rusage.ru_maxrss); } // fix fps @@ -304,11 +300,12 @@ game_play(void) snprintf(debug_msg[DFPS], DMAXLEN, "fps: %d", cur_fps); frame_count = 0; } - } - if (debug) { snprintf(debug_msg[DPOS], DMAXLEN, "pos: (%3.2f, %3.2f)", player->p.x, player->p.y); + + getrusage(RUSAGE_SELF, &rusage); + snprintf(debug_msg[DMEM], DMAXLEN, "mem: %ld", rusage.ru_maxrss); } x_clear_area();