/** * Copyright (c) 2021 Dominic Masters * * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ #pragma once #include "../libs.h" #include "player.h" #include "card.h" #include "render.h" #include "../display/camera.h" #include "../display/shader.h" #include "../display/texture.h" #include "../display/tileset.h" #include "../display/framebuffer.h" /** Rounds that the game can be in */ #define POKER_ROUND_MATCH 0x00 #define POKER_ROUND_DEAL 0x01 #define POKER_ROUND_BLINDS 0x02 #define POKER_ROUND_BET0 0x03 #define POKER_ROUND_FLOP 0X04 #define POKER_ROUND_BET1 0x05 #define POKER_ROUND_TURN 0x06 #define POKER_ROUND_BET2 0x07 #define POKER_ROUND_RIVER 0x08 #define POKER_ROUND_BET3 0x09 #define POKER_ROUND_WINNER 0x10 /** How many cards the dealer can hold in their hand */ #define POKER_DEALER_HAND 5 /** How many cards the grave can hold */ #define POKER_GRAVE_SIZE CARD_DECK_SIZE /** How many players in a poker game (excludes dealer) */ #define POKER_PLAYER_COUNT 5 /** How many chips each player has by defautl */ #define POKER_PLAYER_CHIPS_DEFAULT 10000 /** The default blind cost for the big blind. Small Blind is half this */ #define POKER_BLIND_BIG_DEFAULT 600 #define POKER_BLIND_SMALL_DEFAULT (POKER_BLIND_BIG_DEFAULT/2) /** GUI Height fix (To keep gui scaling nicely we use a fixed height) */ #define POKER_GUI_HEIGHT 2160 typedef struct { ////////////////////////////////////////////////////////////////////////////// // Poker Logic Variables ////////////////////////////////////////////////////////////////////////////// /** Current Card Deck */ card_t deck[CARD_DECK_SIZE]; uint8_t deckSize; /** Card grave (where spent cards go when burned */ card_t grave[POKER_GRAVE_SIZE]; uint8_t graveSize; /** Blinds */ uint32_t blindSmall, blindBig; /** Dealer Hand */ card_t cards[POKER_DEALER_HAND]; uint8_t cardsFacing; /** Player States */ pokerplayer_t players[POKER_PLAYER_COUNT]; /** The current round the game is on */ uint8_t round; /** The current player that is the dealer */ uint8_t roundDealer; /** Current pot of chips */ uint32_t pot; /** The current buy-in bet size. */ uint32_t roundBet; ////////////////////////////////////////////////////////////////////////////// // Rendering Assets ////////////////////////////////////////////////////////////////////////////// /** Frames to hold the world and GUI render outputs */ framebuffer_t frameWorld, frameGui; /** Game's Font */ font_t font; /** Game's Shader */ shader_t shader; /** Camera for the world and the GUI */ camera_t cameraWorld, cameraGui; /** Refer to POKER_GUI_HEIGHT */ float guiWidth; /** Last frame's GUI width, used to track font wrapping */ float textLastWidth; /** Primitive to hold talking text */ primitive_t talkPrimitive; /** Current spoken text, tracked in-case of re-render */ char *talkText; /** Information about the current rendered text */ fonttextinfo_t *talkTextInfo; texture_t dealerTexture; tileset_t dealerTileset; primitive_t dealerPrimitive; texture_t chipTexture; primitive_t chipPrimitive; texture_t tableTexture; primitive_t tablePrimitive; texture_t cardTexture; tileset_t cardTileset; primitive_t cardPrimitive; } poker_t;