Fix undeclared functions assumed to return int

main
Cameron Murphy Reikes 2 years ago
parent 64a82c2a26
commit 9107643c57

@ -39,6 +39,16 @@ void destroy(struct GameState *gs)
gs->space = NULL; 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) struct Box box_new(struct GameState *gs, V2 pos)
{ {
assert(gs->space != NULL); 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))); 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); cpShape *shape = cpBoxShapeNew(body, BOX_SIZE, BOX_SIZE, 0.0f);
cpSpaceAddShape(gs->space, shape); cpSpaceAddShape(gs->space, shape);
cpBodySetPosition(body, cpv(pos.x, pos.y)); cpBodySetPosition(body, v2_to_cp(pos));
return (struct Box){ return (struct Box){
.body = body, .body = body,
@ -62,15 +72,7 @@ void box_destroy(struct Box *box)
box->body = NULL; 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) V2 box_pos(struct Box box)
{ {

Loading…
Cancel
Save