From 9107643c576366c269eef04dea6a548223c63f41 Mon Sep 17 00:00:00 2001 From: Cameron Reikes Date: Thu, 20 Oct 2022 07:04:44 -0700 Subject: [PATCH] Fix undeclared functions assumed to return int --- gamestate.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/gamestate.c b/gamestate.c index 5881f86..612dd45 100644 --- a/gamestate.c +++ b/gamestate.c @@ -39,6 +39,16 @@ void destroy(struct GameState *gs) gs->space = NULL; } +static V2 cp_to_v2(cpVect v) +{ + return (V2){.x = v.x, .y = v.y}; +} + +static cpVect v2_to_cp(V2 v) +{ + return cpv(v.x, v.y); +} + struct Box box_new(struct GameState *gs, V2 pos) { assert(gs->space != NULL); @@ -46,7 +56,7 @@ struct Box box_new(struct GameState *gs, V2 pos) cpBody *body = cpSpaceAddBody(gs->space, cpBodyNew(BOX_MASS, cpMomentForBox(BOX_MASS, BOX_SIZE, BOX_SIZE))); cpShape *shape = cpBoxShapeNew(body, BOX_SIZE, BOX_SIZE, 0.0f); cpSpaceAddShape(gs->space, shape); - cpBodySetPosition(body, cpv(pos.x, pos.y)); + cpBodySetPosition(body, v2_to_cp(pos)); return (struct Box){ .body = body, @@ -62,15 +72,7 @@ void box_destroy(struct Box *box) box->body = NULL; } -static V2 cp_to_v2(cpVect v) -{ - return (V2){.x = v.x, .y = v.y}; -} -static cpVect v2_to_cp(V2 v) -{ - return cpv(v.x, v.y); -} V2 box_pos(struct Box box) {