xlib_playground

Xlib playground for experiments.
Log | Files | Refs

commit b33b696dcd353397293eaa2265429792bcbdc95a
parent 8c40f0308e800e124d4fdb1ab2f3f30c5616fb11
Author: Matsuda Kenji <info@mtkn.jp>
Date:   Thu, 29 Dec 2022 10:32:48 +0900

change to use enum

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

diff --git a/ex7/ex7.c b/ex7/ex7.c @@ -123,19 +123,19 @@ char world_map[WORLD_WIDTH * WORLD_HEIGHT + 1] = "........................b.......b......................b...b...................."; /* variables */ -struct rect block[NUM_RECT]; -struct rect player; -int player_is_falling; -int next_menu = START_MENU; -extern int win_width, win_height; +struct rect block[NUM_RECT]; +struct rect player; +int player_is_falling; +enum next_menu next_menu = START_MENU; +extern int win_width, win_height; /* function prototypes */ void cleanup(void); void start_menu(void); void game_play(void); -void receive_events(int[]); -void handle_inputs(int[]); +void receive_events(enum key_state[]); +void handle_inputs(enum key_state[]); void rect_next_tick(struct rect *, long); int rect_test_collision(struct rect *, struct rect *); void rect_handle_collision_mf(struct rect *, struct rect *); @@ -200,7 +200,7 @@ start_menu(void) } void -receive_events(int key_state[]) +receive_events(enum key_state key_state[]) { while (x_pending() > 0) { char c; @@ -263,7 +263,7 @@ receive_events(int key_state[]) } void -handle_inputs(int key_state[]) +handle_inputs(enum key_state key_state[]) { if (key_state[KEY_Q] == KEY_DOWN){ next_menu = GAME_OVER; @@ -556,7 +556,7 @@ update_falling_status(struct rect *player, long ndt) void game_play(void) { - int key_state[NUM_KEY]; + enum key_state key_state[NUM_KEY]; long t0, t1, dt; #ifdef COUNT_FPS int fps_count = 0;