Refactoring structs Part 1

This commit is contained in:
2021-05-20 22:20:52 -07:00
parent c19f7c1083
commit 5ae1f1c0d4
56 changed files with 484 additions and 422 deletions

View File

@ -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.