Moved some code around and cleaned things a bit.

This commit is contained in:
2021-02-22 08:08:12 +11:00
parent 424577f835
commit adc7f5e208
14 changed files with 405 additions and 77 deletions

View File

@ -1,39 +0,0 @@
/**
* Copyright (c) 2021 Dominic Msters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "game.h"
typedef struct {
engine_t *engine;
} dawngame_t;
game_t * gameInit(char *gameName) {
// Create the game
dawngame_t *dawn = malloc(sizeof(dawngame_t));
if(dawn == NULL) return NULL;
// Load the game engine
dawn->engine = engineInit("Dawn Game");
if(dawn->engine == NULL) {
free(dawn);
return NULL;
}
// Pass to the main game to handle.
return (game_t *)dawn;
}
void gameStart(game_t *game) {
dawngame_t *dawn = (dawngame_t *)game;
engineStart(dawn->engine);
}
void gameDispose(game_t *game) {
dawngame_t *dawn = (dawngame_t *)game;
engineDispose(dawn->engine);
free(dawn);
}

View File

@ -7,6 +7,7 @@
#pragma once
#include <stdbool.h>
#include "../platform/platform.h"
#include "../engine/engine.h"
/** Information about the current game context. */
@ -14,9 +15,11 @@ typedef void game_t;
/**
* Initialize the game context.
*
* @param platform The platform that the game is running on.
* @return The game instance context.
*/
game_t * gameInit();
game_t * gameInit(platform_t *platform);
/**
* Start the main game loop.