82 lines
1.7 KiB
C
82 lines
1.7 KiB
C
/**
|
|
* Copyright (c) 2021 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#include "game.h"
|
|
|
|
game_t GAME_STATE;
|
|
pokergame_t POKER_STATE;
|
|
|
|
bool gameInit() {
|
|
// Init the game
|
|
GAME_STATE.name = GAME_NAME;
|
|
|
|
logInit();
|
|
logText("Starting Game");
|
|
|
|
// Init
|
|
gameTimeInit();
|
|
renderInit();
|
|
inputInit();
|
|
|
|
// Load the world shader.
|
|
GAME_STATE.shaderWorld = assetShaderLoad(
|
|
"shaders/textured.vert", "shaders/textured.frag"
|
|
);
|
|
|
|
// Font
|
|
POKER_STATE.fontTexture = assetTextureLoad("font.png");
|
|
POKER_STATE.fontTileset = tilesetCreate(20, 20,
|
|
POKER_STATE.fontTexture->width,
|
|
POKER_STATE.fontTexture->height,
|
|
1, 1, 1, 1
|
|
);
|
|
POKER_STATE.fontBatch = spriteBatchCreate(1024);
|
|
|
|
// Prepare the renderer.
|
|
holdemRenderFrameInit();
|
|
holdemRenderWorldInit();
|
|
holdemRenderPlayerInit();
|
|
holdemRenderCardInit();
|
|
|
|
// Prepare the action manager
|
|
pokerActionInit();
|
|
|
|
// Start the first action
|
|
pokerActionAdd(actionStart());
|
|
|
|
// Init the input manger.
|
|
return true;
|
|
}
|
|
|
|
bool gameUpdate(float platformDelta) {
|
|
gameTimeUpdate(platformDelta);
|
|
renderFrameStart();
|
|
inputUpdate();
|
|
|
|
shaderUse(GAME_STATE.shaderWorld);// TODO: remove
|
|
|
|
// Update the frame buffers and action queue
|
|
holdemRenderFrameUpdate();
|
|
pokerActionUpdate();
|
|
|
|
// Render things on each frame, then render those frames.
|
|
holdemRenderFrameUseLeft();
|
|
holdemRenderWorld();
|
|
holdemRenderFrameUseRight();
|
|
holdemRenderWorld();
|
|
holdemRenderFrameBack();
|
|
|
|
if(inputIsPressed(INPUT_NULL)) return false;
|
|
return true;
|
|
}
|
|
|
|
void gameDispose() {
|
|
pokerActionDispose();
|
|
shaderDispose(GAME_STATE.shaderWorld);
|
|
inputDispose();
|
|
renderDispose();
|
|
} |