diff --git a/src/card/action/round.h b/src/card/action/round.h index 57f4fd2e..5e88e5ad 100644 --- a/src/card/action/round.h +++ b/src/card/action/round.h @@ -7,7 +7,7 @@ #pragma once #include -#include "../render/holdemrender.h" +#include "../render/look.h" #include "../../debug/log.h" #include "../holdem.h" #include "action.h" diff --git a/src/card/holdemgame.c b/src/card/holdemgame.c index 1bf1427d..df7f58ca 100644 --- a/src/card/holdemgame.c +++ b/src/card/holdemgame.c @@ -9,8 +9,20 @@ holdemgame_t HOLDEM_GAME_STATE; void holdemGameInit() { + // Font + HOLDEM_GAME_STATE.fontTexture = assetTextureLoad("font.png"); + HOLDEM_GAME_STATE.fontTileset = tilesetCreate(20, 20, + HOLDEM_GAME_STATE.fontTexture->width, + HOLDEM_GAME_STATE.fontTexture->height, + 1, 1, 1, 1 + ); + HOLDEM_GAME_STATE.fontBatch = spriteBatchCreate(1024); + // Prepare the renderer. - holdemRenderInit(); + holdemRenderFrameInit(); + holdemRenderSceneInit(); + holdemRenderPlayerInit(); + holdemRenderCardInit(); // Prepare the action manager holdemActionInit(); @@ -20,8 +32,20 @@ void holdemGameInit() { } void holdemGameUpdate() { + // Update the frame buffers and action queue + holdemRenderFrameUpdate(); holdemActionUpdate(); - holdemRender(); + + // Render things on the left frame buffer + holdemRenderFrameUseLeft(); + holdemRenderWorld(); + + // Render things on the right frame buffer + holdemRenderFrameUseRight(); + holdemRenderWorld(); + + // Finally, render the frame buffers to the back buffer. + holdemRenderFrameBack(); } void holdemGameDispose() { diff --git a/src/card/holdemgame.h b/src/card/holdemgame.h index 170c9bcf..32c0bba3 100644 --- a/src/card/holdemgame.h +++ b/src/card/holdemgame.h @@ -7,13 +7,18 @@ #pragma once #include -#include "holdem.h" -#include "render/holdemrender.h" -#include "card.h" #include "../file/asset.h" #include "../display/gui/font.h" +#include "holdem.h" +#include "card.h" #include "action/action.h" #include "action/start.h" +#include "render/player.h" +#include "render/card.h" +#include "render/frame.h" +#include "render/look.h" +#include "render/scene.h" +#include "render/world.h" /** * Initializes the Texas Hold'em game diff --git a/src/card/render/holdemrender.h b/src/card/render/holdemrender.h deleted file mode 100644 index 289b9def..00000000 --- a/src/card/render/holdemrender.h +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright (c) 2021 Dominic Masters - * - * This software is released under the MIT License. - * https://opensource.org/licenses/MIT - */ - -#pragma once -#include -#include "../../display/shader.h" -#include "../../display/primitive.h" -#include "../../display/primitives/quad.h" -#include "../../display/spritebatch.h" -#include "../../display/gui/font.h" -#include "../../display/framebuffer.h" -#include "../../display/camera.h" -#include "../../display/primitives/cube.h" -#include "../../display/tileset.h" -#include "../model/pokertable.h" - -#include "player.h" -#include "card.h" -#include "frame.h" -#include "look.h" -#include "scene.h" - -/** - * Prepare the Hold'em Game Renderer. - */ -void holdemRenderInit(); - -/** - * Render the Texas Hold'em Game. - */ -void holdemRender(); - -void holdemRenderWorld(); \ No newline at end of file diff --git a/src/card/render/player.h b/src/card/render/player.h index 643a18c7..6cf69592 100644 --- a/src/card/render/player.h +++ b/src/card/render/player.h @@ -7,8 +7,10 @@ #pragma once #include +#include "../../file/asset.h" #include "../../display/shader.h" #include "../../display/primitive.h" +#include "../../display/tileset.h" #include "../../display/primitives/quad.h" /** diff --git a/src/card/render/holdemrender.c b/src/card/render/world.c similarity index 54% rename from src/card/render/holdemrender.c rename to src/card/render/world.c index 122e97f2..f819c85b 100644 --- a/src/card/render/holdemrender.c +++ b/src/card/render/world.c @@ -5,38 +5,7 @@ * https://opensource.org/licenses/MIT */ -#include "holdemrender.h" - -void holdemRenderInit() { - // Font - HOLDEM_GAME_STATE.fontTexture = assetTextureLoad("font.png"); - HOLDEM_GAME_STATE.fontTileset = tilesetCreate(20, 20, - HOLDEM_GAME_STATE.fontTexture->width, - HOLDEM_GAME_STATE.fontTexture->height, - 1, 1, 1, 1 - ); - HOLDEM_GAME_STATE.fontBatch = spriteBatchCreate(1024); - - holdemRenderFrameInit(); - holdemRenderSceneInit(); - holdemRenderPlayerInit(); - holdemRenderCardInit(); -} - -void holdemRender() { - holdemRenderFrameUpdate(); - - // Render things on the left frame buffer - holdemRenderFrameUseLeft(); - holdemRenderWorld(); - - // Render things on the right frame buffer - holdemRenderFrameUseRight(); - holdemRenderWorld(); - - // Finally, render the frame buffers to the back buffer. - holdemRenderFrameBack(); -} +#include "world.h" void holdemRenderWorld() { uint8_t i, j; @@ -67,4 +36,4 @@ void holdemRenderWorld() { holdemRenderCardForSeat(seat, player->cards[j], HOLDEM_GAME_CARD_SLOT_HAND0+j); } } -} +} \ No newline at end of file diff --git a/src/card/render/world.h b/src/card/render/world.h new file mode 100644 index 00000000..03553039 --- /dev/null +++ b/src/card/render/world.h @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2021 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#pragma once +#include +#include "player.h" +#include "scene.h" +#include "card.h" + +/** + * Renders the world. + */ +void holdemRenderWorld(); \ No newline at end of file