Window should close change
This commit is contained in:
parent
d260da4c25
commit
5de48b7507
@ -39,6 +39,7 @@ static GameState *init() {
|
||||
SetTargetFPS(TARGET_FPS);
|
||||
|
||||
GameState *state = malloc(sizeof(struct GameApi));
|
||||
state->target_pos = (PointOption){ .tag = NONE };
|
||||
state->num_boids = 16;
|
||||
state->max_speed = 5.0f;
|
||||
state->max_force = 0.05;
|
||||
@ -80,7 +81,7 @@ static void unload(GameState *state) {
|
||||
}
|
||||
|
||||
// We need this so all the raylib state is in the right place
|
||||
static bool should_close() {
|
||||
static bool window_should_close() {
|
||||
return WindowShouldClose();
|
||||
}
|
||||
|
||||
@ -131,5 +132,5 @@ const struct GameApi GAME_API = {
|
||||
.step = step,
|
||||
.unload = unload,
|
||||
.finalize = finalize,
|
||||
.should_close = should_close,
|
||||
.window_should_close = window_should_close,
|
||||
};
|
||||
|
@ -4,7 +4,7 @@ struct GameState;
|
||||
|
||||
typedef struct GameApi {
|
||||
struct GameState *(*init)();
|
||||
bool (*should_close)();
|
||||
bool (*window_should_close)();
|
||||
void (*finalize) (struct GameState *state);
|
||||
void (*reload) (struct GameState *state);
|
||||
void (*unload) (struct GameState *state);
|
||||
|
@ -17,8 +17,6 @@ struct Game {
|
||||
struct GameState* state;
|
||||
};
|
||||
|
||||
#define MAX_EVENTS 1
|
||||
|
||||
void load_game(struct Game* game) {
|
||||
struct stat attr;
|
||||
if ((stat(GAME_LIB, &attr) == 0) && (game->gamelib_id != attr.st_ino)) {
|
||||
@ -55,7 +53,7 @@ int main(void) {
|
||||
struct Game game = {0};
|
||||
while (1) {
|
||||
load_game(&game);
|
||||
if (game.api.should_close()) {
|
||||
if (game.api.window_should_close()) {
|
||||
break;
|
||||
}
|
||||
game.api.step(game.state);
|
||||
|
Loading…
x
Reference in New Issue
Block a user