Slowly renaming things from Holdem to Poker

This commit is contained in:
2021-05-17 06:13:50 -07:00
parent 4dbd5acab9
commit 9af4115bad
28 changed files with 253 additions and 223 deletions

View File

@ -32,8 +32,11 @@
#include "input/input.h"
// Poker Game Logic
#include "poker/action.h"
#include "poker/card.h"
#include "poker/holdem.h"
#include "poker/player.h"
#include "poker/poker.h"
#include "poker/render.h"
// Utility Objects
#include "util/list.h"

View File

@ -0,0 +1,25 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "../libs.h"
/** How many actions the queue can hold */
#define POKER_ACTION_QUEUE_SIZE 12
/** How much data (in length of sizeof size_t) each action has available */
#define POKER_ACTION_DATA_SIZE 256
/** Callback for actions to use */
typedef void (*pokerActionCallback)(int32_t index, void *data);
/** Poker Game action that can be queued and executed */
typedef struct {
pokerActionCallback init;
pokerActionCallback update;
pokerActionCallback dispose;
} pokeraction_t;

View File

@ -85,7 +85,6 @@
#define CARD_SUIT_HEARTS 0x03
#define CARD_SUIT_SPADES 0x04
/** Count of cards in each suit */
#define CARD_COUNT_PER_SUIT 13

View File

@ -0,0 +1,37 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "../libs.h"
/** How many cards a player can hold in their hand */
#define POKER_PLAYER_HAND 2
/** How many players in a poker game (excludes dealer) */
#define POKER_PLAYER_COUNT 5
/** State for whether or not a player has folded */
#define POKER_STATE_FOLDED 0x01
/** State for whether or not a player is showing their hand */
#define POKER_STATE_SHOWING 0x02
/** Poker Player State */
typedef struct {
/** Cards in the players' hand */
card_t cards[POKER_PLAYER_HAND];
uint8_t cardCount;
/** Current State of player */
uint8_t state;
/** Chips in players' posession */
uint32_t chips;
/** Current bet in current round player has placed */
uint32_t currentBet;
} pokerplayer_t;

View File

@ -7,36 +7,17 @@
#pragma once
#include "card.h"
#include "player.h"
#include "render.h"
#include "action.h"
#include "../display/render.h"
#include "../display/spritebatch.h"
#include "../display/texture.h"
#include "../display/tileset.h"
#include "../display/framebuffer.h"
/** How many cards a player can hold in their hand */
#define HOLDEM_PLAYER_HAND 2
/** How many cards the dealer can hold in their hand */
#define HOLDEM_DEALER_HAND 5
/** How many players in a holdem game (excludes dealer) */
#define HOLDEM_PLAYER_COUNT 5
/** State for whether or not a player has folded */
#define HOLDEM_STATE_FOLDED 0x01
/** State for whether or not a player is showing their hand */
#define HOLDEM_STATE_SHOWING 0x02
/** Size of the Render frames */
#define HOLDEM_GAME_FRAME_HEIGHT RENDER_STATE.height
#define HOLDEM_GAME_FRAME_LEFT_WIDTH RENDER_STATE.width*0.65
#define HOLDEM_GAME_FRAME_RIGHT_WIDTH (\
RENDER_STATE.width - HOLDEM_GAME_FRAME_LEFT_WIDTH - 1\
)
/** Size of the rendered card */
#define HOLDEM_GAME_CARD_WIDTH 0.04
#define HOLDEM_GAME_CARD_HEIGHT HOLDEM_GAME_CARD_WIDTH/2.5*3.5
#define HOLDEM_GAME_CARD_DEPTH 0.0005
#define HOLDEM_GAME_CARD_PADDING 0.0125
/** Various seats at the table that people can sit */
#define HOLDEM_GAME_SEAT_DEALER 0x00
@ -57,39 +38,6 @@
#define HOLDEM_GAME_CARD_SLOT_FLOP3 0x05
#define HOLDEM_GAME_CARD_SLOT_FLOP4 0x06
/** How many actions the queue can hold */
#define HOLDEM_GAME_ACTION_QUEUE_SIZE 12
/** How much data (in length of sizeof size_t) each action has available */
#define HOLDEM_GAME_ACTION_DATA_SIZE 256
/** Texas Hold'em Player State */
typedef struct {
/** Cards in the players' hand */
card_t cards[HOLDEM_PLAYER_HAND];
uint8_t cardCount;
/** Current State of player */
uint8_t state;
/** Chips in players' posession */
uint32_t chips;
/** Current bet in current round player has placed */
uint32_t currentBet;
} holdemplayer_t;
/** Callback for actions to use */
typedef void (*holdemActionCallback)(int32_t index, void *data);
/** Texas Hold'em Game action that can be queued and executed */
typedef struct {
holdemActionCallback init;
holdemActionCallback update;
holdemActionCallback dispose;
} holdemaction_t;
typedef struct {
/** Current Card Deck */
card_t deck[CARD_DECK_SIZE];
@ -109,10 +57,7 @@ typedef struct {
uint8_t cardsFacing;
/** Player States */
holdemplayer_t players[HOLDEM_PLAYER_COUNT];
pokerplayer_t players[POKER_PLAYER_COUNT];
texture_t *kagamiTexture;
@ -120,9 +65,9 @@ typedef struct {
primitive_t *kagamiQuad;
/** Action and Allocated Data Space */
holdemaction_t actionQueue[HOLDEM_GAME_ACTION_QUEUE_SIZE];
void *actionData[HOLDEM_GAME_ACTION_DATA_SIZE*HOLDEM_GAME_ACTION_QUEUE_SIZE];
bool actionInitState[HOLDEM_GAME_ACTION_DATA_SIZE];
pokeraction_t actionQueue[POKER_ACTION_QUEUE_SIZE];
void *actionData[POKER_ACTION_DATA_SIZE*POKER_ACTION_QUEUE_SIZE];
bool actionInitState[POKER_ACTION_DATA_SIZE];
/** Poker Table */
primitive_t *tablePrimitive;
@ -143,12 +88,6 @@ typedef struct {
primitive_t *quadRight;
camera_t cameraLeft;
camera_t cameraRight;
} holdemgame_t;
} pokergame_t;
typedef struct {
float x, z;
float yaw;
} holdemrenderposition_t;
extern holdemgame_t HOLDEM_GAME_STATE;
extern pokergame_t POKER_STATE;

View File

@ -0,0 +1,27 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "../libs.h"
/** Size of the rendered card */
#define HOLDEM_GAME_CARD_WIDTH 0.04
#define HOLDEM_GAME_CARD_HEIGHT HOLDEM_GAME_CARD_WIDTH/2.5*3.5
#define HOLDEM_GAME_CARD_DEPTH 0.0005
#define HOLDEM_GAME_CARD_PADDING 0.0125
/** Size of the Render frames */
#define HOLDEM_GAME_FRAME_HEIGHT RENDER_STATE.height
#define HOLDEM_GAME_FRAME_LEFT_WIDTH RENDER_STATE.width*0.65
#define HOLDEM_GAME_FRAME_RIGHT_WIDTH (\
RENDER_STATE.width - HOLDEM_GAME_FRAME_LEFT_WIDTH - 1\
)
typedef struct {
float x, z;
float yaw;
} pokerposition_t;