xlib_playground

Xlib playground for experiments.
Log | Files | Refs

commit de985dfacdce7d29ee08180d5a015a803e7e6e34
parent baca3d925f22efd7fec0a6f2107ad2a78a4b041a
Author: Matsuda Kenji <info@mtkn.jp>
Date:   Fri, 30 Dec 2022 08:25:55 +0900

rename a macro

Diffstat:
Mex7/ex7.c | 12++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/ex7/ex7.c b/ex7/ex7.c @@ -11,7 +11,7 @@ /* macros */ #define FPS (60) #define SUB_TICK (4) -#define NUM_RECT (200) +#define NUM_BLOCK (200) #define GRAVITY (1000) #define max(a, b) ((a) > (b) ? (a) : (b)) #define min(a, b) ((a) < (b) ? (a) : (b)) @@ -39,7 +39,7 @@ enum next_menu { }; /* variables */ -struct Object block[NUM_RECT]; +struct Object block[NUM_BLOCK]; struct Object player; int player_is_falling; enum next_menu next_menu = START_MENU; @@ -154,7 +154,7 @@ game_play(void) t0 = ts.tv_nsec; for (int k = 0; k < SUB_TICK; k++) { - player_is_falling = object_is_falling(&player, block, NUM_RECT); + player_is_falling = object_is_falling(&player, block, NUM_BLOCK); if (player_is_falling) player.a.y = GRAVITY; else @@ -177,10 +177,10 @@ game_play(void) } - for (int i = 0; i < NUM_RECT; i++) + for (int i = 0; i < NUM_BLOCK; i++) next_tick(&block[i], 1e9 / FPS / SUB_TICK); - for (int i = 0; i < NUM_RECT; i++) + for (int i = 0; i < NUM_BLOCK; i++) handle_collision_mf(&player, &block[i]); } @@ -203,7 +203,7 @@ game_play(void) #endif x_clear_area(); - for (int i = 0; i < NUM_RECT; i++) { + for (int i = 0; i < NUM_BLOCK; i++) { x_draw_rectangle(0x00FF00, block[i].p.x, block[i].p.y, // position block[i].body.rectangle.w,