Restored some of the rendering

This commit is contained in:
2021-05-22 14:18:23 -07:00
parent 58e86d160e
commit d84e760c34
36 changed files with 813 additions and 331 deletions

View File

@ -11,6 +11,6 @@
* how the renderer is currently set up.
*/
typedef struct {
/** Resolution (in pixels) */
int32_t width, height;
/** Resolution (in pixels). Floats to allow subpixels in future. */
float width, height;
} render_t;

View File

@ -8,26 +8,21 @@
#pragma once
#include "../libs.h"
#include "card.h"
#include "../display/texture.h"
#include "../display/primitive.h"
#include "../display/tileset.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_PLAYER_STATE_FOLDED 0x01
/** State for whether or not a player is showing their hand */
#define POKER_PLAYER_STATE_SHOWING 0x02
/** Various seats at the table that people can sit */
#define HOLDEM_GAME_SEAT_DEALER 0x00
#define HOLDEM_GAME_SEAT_PLAYER0 0x04
#define HOLDEM_GAME_SEAT_PLAYER1 0x06
#define HOLDEM_GAME_SEAT_PLAYER2 0x05
#define HOLDEM_GAME_SEAT_PLAYER3 0x03
#define HOLDEM_GAME_SEAT_PLAYER4 0x02
/** State for whether or not the player is out */
#define POKER_PLAYER_STATE_OUT 0x04
/** Poker Player State */
typedef struct {
@ -43,4 +38,10 @@ typedef struct {
/** Current bet in current round player has placed */
uint32_t currentBet;
// Rendering assets
texture_t bodyTexture;
primitive_t bodyPrimitive;
texture_t faceTexture;
primitive_t facePrimitive;
} pokerplayer_t;

View File

@ -9,13 +9,12 @@
#include "../libs.h"
#include "player.h"
#include "card.h"
#include "render.h"
#include "../display/tileset.h"
#include "../display/primitive.h"
#include "../display/texture.h"
#include "../display/shader.h"
#include "../display/camera.h"
#include "../display/spritebatch.h"
#include "../display/shader.h"
#include "../display/texture.h"
#include "../display/tileset.h"
/** Rounds that the game can be in */
#define POKER_ROUND_DEAL 0x00
@ -32,14 +31,30 @@
/** 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)
typedef struct {
/** Current Card Deck */
card_t deck[CARD_DECK_SIZE];
uint8_t deckSize;
/** Dealer Money */
uint32_t blindSmall;
uint32_t blindBig;
/** 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];
@ -48,37 +63,33 @@ typedef struct {
/** Player States */
pokerplayer_t players[POKER_PLAYER_COUNT];
/** Game State */
/** The current round the game is on */
uint8_t round;
uint8_t roundPlayer;
/** 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 */
texture_t *kagamiTexture;
tileset_t *kagamiTileset;
primitive_t *kagamiQuad;
texture_t dealerTexture;
tileset_t dealerTileset;
primitive_t dealerPrimitive;
primitive_t *chipPrimitive;
texture_t *chipTexture;
primitive_t *tablePrimitive;
texture_t *tableTexture;
texture_t chipTexture;
primitive_t chipPrimitive;
texture_t tableTexture;
primitive_t tablePrimitive;
texture_t *cardTexture;
tileset_t *cardTileset;
primitive_t *cardPrimitive;
texture_t cardTexture;
tileset_t cardTileset;
primitive_t cardPrimitive;
texture_t *fontTexture;
tileset_t *fontTileset;
spritebatch_t *fontBatch;
shader_t *shaderWorld;
framebuffer_t *frameLeft;
framebuffer_t *frameRight;
primitive_t *quadLeft;
primitive_t *quadRight;
camera_t cameraMain;
camera_t cameraLeft;
camera_t cameraRight;
shader_t shader;
camera_t camera;
} poker_t;

View File

@ -8,34 +8,45 @@
#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
#include "../display/tileset.h"
#include "../display/primitive.h"
#include "../display/texture.h"
#include "../display/shader.h"
#include "../display/camera.h"
#include "../display/spritebatch.h"
/** 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\
#define POKER_FRAME_HEIGHT RENDER_STATE.height
#define POKER_FRAME_LEFT_WIDTH RENDER_STATE.width*0.65
#define POKER_FRAME_RIGHT_WIDTH (\
RENDER_STATE.width - POKER_FRAME_LEFT_WIDTH - 1\
)
/** Size of the rendered card */
#define POKER_CARD_WIDTH 0.04
#define POKER_CARD_HEIGHT POKER_CARD_WIDTH/2.5*3.5
#define POKER_CARD_DEPTH 0.0005
#define POKER_CARD_PADDING 0.0125
/** Macro for the angle (Yaw) that the seat has */
#define HOLDEM_GAME_SEAT_ANGLE(seat) mathDeg2Rad(-45 * seat)
#define POKER_SEAT_ANGLE(seat) mathDeg2Rad(-45 * seat)
#define HOLDEM_GAME_CARD_SLOT_HAND0 0x00
#define HOLDEM_GAME_CARD_SLOT_HAND1 0x01
#define HOLDEM_GAME_CARD_SLOT_FLOP0 0x02
#define HOLDEM_GAME_CARD_SLOT_FLOP1 0x03
#define HOLDEM_GAME_CARD_SLOT_FLOP2 0x04
#define HOLDEM_GAME_CARD_SLOT_FLOP3 0x05
#define HOLDEM_GAME_CARD_SLOT_FLOP4 0x06
/** Slots where cards can render */
#define POKER_CARD_SLOT_HAND0 0x00
#define POKER_CARD_SLOT_HAND1 0x01
#define POKER_CARD_SLOT_FLOP0 0x02
#define POKER_CARD_SLOT_FLOP1 0x03
#define POKER_CARD_SLOT_FLOP2 0x04
#define POKER_CARD_SLOT_FLOP3 0x05
#define POKER_CARD_SLOT_FLOP4 0x06
#define HOLDEM_GAME_CHIP_STACK0 0x00
#define HOLDEM_GAME_CHIP_STACK1 0x01
#define HOLDEM_GAME_CHIP_STACK2 0x03
#define HOLDEM_GAME_CHIP_STACK3 0x04
/** Various seats at the table that people can sit */
#define POKER_SEAT_DEALER 0x00
#define POKER_SEAT_PLAYER0 0x04
#define POKER_SEAT_PLAYER1 0x06
#define POKER_SEAT_PLAYER2 0x05
#define POKER_SEAT_PLAYER3 0x03
#define POKER_SEAT_PLAYER4 0x02
typedef struct {
float x, z;