Even more refactoring.
This commit is contained in:
@ -24,7 +24,7 @@ void renderInit() {
|
||||
|
||||
void renderFrameStart(render_t *render) {
|
||||
// Clear the frame buffer.
|
||||
frameBufferUnbind(render->width, render->height, true);
|
||||
renderResetFramebuffer(render);
|
||||
}
|
||||
|
||||
void renderDispose() {
|
||||
@ -34,4 +34,8 @@ void renderDispose() {
|
||||
void renderSetResolution(render_t *render, float width, float height) {
|
||||
render->width = width;
|
||||
render->height = height;
|
||||
}
|
||||
|
||||
void renderResetFramebuffer(render_t *render) {
|
||||
frameBufferUnbind(render->width, render->height, true);
|
||||
}
|
@ -40,4 +40,11 @@ void renderDispose();
|
||||
* @param width Width of the display (in pixels).
|
||||
* @param height Height of the display (in pixels).
|
||||
*/
|
||||
void renderSetResolution(render_t *render, float width, float height);
|
||||
void renderSetResolution(render_t *render, float width, float height);
|
||||
|
||||
/**
|
||||
* Reset the framebuffer back to the original backbuffer.
|
||||
*
|
||||
* @param render Render to reset the backbuffer to.
|
||||
*/
|
||||
void renderResetFramebuffer(render_t *render);
|
@ -51,7 +51,7 @@ void renderListRenderPass(
|
||||
item->onRender(list, renderPass, engine, i);
|
||||
}
|
||||
|
||||
frameBufferUnbind(engine->render.width, engine->render.height, false);
|
||||
renderResetFramebuffer(&engine->render);
|
||||
}
|
||||
|
||||
void renderListRender(renderlist_t *list, engine_t *engine, shader_t *shader) {
|
||||
@ -78,6 +78,5 @@ void renderListRender(renderlist_t *list, engine_t *engine, shader_t *shader) {
|
||||
primitiveDraw(&list->quad, 0, -1);
|
||||
}
|
||||
|
||||
// Unbind the framebuffer.
|
||||
frameBufferUnbind(engine->render.width, engine->render.height, false);
|
||||
renderResetFramebuffer(&engine->render);
|
||||
}
|
@ -14,6 +14,7 @@
|
||||
#include "../engine/engine.h"
|
||||
#include "primitives/quad.h"
|
||||
#include "../util/dynarray.h"
|
||||
#include "render.h"
|
||||
|
||||
typedef struct {
|
||||
framebuffer_t frame;
|
||||
|
@ -9,44 +9,26 @@
|
||||
|
||||
bool gameInit(game_t *game) {
|
||||
// Init the engine and the rendering pipeline
|
||||
engineInit(&game->engine, game);
|
||||
engineInit(&game->engine);
|
||||
|
||||
// Send off to the game instance
|
||||
#if SETTING_GAME == SETTING_GAME_POKER
|
||||
return pokerGameInit(&game->pokerGame, &game->engine);
|
||||
#elif SETTING_GAME == SETTING_GAME_DAWN
|
||||
return dawnGameInit(game);
|
||||
#elif SETTING_GAME == SETTING_GAME_SANDBOX
|
||||
return sandboxSceneInit(&game->sandboxScene, &game->engine);
|
||||
#endif
|
||||
return gameInstanceInit(game);
|
||||
}
|
||||
|
||||
bool gameUpdate(game_t *game, float platformDelta) {
|
||||
// Let the engine do its thing.
|
||||
engineUpdateStart(&game->engine, game, platformDelta);
|
||||
engineUpdateStart(&game->engine, platformDelta);
|
||||
|
||||
// Hand off to the game's logic
|
||||
#if SETTING_GAME == SETTING_GAME_POKER
|
||||
pokerGameUpdate(&game->pokerGame, &game->engine);
|
||||
#elif SETTING_GAME == SETTING_GAME_DAWN
|
||||
dawnGameUpdate(game);
|
||||
#elif SETTING_GAME == SETTING_GAME_SANDBOX
|
||||
sandboxSceneUpdate(&game->sandboxScene, &game->engine);
|
||||
#endif
|
||||
// Hand off to the game to update
|
||||
gameInstanceUpdate(game);
|
||||
|
||||
// Hand back to the engine.
|
||||
return engineUpdateEnd(&game->engine, game);
|
||||
return engineUpdateEnd(&game->engine);
|
||||
}
|
||||
|
||||
void gameDispose(game_t *game) {
|
||||
// Cleanup the game
|
||||
#if SETTING_GAME == SETTING_GAME_POKER
|
||||
pokerGameDispose(&game->pokerGame);
|
||||
#elif SETTING_GAME == SETTING_GAME_DAWN
|
||||
dawnGameDispose(game);
|
||||
#elif SETTING_GAME == SETTING_GAME_SANDBOX
|
||||
return sandboxSceneDispose(&game->sandboxScene);
|
||||
#endif
|
||||
gameInstanceDispose(game);
|
||||
|
||||
engineDispose(&game->engine, game);
|
||||
engineDispose(&game->engine);
|
||||
}
|
@ -10,13 +10,13 @@
|
||||
|
||||
/** Describes the current game */
|
||||
#if SETTING_GAME == SETTING_GAME_POKER
|
||||
#include "poker/pokergame.h"
|
||||
#include "poker/game.h"
|
||||
typedef pokergame_t game_t;
|
||||
#elif SETTING_GAME == SETTING_GAME_DAWN
|
||||
#include "dawn/dawngame.h"
|
||||
#include "dawn/game.h"
|
||||
typedef dawngame_t game_t;
|
||||
#elif SETTING_GAME == SETTING_GAME_SANDBOX
|
||||
#include "sandbox/sandboxscene.h"
|
||||
#include "sandbox/game.h"
|
||||
typedef sandboxscene_t game_t;
|
||||
#endif
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "../../../poker/actions/round.h"
|
||||
#include "../../../poker/actions/blinds.h"
|
||||
#include "../../../poker/actions/deal.h"
|
||||
#include "../discussion/pokerdiscussion.h"
|
||||
#include "../pokerdiscussion.h"
|
||||
#include "bet.h"
|
||||
|
||||
/** Callback that is fired when the round start event starts. */
|
||||
|
@ -10,6 +10,8 @@
|
||||
#include "../../../vn/conversation/talk.h"
|
||||
#include "../../../display/animation/queue.h"
|
||||
#include "../../../poker/actions/match.h"
|
||||
#include "../pokerdiscussion.h"
|
||||
#include "round.h"
|
||||
#include "action.h"
|
||||
|
||||
/** Callback fired when the game action first starts */
|
||||
|
@ -5,11 +5,9 @@
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#include "pokergame.h"
|
||||
|
||||
bool pokerGameInit(pokergame_t *game, engine_t *engine) {
|
||||
game->engine = engine;
|
||||
#include "game.h"
|
||||
|
||||
bool gameInstanceInit(pokergame_t *game) {
|
||||
// Load the Assets.
|
||||
pokerGameAssetsInit(&game->assets);
|
||||
|
||||
@ -32,7 +30,7 @@ bool pokerGameInit(pokergame_t *game, engine_t *engine) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void pokerGameUpdate(pokergame_t *game, engine_t *engine) {
|
||||
void gameInstanceUpdate(pokergame_t *game, engine_t *engine) {
|
||||
// Update the VN Engine.
|
||||
vnSceneUpdate(&game->scene, engine);
|
||||
|
||||
@ -54,7 +52,7 @@ void pokerGameUpdate(pokergame_t *game, engine_t *engine) {
|
||||
pokerUiRender(game, engine);
|
||||
}
|
||||
|
||||
void pokerGameDispose(pokergame_t *game) {
|
||||
void gameInstanceDispose(pokergame_t *game) {
|
||||
//Cleanup the UI
|
||||
pokerUiDispose(game);
|
||||
|
45
src/game/poker/game.h
Normal file
45
src/game/poker/game.h
Normal file
@ -0,0 +1,45 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "pokergame.h"
|
||||
#include "../../libs.h"
|
||||
#include "pokergameassets.h"
|
||||
#include "../../poker/poker.h"
|
||||
#include "../../vn/conversation/talk.h"
|
||||
#include "../../vn/vnscene.h"
|
||||
#include "../../util/array.h"
|
||||
#include "pokerui.h"
|
||||
#include "pokerworld.h"
|
||||
#include "pokergameaction.h"
|
||||
|
||||
/**
|
||||
* Initializes the game state for the poker game.
|
||||
*
|
||||
* @param game Game to initialize.
|
||||
* @returns True if successful, otherwise false.
|
||||
*/
|
||||
bool gameInstanceInit(pokergame_t *game);
|
||||
|
||||
/**
|
||||
* Updates the poker game instance.
|
||||
* @param game Poker game to update for.
|
||||
*/
|
||||
void gameInstanceUpdate(pokergame_t *game);
|
||||
|
||||
/**
|
||||
* Disposes a previously initialized poker game instance.
|
||||
* @param game Game to dispose.
|
||||
*/
|
||||
void gameInstanceDispose(pokergame_t *game);
|
||||
|
||||
/**
|
||||
* Restacks the poker game's stack.
|
||||
*
|
||||
* @param game Poker game to restack
|
||||
*/
|
||||
void pokerGameQueueRestack(pokergame_t *game);
|
@ -12,32 +12,10 @@
|
||||
#include "../../vn/conversation/talk.h"
|
||||
#include "../../vn/vnscene.h"
|
||||
#include "../../util/array.h"
|
||||
#include "ui/pokerui.h"
|
||||
#include "pokerui.h"
|
||||
#include "pokerworld.h"
|
||||
#include "pokergameaction.h"
|
||||
|
||||
#define POKER_GAME_SEAT_COUNT 8
|
||||
#define POKER_GAME_SEAT_FOR_PLAYER(p) (p - (POKER_PLAYER_COUNT/2))
|
||||
#define POKER_GAME_SEAT_DEALER POKER_GAME_SEAT_FOR_PLAYER(POKER_DEALER_INDEX)
|
||||
|
||||
/**
|
||||
* Return the seat for a given player index, also works for the dealer index.
|
||||
* @param i The players index.
|
||||
* @return The players seat number.
|
||||
*/
|
||||
#define pokerGameSeatFromIndex(i) (\
|
||||
i == POKER_DEALER_INDEX ? \
|
||||
POKER_GAME_SEAT_DEALER : \
|
||||
POKER_GAME_SEAT_FOR_PLAYER(i) \
|
||||
)
|
||||
|
||||
#define POKER_GAME_PENNY_BASE_WIDTH 1000
|
||||
#define POKER_GAME_PENNY_BASE_HEIGHT 1920
|
||||
#define POKER_GAME_PENNY_FACE_X 367
|
||||
#define POKER_GAME_PENNY_FACE_Y 256
|
||||
#define POKER_GAME_PENNY_FACE_WIDTH 280
|
||||
#define POKER_GAME_PENNY_FACE_HEIGHT 280
|
||||
|
||||
typedef struct {
|
||||
/** Game Engine Instance */
|
||||
engine_t engine;
|
||||
@ -59,33 +37,4 @@ typedef struct {
|
||||
|
||||
/** Data for the actions */
|
||||
pokergameactiondata_t actionData[ANIMATION_QUEUE_ITEM_MAX];
|
||||
} pokergame_t;
|
||||
|
||||
/**
|
||||
* Initializes the game state for the poker game.
|
||||
*
|
||||
* @param game Game to initialize.
|
||||
* @param engine Engine to use when initializing.
|
||||
* @returns True if successful, otherwise false.
|
||||
*/
|
||||
bool pokerGameInit(pokergame_t *game, engine_t *engine);
|
||||
|
||||
/**
|
||||
* Updates the poker game instance.
|
||||
* @param game Poker game to update for.
|
||||
* @param engine Engine to use during update.
|
||||
*/
|
||||
void pokerGameUpdate(pokergame_t *game, engine_t *engine);
|
||||
|
||||
/**
|
||||
* Disposes a previously initialized poker game instance.
|
||||
* @param game Game to dispose.
|
||||
*/
|
||||
void pokerGameDispose(pokergame_t *game);
|
||||
|
||||
/**
|
||||
* Restacks the poker game's stack.
|
||||
*
|
||||
* @param pokerGame Poker game to restack
|
||||
*/
|
||||
void pokerGameQueueRestack(pokergame_t *pokerGame);
|
||||
} pokergame_t;
|
200
src/game/poker/pokerui.c
Normal file
200
src/game/poker/pokerui.c
Normal file
@ -0,0 +1,200 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#include "pokerui.h"
|
||||
|
||||
void pokerUiInit(pokerui_t *ui) {
|
||||
uint8_t i;
|
||||
|
||||
// Initialize card render(s)
|
||||
imageInit(&ui->card);
|
||||
|
||||
// Initialize the player face quad.
|
||||
quadInit(&ui->quad, 0,
|
||||
0, 0, 0, 1,
|
||||
POKER_UI_PLAYER_IMAGE_SIZE, POKER_UI_PLAYER_IMAGE_SIZE, 1, 0
|
||||
);
|
||||
|
||||
// Initialize the grid
|
||||
gridInit(&ui->grid);
|
||||
|
||||
ui->grid.gutterX = POKER_UI_PLAYER_PADDING;
|
||||
ui->grid.columns = 2;
|
||||
ui->grid.rows = 2;
|
||||
ui->grid.columnDefinitions[1] = POKER_UI_PLAYER_IMAGE_SIZE;
|
||||
ui->grid.rowDefinitions[0] = POKER_UI_PLAYER_IMAGE_SIZE / 2.0f;
|
||||
ui->grid.rowDefinitions[1] = POKER_UI_PLAYER_IMAGE_SIZE / 2.0f;
|
||||
|
||||
gridResize(&ui->grid, POKER_UI_PLAYER_WIDTH, POKER_UI_PLAYER_HEIGHT);
|
||||
|
||||
// Initialize the label
|
||||
labelInit(&ui->label);
|
||||
|
||||
// Initialize the frames for each player.
|
||||
for(i = 0; i < POKER_PLAYER_COUNT; i++) {
|
||||
frameBufferInit(ui->frames + i,
|
||||
POKER_UI_PLAYER_IMAGE_RESOLUTION,
|
||||
POKER_UI_PLAYER_IMAGE_RESOLUTION
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void pokerUiUpdate(
|
||||
pokerui_t *ui, engine_t *engine, shader_t *shader,
|
||||
vncharacter_t *characters, pokerplayer_t *players
|
||||
) {
|
||||
uint8_t i, j;
|
||||
camera_t camera;
|
||||
uint8_t seat;
|
||||
float x, y, z;
|
||||
pokerplayer_t *player;
|
||||
|
||||
// Set up the camera perspective
|
||||
cameraPerspective(&camera, 45,
|
||||
(float)POKER_UI_PLAYER_IMAGE_SIZE / (float)POKER_UI_PLAYER_IMAGE_SIZE,
|
||||
0.03f, 10.0f
|
||||
);
|
||||
|
||||
// Render the face of each player.
|
||||
j = 0;
|
||||
for(i = 0; i < POKER_PLAYER_COUNT; i++) {
|
||||
if(i == POKER_PLAYER_HUMAN_INDEX) continue;
|
||||
player = players + j;
|
||||
|
||||
// Locate the XYZ position of the camera to look at the player
|
||||
seat = pokerGameSeatFromIndex(i);
|
||||
x = POKER_WORLD_SEAT_POSITION_X(seat);
|
||||
y = POKER_UI_PLAYER_IMAGE_Y;
|
||||
z = POKER_WORLD_SEAT_POSITION_Z(seat);
|
||||
|
||||
cameraLookAt(&camera,
|
||||
x * POKER_UI_PLAYER_IMAGE_DIST, y, z * POKER_UI_PLAYER_IMAGE_DIST,
|
||||
x, y, z
|
||||
);
|
||||
|
||||
// Bind the frame buffer
|
||||
frameBufferUse(&ui->frames + j, true);
|
||||
|
||||
// Render the VN character
|
||||
shaderUse(shader);
|
||||
shaderUseCamera(shader, &camera);
|
||||
shaderUsePosition(shader, 0,0,0, 0,0,0);
|
||||
vnCharacterRender(characters + playerIndex, shader);
|
||||
|
||||
// Increment
|
||||
j++;
|
||||
}
|
||||
|
||||
renderResetFramebuffer(&engine->render);
|
||||
}
|
||||
|
||||
void pokerUiRender(pokerui_t *ui, engine_t *engine, shader_t *shader) {
|
||||
uint8_t i, j;
|
||||
pokerplayerui_t *ui;
|
||||
pokerplayer_t *player;
|
||||
char message[128];
|
||||
float scale;
|
||||
align_t align;
|
||||
float gx, gy, gw, gh, x, y;
|
||||
|
||||
// Get the default font scale size.
|
||||
scale = fontGetScale(FONT_SIZE_DEFAULT);
|
||||
|
||||
// <testing>
|
||||
if(pokerGame->poker.state >= POKER_STATE_DEALING) {
|
||||
for(j = 0; j < POKER_PLAYER_COUNT; j++) {
|
||||
player = pokerGame->poker.players + j;
|
||||
for(i = 0; i < player->cardCount; i++) {
|
||||
pokerCardSetImage(&pokerGame->ui.card, &pokerGame->assets.cardTexture, player->cards[i]);
|
||||
imageRender(&pokerGame->ui.card, &pokerGame->assets.shader, i * 64.0f, j * 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
player = pokerGame->poker.players + POKER_PLAYER_HUMAN_INDEX;
|
||||
if(pokerGame->poker.bet.better == POKER_PLAYER_HUMAN_INDEX) {
|
||||
sprintf(message, "Press down to fold, up to bet, right to check/call.");
|
||||
labelSetText(&pokerGame->ui.player->label, &pokerGame->assets.font, message);
|
||||
labelRender(&pokerGame->ui.player->label, &pokerGame->assets.shader, 300, 100);
|
||||
}
|
||||
// </testing>
|
||||
j = 0;
|
||||
for(i = 0; i < POKER_PLAYER_COUNT; i++) {
|
||||
if(i == POKER_PLAYER_HUMAN_INDEX) continue;
|
||||
|
||||
// Get the player.
|
||||
player = game->poker.players + i;
|
||||
|
||||
// Position the grid itself.
|
||||
x = 0;
|
||||
y = POKER_UI_PLAYER_HEIGHT * j;
|
||||
|
||||
// Render face
|
||||
gridGetChild(&ui->grid, 1, 0, 1, 2, &gx, &gy, &gw, &gh);
|
||||
shaderUseTexture(shader, &ui->frames + j);
|
||||
shaderUsePosition(shader, x + gx, y + gy, 0, 0,0,0);
|
||||
primitiveDraw(&ui->quad, 0, -1);
|
||||
|
||||
// Render chips
|
||||
sprintf(buffer, "$%i", player->chips);
|
||||
ui->label.maxWidth = -1;
|
||||
labelSetText(&ui->label, font, buffer);
|
||||
align = gridGetAndAlignChild(
|
||||
&ui->grid, 0, 0, 1, 1,
|
||||
ALIGN_POS_END|ALIGN_SIZE_ORIGINAL, ALIGN_POS_CENTER|ALIGN_SIZE_ORIGINAL,
|
||||
ui->label.info.width, ui->label.info.height
|
||||
);
|
||||
labelRender(&ui->label, shader, x+align.x, y+align.y);
|
||||
|
||||
// Render state
|
||||
if(player->state & POKER_PLAYER_STATE_OUT) {
|
||||
sprintf(buffer, "Out");
|
||||
} else if(player->state & POKER_PLAYER_STATE_FOLDED) {
|
||||
sprintf(buffer, "Folded");
|
||||
} else if(player->state & POKER_PLAYER_STATE_SHOWING) {
|
||||
sprintf(buffer, "Showing");
|
||||
} else if(game->poker.bet.better == playerIndex) {
|
||||
sprintf(buffer, "Thinking");
|
||||
} else {
|
||||
sprintf(buffer, "Whatever");
|
||||
}
|
||||
labelSetText(&ui->label, font, buffer);
|
||||
align = gridGetAndAlignChild(
|
||||
&ui->grid, 0, 1, 1, 1,
|
||||
ALIGN_POS_END | ALIGN_SIZE_ORIGINAL, ALIGN_POS_CENTER | ALIGN_SIZE_ORIGINAL,
|
||||
ui->label.info.width, ui->label.info.height
|
||||
);
|
||||
labelRender(&ui->label, shader, x+align.x, y+align.y);
|
||||
|
||||
// Increment.
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
void pokerUiDispose(pokerui_t *ui) {
|
||||
uint8_t i;
|
||||
|
||||
for(i = 0; i < POKER_PLAYER_COUNT; i++) frameBufferDispose(ui->frames + i);
|
||||
labelDispose(&ui->label);
|
||||
primitiveDispose(&ui->quad);
|
||||
imageDispose(&ui->card);
|
||||
}
|
||||
|
||||
void pokerUiSetImageToCard(image_t *image, texture_t *texture, card_t card) {
|
||||
uint8_t cardImageIndex = (
|
||||
cardGetNumber(card) == CARD_ACE ? (
|
||||
card - CARD_COUNT_PER_SUIT + 1
|
||||
) : card+0x01
|
||||
);
|
||||
|
||||
imageSetTextureAndCrop(
|
||||
image, texture,
|
||||
cardGetNumber(cardImageIndex) * 71,
|
||||
cardGetSuit(card) * 96,
|
||||
71, 96
|
||||
);
|
||||
}
|
87
src/game/poker/pokerui.h
Normal file
87
src/game/poker/pokerui.h
Normal file
@ -0,0 +1,87 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "../../libs.h"
|
||||
#include "../../ui/label.h"
|
||||
#include "../../ui/image.h"
|
||||
#include "../../display/framebuffer.h"
|
||||
#include "../../display/primitive.h"
|
||||
#include "../../display/primitives/quad.h"
|
||||
#include "../../display/primitives/cube.h"
|
||||
#include "../../display/shader.h"
|
||||
#include "../../engine/engine.h"
|
||||
#include "../../display/camera.h"
|
||||
#include "../../vn/vncharacter.h"
|
||||
#include "../../ui/grid.h"
|
||||
#include "../../ui/align.h"
|
||||
#include "../../poker/player.h"
|
||||
#include "../../poker/poker.h"
|
||||
#include "../../vn/vnscene.h"
|
||||
|
||||
#define POKER_UI_PLAYER_IMAGE_SIZE 64
|
||||
#define POKER_UI_PLAYER_WIDTH 300
|
||||
#define POKER_UI_PLAYER_HEIGHT POKER_UI_PLAYER_IMAGE_SIZE
|
||||
|
||||
#define POKER_UI_PLAYER_IMAGE_RESOLUTION POKER_UI_PLAYER_IMAGE_SIZE * 2
|
||||
#define POKER_UI_PLAYER_IMAGE_DIST 0.8f
|
||||
#define POKER_UI_PLAYER_IMAGE_Y 0.1f
|
||||
#define POKER_UI_PLAYER_PADDING 8
|
||||
#define POKER_UI_PLAYER_CHIPS_ANIMATION_SPEED 0.5f
|
||||
|
||||
typedef struct {
|
||||
primitive_t quad;
|
||||
label_t label;
|
||||
grid_t grid;
|
||||
image_t card;
|
||||
framebuffer_t frames[POKER_PLAYER_COUNT];
|
||||
} pokerui_t;
|
||||
|
||||
/**
|
||||
* Initializes the UI Module.
|
||||
*
|
||||
* @param ui UI to initialize.
|
||||
*/
|
||||
void pokerUiInit(pokerui_t *ui);
|
||||
|
||||
/**
|
||||
* Update the Poker Game UI.
|
||||
*
|
||||
* @param ui UI to update.
|
||||
* @param engine Engine to use for updating.
|
||||
* @param shader Shader to use for rendering.
|
||||
* @param characters Visual Novel characters to render.
|
||||
* @param players Array of poker players.
|
||||
*/
|
||||
void pokerUiUpdate(
|
||||
pokerui_t *ui, engine_t *engine, shader_t *shader,
|
||||
vncharacter_t *characters, pokerplayer_t *players
|
||||
);
|
||||
|
||||
/**
|
||||
* Render the Poker Game UI.
|
||||
*
|
||||
* @param ui UI to render.
|
||||
* @param engine Engine to use for the render.
|
||||
*/
|
||||
void pokerUiRender(pokerui_t *ui, engine_t *engine);
|
||||
|
||||
/**
|
||||
* Cleanup only the UI elements for a poker game.
|
||||
*
|
||||
* @param ui UI to dispose.
|
||||
*/
|
||||
void pokerUiDispose(pokerui_t *ui);
|
||||
|
||||
/**
|
||||
* Updates the given image to represent a card UI image.
|
||||
*
|
||||
* @param image Image to update.
|
||||
* @param texture Texture to use.
|
||||
* @param card Card to set to.
|
||||
*/
|
||||
void pokerCardSetImage(image_t *image, texture_t *texture, card_t card);
|
@ -7,17 +7,21 @@
|
||||
|
||||
#include "pokerworld.h"
|
||||
|
||||
void pokerWorldInit(pokergame_t *game) {
|
||||
void pokerWorldInit(
|
||||
pokerworld_t *world,
|
||||
vnscene_t *scene,
|
||||
pokergameassets_t *assets
|
||||
) {
|
||||
vncharacter_t *character;
|
||||
uint8_t i;
|
||||
|
||||
// Initialize the skywal
|
||||
skywallInit(&game->world.skywall);
|
||||
skywallInit(&world->skywall);
|
||||
|
||||
// Initialize the players
|
||||
for(i = 0x00; i < POKER_PLAYER_COUNT; i++) {
|
||||
character = game->scene.characters + game->scene.characterCount;
|
||||
vnCharacterInit(character, &game->assets.pennyTexture,
|
||||
character = scene->characters + scene->characterCount;
|
||||
vnCharacterInit(character, &assets->pennyTexture,
|
||||
POKER_GAME_PENNY_BASE_WIDTH, POKER_GAME_PENNY_BASE_HEIGHT,
|
||||
POKER_GAME_PENNY_FACE_X, POKER_GAME_PENNY_FACE_Y,
|
||||
POKER_GAME_PENNY_FACE_WIDTH, POKER_GAME_PENNY_FACE_HEIGHT
|
||||
@ -26,7 +30,7 @@ void pokerWorldInit(pokergame_t *game) {
|
||||
character->y = POKER_WORLD_SEAT_POSITION_Y;
|
||||
character->z = POKER_WORLD_SEAT_POSITION_Z(POKER_GAME_SEAT_FOR_PLAYER(i));
|
||||
character->yaw = POKER_WORLD_SEAT_ROTATION(POKER_GAME_SEAT_FOR_PLAYER(i));
|
||||
game->scene.characterCount++;
|
||||
scene->characterCount++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,7 +42,7 @@ void pokerWorldLookAtPlayer(vnscene_t *scene, uint8_t playerIndex) {
|
||||
}
|
||||
|
||||
void pokerWorldRender(
|
||||
pokerworld_t *world, engine_t *engine, pokergameassets_t *assets
|
||||
pokerworld_t *world, pokergameassets_t *assets
|
||||
) {
|
||||
// Render the wall
|
||||
shaderUseTexture(&assets->shader, &assets->roomTexture);
|
||||
@ -46,6 +50,6 @@ void pokerWorldRender(
|
||||
primitiveDraw(&world->skywall, 0, -1);
|
||||
}
|
||||
|
||||
void pokerWorldDispose(pokergame_t *game) {
|
||||
primitiveDispose(&game->world.skywall);
|
||||
void pokerWorldDispose(pokerworld_t *world) {
|
||||
primitiveDispose(&world->skywall);
|
||||
}
|
@ -12,9 +12,11 @@
|
||||
#include "../../display/primitives/skywall.h"
|
||||
#include "../../vn/vnscene.h"
|
||||
#include "../../vn/vncharacter.h"
|
||||
#include "pokergame.h"
|
||||
#include "../../poker/player.h"
|
||||
#include "../../poker/dealer.h"
|
||||
#include "pokergameassets.h"
|
||||
|
||||
|
||||
#define POKER_WORLD_SEAT_DISTANCE -1
|
||||
#define POKER_WORLD_SEAT_ROTATION(n) (n * mathDeg2Rad(45.0f))
|
||||
|
||||
@ -26,16 +28,41 @@
|
||||
POKER_WORLD_SEAT_DISTANCE * (float)cos(POKER_WORLD_SEAT_ROTATION(n)) \
|
||||
)
|
||||
|
||||
#define POKER_GAME_SEAT_COUNT 8
|
||||
#define POKER_GAME_SEAT_FOR_PLAYER(p) (p - (POKER_PLAYER_COUNT/2))
|
||||
#define POKER_GAME_SEAT_DEALER POKER_GAME_SEAT_FOR_PLAYER(POKER_DEALER_INDEX)
|
||||
|
||||
#define pokerGameSeatFromIndex(i) (\
|
||||
i == POKER_DEALER_INDEX ? \
|
||||
POKER_GAME_SEAT_DEALER : \
|
||||
POKER_GAME_SEAT_FOR_PLAYER(i) \
|
||||
)
|
||||
|
||||
#define POKER_GAME_PENNY_BASE_WIDTH 1000
|
||||
#define POKER_GAME_PENNY_BASE_HEIGHT 1920
|
||||
#define POKER_GAME_PENNY_FACE_X 367
|
||||
#define POKER_GAME_PENNY_FACE_Y 256
|
||||
#define POKER_GAME_PENNY_FACE_WIDTH 280
|
||||
#define POKER_GAME_PENNY_FACE_HEIGHT 280
|
||||
|
||||
|
||||
typedef struct {
|
||||
primitive_t skywall;
|
||||
} pokerworld_t;
|
||||
|
||||
|
||||
/**
|
||||
* Initialize the poker renderer.
|
||||
*
|
||||
* @param game Game to initialize for.
|
||||
* @param world Pointer to the world to initialize.
|
||||
* @param scene Visual Novel Engine scene to initialize.
|
||||
* @param assets Assets to use for initialization.
|
||||
*/
|
||||
void pokerWorldInit(pokergame_t *game);
|
||||
void pokerWorldInit(
|
||||
pokerworld_t *world,
|
||||
vnscene_t *scene,
|
||||
pokergameassets_t *assets
|
||||
);
|
||||
|
||||
/**
|
||||
* Adjusts the camera to look at a specific player. You can use this to look at
|
||||
@ -50,15 +77,14 @@ void pokerWorldLookAtPlayer(vnscene_t *scene, uint8_t playerIndex);
|
||||
* Render the poker world.
|
||||
*
|
||||
* @param world Poker Game World.
|
||||
* @param engine Game engine.
|
||||
* @param assets Assets to use.
|
||||
*/
|
||||
void pokerWorldRender(
|
||||
pokerworld_t *world, engine_t *engine, pokergameassets_t *assets
|
||||
pokerworld_t *world, pokergameassets_t *assets
|
||||
);
|
||||
|
||||
/**
|
||||
* Cleanup the poker world.
|
||||
* @param game Game to clean up for.
|
||||
* @param world World to clean up.
|
||||
*/
|
||||
void pokerWorldDispose(pokergame_t *game);
|
||||
void pokerWorldDispose(pokerworld_t *world);
|
@ -1,23 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#include "pokercardui.h"
|
||||
|
||||
void pokerCardSetImage(image_t *image, texture_t *texture, card_t card) {
|
||||
uint8_t cardImageIndex = (
|
||||
cardGetNumber(card) == CARD_ACE ? (
|
||||
card - CARD_COUNT_PER_SUIT + 1
|
||||
) : card+0x01
|
||||
);
|
||||
|
||||
imageSetTextureAndCrop(
|
||||
image, texture,
|
||||
cardGetNumber(cardImageIndex) * 71,
|
||||
cardGetSuit(card) * 96,
|
||||
71, 96
|
||||
);
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "../../../libs.h"
|
||||
#include "../../../ui/image.h"
|
||||
#include "../../../poker/card.h"
|
||||
|
||||
void pokerCardSetImage(image_t *image, texture_t *texture, card_t card);
|
@ -1,133 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#include "pokerplayerui.h"
|
||||
|
||||
void pokerPlayerUiInit(pokerplayerui_t *ui) {
|
||||
gridInit(&ui->grid);
|
||||
labelInit(&ui->label);
|
||||
frameBufferInit(&ui->frame,
|
||||
POKER_PLAYER_UI_IMAGE_RESOLUTION, POKER_PLAYER_UI_IMAGE_RESOLUTION
|
||||
);
|
||||
quadInit(&ui->quad, 0,
|
||||
0, 0, 0, 1,
|
||||
POKER_PLAYER_UI_IMAGE_SIZE, POKER_PLAYER_UI_IMAGE_SIZE, 1, 0
|
||||
);
|
||||
|
||||
// Set up the grid
|
||||
ui->grid.gutterX = POKER_PLAYER_UI_PADDING;
|
||||
ui->grid.columns = 2;
|
||||
ui->grid.rows = 2;
|
||||
ui->grid.columnDefinitions[1] = POKER_PLAYER_UI_IMAGE_SIZE;
|
||||
ui->grid.rowDefinitions[0] = POKER_PLAYER_UI_IMAGE_SIZE / 2.0f;
|
||||
ui->grid.rowDefinitions[1] = POKER_PLAYER_UI_IMAGE_SIZE / 2.0f;
|
||||
}
|
||||
|
||||
void pokerPlayerUiUpdate(
|
||||
pokerplayerui_t *ui, pokergame_t *game, shader_t *shader, int32_t playerIndex,
|
||||
engine_t *engine
|
||||
) {
|
||||
camera_t camera;
|
||||
uint8_t seat;
|
||||
pokerplayer_t *player;
|
||||
float x, y, z;
|
||||
|
||||
player = game->poker.players + playerIndex;
|
||||
|
||||
// Bind the frame buffer
|
||||
frameBufferUse(&ui->frame, true);
|
||||
|
||||
// Set up the camera perspective
|
||||
cameraPerspective(&camera, 45,
|
||||
(float)POKER_PLAYER_UI_IMAGE_SIZE / (float)POKER_PLAYER_UI_IMAGE_SIZE,
|
||||
0.03f, 10.0f
|
||||
);
|
||||
|
||||
// Locate the XYZ position of the camera to look at the player
|
||||
seat = pokerGameSeatFromIndex(playerIndex);
|
||||
x = POKER_WORLD_SEAT_POSITION_X(seat);
|
||||
y = POKER_PLAYER_UI_IMAGE_Y;
|
||||
z = POKER_WORLD_SEAT_POSITION_Z(seat);
|
||||
|
||||
// Actually look at the player, we need to get close.
|
||||
cameraLookAt(&camera,
|
||||
x * POKER_PLAYER_UI_IMAGE_DIST, y, z * POKER_PLAYER_UI_IMAGE_DIST,
|
||||
x, y, z
|
||||
);
|
||||
|
||||
// Render the VN character
|
||||
shaderUse(shader);
|
||||
shaderUseCamera(shader, &camera);
|
||||
shaderUsePosition(shader, 0,0,0, 0,0,0);
|
||||
vnCharacterRender(game->scene.characters + playerIndex, shader);
|
||||
|
||||
// Unbind the frame buffer.
|
||||
frameBufferUnbind(&engine->render, false);
|
||||
}
|
||||
|
||||
void pokerPlayerUiRender(
|
||||
pokerplayerui_t *ui, pokergame_t *game, shader_t *shader, font_t *font,
|
||||
engine_t *engine,
|
||||
int32_t playerIndex, float x, float y
|
||||
) {
|
||||
pokerplayer_t *player;
|
||||
char buffer[32];
|
||||
float scale;
|
||||
align_t align;
|
||||
|
||||
float gx, gy, gw, gh;
|
||||
|
||||
// Font crap.
|
||||
scale = fontGetScale(FONT_SIZE_DEFAULT);
|
||||
player = game->poker.players + playerIndex;
|
||||
|
||||
// Align the grid itself.
|
||||
gridResize(&ui->grid, POKER_PLAYER_UI_WIDTH, POKER_PLAYER_UI_HEIGHT);
|
||||
|
||||
// Render face
|
||||
gridGetChild(&ui->grid, 1, 0, 1, 2, &gx, &gy, &gw, &gh);
|
||||
shaderUseTexture(shader, &ui->frame.texture);
|
||||
shaderUsePosition(shader, x+gx, y+gy, 0, 0,0,0);
|
||||
primitiveDraw(&ui->quad, 0, -1);
|
||||
|
||||
// Render chips
|
||||
sprintf(buffer, "$%i", player->chips);
|
||||
ui->label.maxWidth = -1;
|
||||
labelSetText(&ui->label, font, buffer);
|
||||
align = gridGetAndAlignChild(
|
||||
&ui->grid, 0, 0, 1, 1,
|
||||
ALIGN_POS_END | ALIGN_SIZE_ORIGINAL, ALIGN_POS_CENTER | ALIGN_SIZE_ORIGINAL,
|
||||
ui->label.info.width, ui->label.info.height
|
||||
);
|
||||
labelRender(&ui->label, shader, x+align.x, y+align.y);
|
||||
|
||||
// Render state
|
||||
if(player->state & POKER_PLAYER_STATE_OUT) {
|
||||
sprintf(buffer, "Out");
|
||||
} else if(player->state & POKER_PLAYER_STATE_FOLDED) {
|
||||
sprintf(buffer, "Folded");
|
||||
} else if(player->state & POKER_PLAYER_STATE_SHOWING) {
|
||||
sprintf(buffer, "Showing");
|
||||
} else if(game->poker.bet.better == playerIndex) {
|
||||
sprintf(buffer, "Thinking");
|
||||
} else {
|
||||
sprintf(buffer, "Whatever");
|
||||
}
|
||||
labelSetText(&ui->label, font, buffer);
|
||||
align = gridGetAndAlignChild(
|
||||
&ui->grid, 0, 1, 1, 1,
|
||||
ALIGN_POS_END | ALIGN_SIZE_ORIGINAL, ALIGN_POS_CENTER | ALIGN_SIZE_ORIGINAL,
|
||||
ui->label.info.width, ui->label.info.height
|
||||
);
|
||||
labelRender(&ui->label, shader, x+align.x, y+align.y);
|
||||
}
|
||||
|
||||
void pokerPlayerUiDispose(pokerplayerui_t *ui) {
|
||||
primitiveDispose(&ui->quad);
|
||||
frameBufferDispose(&ui->frame);
|
||||
labelDispose(&ui->label);
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "../../../libs.h"
|
||||
#include "../../../ui/label.h"
|
||||
#include "../../../ui/image.h"
|
||||
#include "../../../display/framebuffer.h"
|
||||
#include "../../../display/primitive.h"
|
||||
#include "../../../display/primitives/quad.h"
|
||||
#include "../../../display/primitives/cube.h"
|
||||
#include "../../../display/shader.h"
|
||||
#include "../../../engine/engine.h"
|
||||
#include "../../../display/camera.h"
|
||||
#include "../../../vn/vncharacter.h"
|
||||
#include "../../../ui/grid.h"
|
||||
#include "../../../ui/align.h"
|
||||
#include "../pokergame.h"
|
||||
|
||||
#define POKER_PLAYER_UI_IMAGE_SIZE 64
|
||||
#define POKER_PLAYER_UI_WIDTH 300
|
||||
#define POKER_PLAYER_UI_HEIGHT POKER_PLAYER_UI_IMAGE_SIZE
|
||||
|
||||
#define POKER_PLAYER_UI_IMAGE_RESOLUTION POKER_PLAYER_UI_IMAGE_SIZE * 2
|
||||
#define POKER_PLAYER_UI_IMAGE_DIST 0.8f
|
||||
#define POKER_PLAYER_UI_IMAGE_Y 0.1f
|
||||
#define POKER_PLAYER_UI_PADDING 8
|
||||
#define POKER_PLAYER_UI_CHIPS_ANIMATION_SPEED 0.5f
|
||||
|
||||
typedef struct {
|
||||
framebuffer_t frame;
|
||||
primitive_t quad;
|
||||
label_t label;
|
||||
|
||||
grid_t grid;
|
||||
} pokerplayerui_t;
|
||||
|
||||
void pokerPlayerUiInit(pokerplayerui_t *ui);
|
||||
|
||||
void pokerPlayerUiUpdate(
|
||||
pokerplayerui_t *ui, pokergame_t *game, shader_t *shader, int32_t playerIndex,
|
||||
engine_t *engine
|
||||
);
|
||||
|
||||
void pokerPlayerUiRender(
|
||||
pokerplayerui_t *ui, pokergame_t *game, shader_t *shader, font_t *font,
|
||||
engine_t *engine,
|
||||
int32_t playerIndex, float x, float y
|
||||
);
|
||||
|
||||
void pokerPlayerUiDispose(pokerplayerui_t *ui);
|
@ -1,89 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#include "pokerui.h"
|
||||
|
||||
void pokerUiInit(pokergame_t *pokerGame) {
|
||||
uint8_t i, j;
|
||||
|
||||
// Initialize card render(s)
|
||||
imageInit(&pokerGame->ui.card);
|
||||
|
||||
// Initialize players
|
||||
j = 0;
|
||||
for(i = 0; i < POKER_PLAYER_COUNT; i++) {
|
||||
if(i == POKER_PLAYER_HUMAN_INDEX) continue;
|
||||
pokerPlayerUiInit(pokerGame->ui.player + j);
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
void pokerUiUpdate(pokergame_t *pokerGame, engine_t *engine) {
|
||||
uint8_t i, j;
|
||||
pokerplayerui_t *ui;
|
||||
|
||||
j = 0;
|
||||
for(i = 0; i < POKER_PLAYER_COUNT; i++) {
|
||||
if(i == POKER_PLAYER_HUMAN_INDEX) continue;
|
||||
ui = pokerGame->ui.player + j;
|
||||
pokerPlayerUiUpdate(ui, pokerGame, &pokerGame->assets.shader, i, engine);
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
void pokerUiRender(pokergame_t *pokerGame, engine_t *engine) {
|
||||
uint8_t i, j;
|
||||
pokerplayerui_t *ui;
|
||||
pokerplayer_t *player;
|
||||
|
||||
char message[128];
|
||||
|
||||
// cards
|
||||
if(pokerGame->poker.state >= POKER_STATE_DEALING) {
|
||||
for(j = 0; j < POKER_PLAYER_COUNT; j++) {
|
||||
player = pokerGame->poker.players + j;
|
||||
for(i = 0; i < player->cardCount; i++) {
|
||||
pokerCardSetImage(&pokerGame->ui.card, &pokerGame->assets.cardTexture, player->cards[i]);
|
||||
imageRender(&pokerGame->ui.card, &pokerGame->assets.shader, i * 64.0f, j * 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// show uh
|
||||
player = pokerGame->poker.players + POKER_PLAYER_HUMAN_INDEX;
|
||||
if(pokerGame->poker.bet.better == POKER_PLAYER_HUMAN_INDEX) {
|
||||
sprintf(message, "Press down to fold, up to bet, right to check/call.");
|
||||
labelSetText(&pokerGame->ui.player->label, &pokerGame->assets.font, message);
|
||||
labelRender(&pokerGame->ui.player->label, &pokerGame->assets.shader, 300, 100);
|
||||
}
|
||||
|
||||
|
||||
j = 0;
|
||||
for(i = 0; i < POKER_PLAYER_COUNT; i++) {
|
||||
if(i == POKER_PLAYER_HUMAN_INDEX) continue;
|
||||
ui = pokerGame->ui.player + j;
|
||||
|
||||
pokerPlayerUiRender(
|
||||
ui, pokerGame, &pokerGame->assets.shader, &pokerGame->assets.font, engine,
|
||||
i, engine->render.width - ui->grid.width, j * 75.0f
|
||||
);
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
void pokerUiDispose(pokergame_t *pokerGame) {
|
||||
uint8_t i, j;
|
||||
|
||||
imageDispose(&pokerGame->ui.card);
|
||||
|
||||
j = 0;
|
||||
for(i = 0; i < POKER_PLAYER_COUNT; i++) {
|
||||
if(i == POKER_PLAYER_HUMAN_INDEX) continue;
|
||||
pokerPlayerUiDispose(pokerGame->ui.player + j);
|
||||
j++;
|
||||
}
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "../../../libs.h"
|
||||
#include "../../../ui/label.h"
|
||||
#include "pokerplayerui.h"
|
||||
#include "pokercardui.h"
|
||||
#include "../pokergame.h"
|
||||
|
||||
typedef struct {
|
||||
pokerplayerui_t player[POKER_PLAYER_COUNT];
|
||||
image_t card;
|
||||
} pokerui_t;
|
||||
|
||||
/**
|
||||
* Initializes the UI Module.
|
||||
*
|
||||
* @param pokerGame Poker game to initialize the UI for.
|
||||
*/
|
||||
void pokerUiInit(pokergame_t *pokerGame);
|
||||
|
||||
/**
|
||||
* Update the Poker Game UI.
|
||||
*
|
||||
* @param pokerGame Game to update.
|
||||
* @param engine Engine to use for updating.
|
||||
*/
|
||||
void pokerUiUpdate(pokergame_t *pokerGame, engine_t *engine);
|
||||
|
||||
/**
|
||||
* Render the Poker Game UI.
|
||||
*
|
||||
* @param pokerGame Game to render the UI for.
|
||||
* @param engine Engine to use for the render.
|
||||
*/
|
||||
void pokerUiRender(pokergame_t *pokerGame, engine_t *engine);
|
||||
|
||||
/**
|
||||
* Cleanup only the UI elements for a poker game.
|
||||
*
|
||||
* @param pokerGame Game to dispose the UI for.
|
||||
*/
|
||||
void pokerUiDispose(pokergame_t *pokerGame);
|
@ -13,7 +13,12 @@ void _pokerActionBlindsOnStart(queue_t *queue,queueaction_t *action,uint8_t i) {
|
||||
|
||||
poker->state = POKER_STATE_TAKING_BLINDS;
|
||||
|
||||
pokerBetTakeBlinds(poker);
|
||||
pokerBetTakeBlinds(
|
||||
&poker->bet,
|
||||
poker->players,
|
||||
poker->roundSmallBlind,
|
||||
poker->roundBigBlind
|
||||
);
|
||||
printf("Taken Blinds\n");
|
||||
queueNext(queue);
|
||||
}
|
||||
|
@ -6,9 +6,10 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "../bet.h"
|
||||
#include "../poker.h"
|
||||
#include "../../libs.h"
|
||||
#include "../../display/animation/queue.h"
|
||||
#include "../bet.h"
|
||||
|
||||
/** Callback for the blinds action */
|
||||
void _pokerActionBlindsOnStart(queue_t *queue,queueaction_t *action,uint8_t i);
|
||||
|
@ -17,7 +17,7 @@ void _pokerActionDealOnStart(queue_t *queue, queueaction_t *action, uint8_t i) {
|
||||
cardShuffle(poker->dealer.deck, CARD_DECK_SIZE);
|
||||
|
||||
// Deal 2 card to each player
|
||||
pokerDealerDealAll(poker, POKER_DEAL_CARD_EACH);
|
||||
pokerDealerDealAll(&poker->dealer, poker->players, POKER_DEAL_CARD_EACH);
|
||||
|
||||
printf("Cards Dealt\n");
|
||||
queueNext(queue);
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "../../libs.h"
|
||||
#include "../../display/animation/queue.h"
|
||||
#include "../dealer.h"
|
||||
#include "../poker.h"
|
||||
|
||||
/** Callback for the deal action */
|
||||
void _pokerActionDealOnStart(queue_t *queue, queueaction_t *action, uint8_t i);
|
||||
|
@ -9,6 +9,8 @@
|
||||
#include "../../libs.h"
|
||||
#include "../../display/animation/queue.h"
|
||||
#include "../dealer.h"
|
||||
#include "../poker.h"
|
||||
#include "../turn.h"
|
||||
|
||||
/**
|
||||
* Shorthand action callback parser. Takes the queue, action and the intended
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "../../libs.h"
|
||||
#include "../../display/animation/queue.h"
|
||||
#include "../bet.h"
|
||||
#include "../poker.h"
|
||||
|
||||
/** Callback for when the poker match aciton starts */
|
||||
void _pokerActionMatchOnStart(queue_t *queue, queueaction_t *action, uint8_t i);
|
||||
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <dawn/dawn.h>
|
||||
#include "../../libs.h"
|
||||
#include "../../display/animation/queue.h"
|
||||
#include "../dealer.h"
|
||||
#include "../bet.h"
|
||||
|
@ -64,9 +64,8 @@ uint8_t pokerBetGetRemainingPlayer(
|
||||
|
||||
void pokerBetTakeBlinds(
|
||||
pokerbet_t *bet, pokerplayer_t *players,
|
||||
uint8_t roundSmallBlind, uint8_t roundBigBlind,
|
||||
int32_t blindSmall, int32_t blindBig
|
||||
uint8_t roundSmallBlind, uint8_t roundBigBlind
|
||||
) {
|
||||
pokerBetPlayer(bet, players + roundSmallBlind, blindSmall);
|
||||
pokerBetPlayer(bet, players + roundBigBlind, blindBig);
|
||||
pokerBetPlayer(bet, players + roundSmallBlind, bet->blindSmall);
|
||||
pokerBetPlayer(bet, players + roundBigBlind, bet->blindBig);
|
||||
}
|
@ -102,6 +102,5 @@ uint8_t pokerBetGetRemainingPlayer(
|
||||
*/
|
||||
void pokerBetTakeBlinds(
|
||||
pokerbet_t *bet, pokerplayer_t *players,
|
||||
uint8_t roundSmallBlind, uint8_t roundBigBlind,
|
||||
int32_t blindSmall, int32_t blindBig
|
||||
uint8_t roundSmallBlind, uint8_t roundBigBlind
|
||||
);
|
@ -15,9 +15,6 @@ void scripterInit(scripter_t *scripter, engine_t *engine) {
|
||||
// Push the script self reference
|
||||
duk_push_pointer(scripter->context, scripter);
|
||||
duk_put_global_string(scripter->context, SCRIPTER_SELF_NAME);
|
||||
|
||||
// Inject API
|
||||
scriptsApiIo(scripter);
|
||||
}
|
||||
|
||||
void scripterDispose(scripter_t *scripter) {
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
#pragma once
|
||||
#include "../libs.h"
|
||||
#include "api/io.h"
|
||||
#include "../engine/engine.h"
|
||||
|
||||
/** Implies that the arguments the function will take is variable */
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#include "talk.h"
|
||||
|
||||
void _vnConversationTalkStart(queue_t *queue,queueaction_t *action,uint8_t i) {
|
||||
void _vnConversationTalkStart(queue_t *queue, queueaction_t *action,uint8_t i) {
|
||||
vnconversationitemdata_t *data;
|
||||
data = (vnconversationitemdata_t *)action->data;
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "../../libs.h"
|
||||
#include "vnconversation.h"
|
||||
#include "../../display/animation/queue.h"
|
||||
#include "../vncharacter.h"
|
||||
|
||||
/** Event Callback for when the talk action starts */
|
||||
void _vnConversationTalkStart(queue_t *q, queueaction_t *a, uint8_t i);
|
||||
|
@ -29,7 +29,7 @@ queueaction_t * vnConversationAdd(vnconversation_t *conversation) {
|
||||
|
||||
void vnConversationUpdate(vnconversation_t *convo, engine_t *engine) {
|
||||
vnTextBoxUpdate(&convo->textbox, engine);
|
||||
queueUpdate(&convo->actionQueue, engine);
|
||||
queueUpdate(&convo->actionQueue, engine->time.delta);
|
||||
}
|
||||
|
||||
void vnConversationRender(
|
||||
|
@ -11,6 +11,8 @@
|
||||
#include "../../util/array.h"
|
||||
#include "../../display/animation/timeline.h"
|
||||
#include "../../display/animation/queue.h"
|
||||
#include "../vncharacter.h"
|
||||
#include "../../engine/engine.h"
|
||||
|
||||
typedef struct _vnconversation_t vnconversation_t;
|
||||
|
||||
|
Reference in New Issue
Block a user