xlib_playground

Xlib playground for experiments.
Log | Files | Refs

commit 9a9cbb71d6dc189b217a137baa8928399e812b4b
parent 1807a30ceaeb933c26414f0346e204c40b6042c8
Author: Matsuda Kenji <info@mtkn.jp>
Date:   Fri,  6 Jan 2023 14:01:43 +0900

move functions
so that the order of definitions is the same as
that of prototypes

Diffstat:
Mex9/main.c | 28+++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/ex9/main.c b/ex9/main.c @@ -58,6 +58,9 @@ void game_clear(void); /* events */ void receive_events(enum key_state[]); void handle_inputs(enum key_state[]); +/* collision functions */ +void col_pf(struct Object *, struct Object *); // player-flag +void col_pb(struct Object *, struct Object *); // player-block void start_menu(void) @@ -112,19 +115,6 @@ start_menu(void) } } -void col_pf(struct Object *o0, struct Object *o1) { - handle_collision_mf(o0, o1); - next_menu = GAME_CLEAR; -} - -void col_pb(struct Object *op, struct Object *ob) { - if (op->type != TPLAYER || ob->type != TBLOCK) { - fprintf(stderr, "col_pb: invalid object type\n"); - return; - } - handle_collision_mf(op, ob); -} - void game_play(void) { @@ -438,6 +428,18 @@ handle_inputs(enum key_state key_state[]) } } +void col_pf(struct Object *o0, struct Object *o1) { + handle_collision_mf(o0, o1); + next_menu = GAME_CLEAR; +} + +void col_pb(struct Object *op, struct Object *ob) { + if (op->type != TPLAYER || ob->type != TBLOCK) { + fprintf(stderr, "col_pb: invalid object type\n"); + return; + } + handle_collision_mf(op, ob); +} int main(void)