Joining the two logics together slowly.
This commit is contained in:
@ -8,16 +8,45 @@
|
||||
#include "pokergame.h"
|
||||
|
||||
bool pokerGameInit(game_t *game) {
|
||||
pokergame_t *pokerGame = &game->pokerGame;
|
||||
|
||||
// Init the game
|
||||
game->name = POKER_GAME_NAME;
|
||||
|
||||
// Load the Assets
|
||||
pokerGameAssetsInit(&pokerGame->assets);
|
||||
|
||||
// Hand off to the poker logic.
|
||||
pokerInit(&game->pokerGame.poker, &game->engine);
|
||||
}
|
||||
// Prep the VN Conversation Engine.
|
||||
vnSceneInit(&pokerGame->scene, &pokerGame->assets.font);
|
||||
|
||||
vnConversationTalk(&pokerGame->scene.conversation, "Start Match", NULL);
|
||||
pokerActionMatchAdd(&pokerGame->scene.conversation.actionQueue, &pokerGame->poker);
|
||||
vnConversationTalk(&pokerGame->scene.conversation, "Start Round", NULL);
|
||||
pokerActionRoundAdd(&pokerGame->scene.conversation.actionQueue, &pokerGame->poker);
|
||||
vnConversationTalk(&pokerGame->scene.conversation, "Betting Round", NULL);
|
||||
|
||||
// Begin the VN conversation queue.
|
||||
queueNext(&pokerGame->scene.conversation.actionQueue);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void pokerGameUpdate(game_t *game) {
|
||||
pokergame_t *pokerGame;
|
||||
pokerGame = &game->pokerGame;
|
||||
|
||||
// Update the scene
|
||||
vnSceneUpdate(&pokerGame->scene, &game->engine);
|
||||
|
||||
// Bind the shader.
|
||||
shaderUse(&pokerGame->assets.shader);
|
||||
|
||||
// Render the visual novel scene
|
||||
vnSceneRenderWorld(&pokerGame->scene, &game->engine, &pokerGame->assets.shader);
|
||||
vnSceneRenderGui(&pokerGame->scene, &game->engine, &pokerGame->assets.shader);
|
||||
}
|
||||
|
||||
void pokerGameDispose(game_t *game) {
|
||||
|
||||
vnSceneDispose(&game->pokerGame.scene);
|
||||
pokerGameAssetsDispose(&game->pokerGame.assets);
|
||||
}
|
@ -7,7 +7,13 @@
|
||||
|
||||
#pragma once
|
||||
#include <dawn/dawn.h>
|
||||
#include "pokergameassets.h"
|
||||
#include "../../poker/poker.h"
|
||||
#include "../../vn/conversation/talk.h"
|
||||
#include "../../vn/vnscene.h"
|
||||
|
||||
#include "../../poker/actions/match.h"
|
||||
#include "../../poker/actions/round.h"
|
||||
|
||||
/**
|
||||
* Initializes the game state for the poker game.
|
||||
|
20
src/game/poker/pokergameassets.c
Normal file
20
src/game/poker/pokergameassets.c
Normal file
@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
#include "pokergameassets.h"
|
||||
|
||||
bool pokerGameAssetsInit(pokergameassets_t *assets) {
|
||||
assetFontLoad(&assets->font, "fonts/opensans/OpenSans-Bold.ttf");
|
||||
assetShaderLoad(&assets->shader,
|
||||
"shaders/textured.vert", "shaders/textured.frag"
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
void pokerGameAssetsDispose(pokergameassets_t *assets) {
|
||||
shaderDispose(&assets->shader);
|
||||
fontDispose(&assets->font);
|
||||
}
|
13
src/game/poker/pokergameassets.h
Normal file
13
src/game/poker/pokergameassets.h
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* 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 "../../file/asset.h"
|
||||
|
||||
bool pokerGameAssetsInit(pokergameassets_t *assets);
|
||||
void pokerGameAssetsDispose(pokergameassets_t *assets);
|
Reference in New Issue
Block a user