Refactoring some of the poker game logic again.

This commit is contained in:
2021-07-27 09:49:54 -07:00
parent 2a4b1fa8da
commit cf4d4cd710
36 changed files with 99 additions and 304 deletions

View File

@ -7,20 +7,12 @@
#include "game.h"
testscene_t testScene;
bool gameInit(game_t *game) {
// Init the game
game->name = GAME_NAME;
// Init the engine and the rendering pipeline
engineInit(&game->engine, game);
// Hand off to the poker logic.
testSceneInit(&testScene, game);
// pokerInit(&game->poker, &game->engine);
return true;
// Send off to the game instance
return pokerGameInit(game);
}
bool gameUpdate(game_t *game, float platformDelta) {
@ -28,15 +20,13 @@ bool gameUpdate(game_t *game, float platformDelta) {
engineUpdateStart(&game->engine, game, platformDelta);
// Hand off to the poker logic
testSceneRender(&testScene, game);
// pokerUpdate(&game->poker, &game->engine);
pokerGameUpdate(game);
// Hand back to the engine.
return engineUpdateEnd(&game->engine, game);
}
void gameDispose(game_t *game) {
pokerDispose(&game->poker);
pokerGameDispose(game);
engineDispose(&game->engine, game);
}

View File

@ -6,8 +6,7 @@
#pragma once
#include <dawn/dawn.h>
#include "../engine/engine.h"
#include "../poker/poker.h"
#include "../test/testscene.h"
#include "poker/pokergame.h"
/**
* Initialize the game context.

View File

@ -0,0 +1,23 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "pokergame.h"
bool pokerGameInit(game_t *game) {
// Init the game
game->name = POKER_GAME_NAME;
// Hand off to the poker logic.
pokerInit(&game->pokerGame.poker, &game->engine);
}
void pokerGameUpdate(game_t *game) {
}
void pokerGameDispose(game_t *game) {
}

View File

@ -0,0 +1,30 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include <dawn/dawn.h>
#include "../../poker/poker.h"
/**
* Initializes the game state for the poker game.
*
* @param game Game to initialize.
* @returns True if successful, otherwise false.
*/
bool pokerGameInit(game_t *game);
/**
* Updates the poker game instance.
* @param game Game to update for.
*/
void pokerGameUpdate(game_t *game);
/**
* Disposes a previously initialized poker game instance.
* @param game Game to initialize for.
*/
void pokerGameDispose(game_t *game);