Dawn/src/game/poker/pokerworld.c

63 lines
1.8 KiB
C

/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "pokerworld.h"
void pokerWorldInit(
pokerworld_t *world,
vnscene_t *scene,
pokergameassets_t *assets
) {
vncharacter_t *character;
uint8_t i;
world->seat = POKER_GAME_SEAT_DEALER;
world->seatTime = 0;
// Initialize the skywal
skywallInit(&world->skywall);
// Initialize the players
for(i = 0x00; i < POKER_PLAYER_COUNT; i++) {
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
);
character->x = POKER_WORLD_SEAT_POSITION_X(POKER_GAME_SEAT_FOR_PLAYER(i));
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));
scene->characterCount++;
}
}
void pokerWorldLookAtPlayer(
vnscene_t *scene, uint8_t playerIndex
) {
uint8_t seat = pokerGameSeatFromIndex(playerIndex);
vnSceneLookAt(scene,
scene->cameraLook.x,
scene->cameraLook.y,
scene->cameraLook.z,
POKER_WORLD_SEAT_POSITION_X(seat),
scene->cameraLook.lookY,
POKER_WORLD_SEAT_POSITION_Z(seat)
);
}
void pokerWorldRender(pokerworld_t *world, pokergameassets_t *assets) {
// Render the wall
shaderUseTexture(&assets->shader, &assets->roomTexture);
shaderUsePosition(&assets->shader, 0,2,0, 0,0,0);
primitiveDraw(&world->skywall, 0, -1);
}
void pokerWorldDispose(pokerworld_t *world) {
primitiveDispose(&world->skywall);
}