32 lines
625 B
C
32 lines
625 B
C
#include "game.h"
|
|
|
|
game_t * gameInit(char *gameName) {
|
|
// Create the game instance
|
|
game_t *game = malloc(sizeof(game_t));
|
|
if(game == NULL) return NULL;
|
|
|
|
// Setup the renderer
|
|
game->render = renderInit(640, 480, gameName);
|
|
if(game->render == NULL) {
|
|
free(game);
|
|
return NULL;
|
|
}
|
|
|
|
return game;
|
|
}
|
|
|
|
void gameStart(game_t *game) {
|
|
while(!glfwWindowShouldClose(game->render->window)) {
|
|
renderFrame(game->render);
|
|
|
|
glfwSwapBuffers(game->render->window);
|
|
glfwPollEvents();
|
|
}
|
|
}
|
|
|
|
bool gameDispose(game_t *game) {
|
|
if(!renderDispose(game->render)) return false;
|
|
free(game);
|
|
|
|
return true;
|
|
} |