Refactoring structs Part 1
This commit is contained in:
@ -6,7 +6,6 @@
|
||||
#include "glwfwplatform.h"
|
||||
|
||||
GLFWwindow *window = NULL;
|
||||
game_t *runningGame = NULL;
|
||||
|
||||
int32_t main() {
|
||||
// Attempt to init GLFW
|
||||
@ -33,10 +32,13 @@ int32_t main() {
|
||||
glfwSetWindowSizeCallback(window, &glfwOnResize);
|
||||
glfwSetKeyCallback(window, &glfwOnKey);
|
||||
|
||||
glfwSetErrorCallback (&glfwOnError);
|
||||
glfwSetErrorCallback(&glfwOnError);
|
||||
|
||||
// Prepare the game
|
||||
game_t *game = &GAME_STATE;
|
||||
|
||||
// Init the game
|
||||
if(gameInit()) {
|
||||
if(gameInit(game)) {
|
||||
// Bind initial keys
|
||||
inputBind(INPUT_NULL, (inputsource_t)GLFW_KEY_ESCAPE);
|
||||
inputBind(INPUT_DEBUG_UP, (inputsource_t)GLFW_KEY_W);
|
||||
@ -76,13 +78,13 @@ int32_t main() {
|
||||
time = newTime;
|
||||
|
||||
// Tick the engine.
|
||||
if(!gameUpdate(fDelta)) break;
|
||||
if(!gameUpdate(game, fDelta)) break;
|
||||
glfwSwapBuffers(window);
|
||||
sleep(0);//Fixes some weird high CPU bug, not actually necessary.
|
||||
}
|
||||
|
||||
// Game has finished running, cleanup.
|
||||
gameDispose();
|
||||
gameDispose(game);
|
||||
}
|
||||
|
||||
// Terminate the GLFW context.
|
||||
|
Reference in New Issue
Block a user