Cleaned some stuff up
This commit is contained in:
		| @@ -38,6 +38,8 @@ | |||||||
| #include "input/input.h" | #include "input/input.h" | ||||||
|  |  | ||||||
| // Poker Game Logic | // Poker Game Logic | ||||||
|  | #include "poker/round/match.h" | ||||||
|  |  | ||||||
| #include "poker/bet.h" | #include "poker/bet.h" | ||||||
| #include "poker/card.h" | #include "poker/card.h" | ||||||
| #include "poker/dealer.h" | #include "poker/dealer.h" | ||||||
|   | |||||||
| @@ -14,6 +14,8 @@ | |||||||
| #include "render.h" | #include "render.h" | ||||||
| #include "winner.h" | #include "winner.h" | ||||||
|  |  | ||||||
|  | #include "round/match.h" | ||||||
|  |  | ||||||
| #include "../display/camera.h" | #include "../display/camera.h" | ||||||
| #include "../display/shader.h" | #include "../display/shader.h" | ||||||
| #include "../display/texture.h" | #include "../display/texture.h" | ||||||
| @@ -71,9 +73,10 @@ typedef struct { | |||||||
|  |  | ||||||
|   /** For Betting round, which player is currently betting */ |   /** For Betting round, which player is currently betting */ | ||||||
|   uint8_t roundBetCurrent; |   uint8_t roundBetCurrent; | ||||||
|  |  | ||||||
|   uint32_t roundTextCounter; |   uint32_t roundTextCounter; | ||||||
|  |  | ||||||
|  |   pokerroundmatch_t roundMatch; | ||||||
|  |  | ||||||
|   ////////////////////////////////////////////////////////////////////////////// |   ////////////////////////////////////////////////////////////////////////////// | ||||||
|   // Rendering Variables |   // Rendering Variables | ||||||
|   ////////////////////////////////////////////////////////////////////////////// |   ////////////////////////////////////////////////////////////////////////////// | ||||||
| @@ -88,7 +91,7 @@ typedef struct { | |||||||
|   shader_t shader; |   shader_t shader; | ||||||
|    |    | ||||||
|   /** Camera for the world and the GUI */ |   /** Camera for the world and the GUI */ | ||||||
|   camera_t cameraWorld, cameraGui, cameraTest; |   camera_t cameraWorld, cameraGui; | ||||||
|  |  | ||||||
|   /** Refer to POKER_GUI_HEIGHT */ |   /** Refer to POKER_GUI_HEIGHT */ | ||||||
|   float guiWidth; |   float guiWidth; | ||||||
|   | |||||||
							
								
								
									
										14
									
								
								include/dawn/poker/round/match.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								include/dawn/poker/round/match.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | |||||||
|  | /** | ||||||
|  |  * Copyright (c) 2021 Dominic Masters | ||||||
|  |  *  | ||||||
|  |  * This software is released under the MIT License. | ||||||
|  |  * https://opensource.org/licenses/MIT | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | #pragma once | ||||||
|  | #include "../../libs.h" | ||||||
|  |  | ||||||
|  | typedef struct { | ||||||
|  |   // Time when match started (for fade effect) | ||||||
|  |   float time; | ||||||
|  | } pokerroundmatch_t; | ||||||
| @@ -44,8 +44,7 @@ void pokerUpdate(poker_t *poker, engine_t *engine) { | |||||||
|   } |   } | ||||||
|    |    | ||||||
|   shaderUse(&poker->shader); |   shaderUse(&poker->shader); | ||||||
|   // pokerFrameWorld(poker, &engine->render); |   pokerFrameWorld(poker, &engine->render); | ||||||
|   pokerFrameTest(poker, &engine->render); |  | ||||||
|  |  | ||||||
|   pokerWorldRender(poker); |   pokerWorldRender(poker); | ||||||
|   for(uint8_t pi = 0; pi < POKER_PLAYER_COUNT; pi++) { |   for(uint8_t pi = 0; pi < POKER_PLAYER_COUNT; pi++) { | ||||||
|   | |||||||
| @@ -42,19 +42,4 @@ void pokerFrameGui(poker_t *poker, render_t *render) { | |||||||
|  |  | ||||||
| void pokerFrameRender(poker_t *poker, render_t *render) { | void pokerFrameRender(poker_t *poker, render_t *render) { | ||||||
|    |    | ||||||
| } |  | ||||||
|  |  | ||||||
| void pokerFrameTest(poker_t *poker, render_t *render) { |  | ||||||
|   // Correct the aspect on the perspective camera for the world |  | ||||||
|   cameraPerspective(&poker->cameraTest, 20, |  | ||||||
|     render->width / render->height, |  | ||||||
|     0.001, 1000 |  | ||||||
|   ); |  | ||||||
|  |  | ||||||
|   cameraLookAt(&poker->cameraTest, |  | ||||||
|     0, 0.25, -1, |  | ||||||
|     0, 0.25, 0.5 |  | ||||||
|   ); |  | ||||||
|  |  | ||||||
|   shaderUseCamera(&poker->shader, &poker->cameraTest); |  | ||||||
| } | } | ||||||
| @@ -10,7 +10,7 @@ | |||||||
| void pokerLookAtPlayer(camera_t *camera, uint8_t seat, float distance) { | void pokerLookAtPlayer(camera_t *camera, uint8_t seat, float distance) { | ||||||
|   float x, z, angle; |   float x, z, angle; | ||||||
|   angle = POKER_SEAT_ANGLE(seat); |   angle = POKER_SEAT_ANGLE(seat); | ||||||
|   x = sin(angle) * (0.8); |   x = sin(angle) * (0.8 + distance); | ||||||
|   z = cos(angle) * (0.8 + distance); |   z = cos(angle) * (0.8 + distance); | ||||||
|   cameraLookAt(camera, |   cameraLookAt(camera, | ||||||
|      x, 0.3,  z, |      x, 0.3,  z, | ||||||
|   | |||||||
| @@ -13,6 +13,7 @@ | |||||||
|  *  |  *  | ||||||
|  * @param camera Camera to adjust. |  * @param camera Camera to adjust. | ||||||
|  * @param seat Seat to look at. |  * @param seat Seat to look at. | ||||||
|  |  * @param distance Distance from the seat to look from. 0 is default. | ||||||
|  */ |  */ | ||||||
| void pokerLookAtPlayer(camera_t *camera, uint8_t seat, float distance); | void pokerLookAtPlayer(camera_t *camera, uint8_t seat, float distance); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -18,6 +18,9 @@ void pokerDealInit(poker_t *poker) { | |||||||
|   // Deal 2 card to each player |   // Deal 2 card to each player | ||||||
|   pokerDealerDealAll(poker, POKER_DEAL_CARD_EACH); |   pokerDealerDealAll(poker, POKER_DEAL_CARD_EACH); | ||||||
|    |    | ||||||
|  |   // Deal 2 card to each player | ||||||
|  |   pokerDealerDealAll(poker, POKER_DEAL_CARD_EACH); | ||||||
|  |    | ||||||
|   printf("Cards Dealt\n"); |   printf("Cards Dealt\n"); | ||||||
|   pokerBetInit(poker); |   pokerRoundBetInit(poker); | ||||||
| } | } | ||||||
| @@ -9,5 +9,6 @@ | |||||||
| #include <dawn/dawn.h> | #include <dawn/dawn.h> | ||||||
| #include "../dealer.h" | #include "../dealer.h" | ||||||
| #include "../card.h" | #include "../card.h" | ||||||
|  | #include "bet.h" | ||||||
|  |  | ||||||
| void pokerFlopInit(poker_t *poker); | void pokerFlopInit(poker_t *poker); | ||||||
| @@ -10,8 +10,7 @@ void pokerMatchInit(poker_t *poker, engine_t *engine) { | |||||||
|   uint8_t x; |   uint8_t x; | ||||||
|  |  | ||||||
|   // Look at the dealer |   // Look at the dealer | ||||||
|   // poker->matchStart = engine->time.current; |   poker->roundMatch.time = engine->time.current; | ||||||
|   pokerLookAtPlayer(&poker->cameraWorld, POKER_SEAT_DEALER, 100); |  | ||||||
|  |  | ||||||
|   // Reset the main game state. This does not init the round. |   // Reset the main game state. This does not init the round. | ||||||
|   pokerBetInit(&poker->bet); |   pokerBetInit(&poker->bet); | ||||||
| @@ -29,4 +28,6 @@ void pokerMatchInit(poker_t *poker, engine_t *engine) { | |||||||
|  |  | ||||||
| void pokerMatchUpdate(poker_t *poker, engine_t *engine) { | void pokerMatchUpdate(poker_t *poker, engine_t *engine) { | ||||||
|   // float matchDiff = poker->matchStart - engine->time.current; |   // float matchDiff = poker->matchStart - engine->time.current; | ||||||
|  |   float diff = engine->time.current - poker->roundMatch.time; | ||||||
|  |   pokerLookAtPlayer(&poker->cameraWorld, POKER_SEAT_PLAYER0, 3 - (diff/2)); | ||||||
| } | } | ||||||
		Reference in New Issue
	
	Block a user