/** * Copyright (c) 2021 Dominic Masters * * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ #include "game.h" bool gameInstanceInit(pokergame_t *game) { // Load the Assets. pokerGameAssetsInit(&game->assets); // Initialize the Visual Novel Engine. vnSceneInit(&game->scene, &game->assets.font, &game->assets.testTexture ); // Initialize the world pokerWorldInit(game); // Initialize the UI. pokerUiInit(game); // Add the first action, the game action, and then start the action queue. pokerGameActionStartAdd(game); queueNext(&game->scene.conversation.actionQueue); return true; } void gameInstanceUpdate(pokergame_t *game, engine_t *engine) { // Update the VN Engine. vnSceneUpdate(&game->scene, engine); // Update the UI pokerUiUpdate(game, engine); // Bind the shader. shaderUse(&game->assets.shader); // Render the visual novel scene. vnSceneRenderWorld(&game->scene, engine, &game->assets.shader); pokerWorldRender(&game->world, engine, &game->assets); vnSceneRenderCharacters(&game->scene, &game->assets.shader); // Render the UI vnSceneRenderGui(&game->scene, engine, &game->assets.shader); pokerUiRender(game, engine); } void gameInstanceDispose(pokergame_t *game) { //Cleanup the UI pokerUiDispose(game); // Cleanup the world pokerWorldDispose(game); // Destroy the Visual Novel engine. vnSceneDispose(&game->scene); // Unload all assets pokerGameAssetsDispose(&game->assets); } void pokerGameQueueRestack(pokergame_t *pokerGame) { arrayRewind( sizeof(pokergameactiondata_t), pokerGame->actionData, ANIMATION_QUEUE_ITEM_MAX, pokerGame->scene.conversation.actionQueue.current, pokerGame->scene.conversation.actionQueue.count ); queueRestack(&pokerGame->scene.conversation.actionQueue); }