Image Update

This commit is contained in:
2021-06-12 07:54:22 -07:00
parent f6fdec2db2
commit 928c3c838e
10 changed files with 106 additions and 14 deletions

5
.gitignore vendored
View File

@ -70,4 +70,7 @@ build
lib
assets/testworld/tileset.png
oldsrc
oldsrc
node_modules
yarn.lock

View File

@ -80,10 +80,27 @@
////////////////////////////////////////////////////////////////////////////////
// Suits
////////////////////////////////////////////////////////////////////////////////
#define CARD_SUIT_CLUBS 0x01
#define CARD_SUIT_DIAMONDS 0x02
#define CARD_SUIT_HEARTS 0x03
#define CARD_SUIT_SPADES 0x04
#define CARD_SUIT_CLUBS 0x0D
#define CARD_SUIT_DIAMONDS 0x1A
#define CARD_SUIT_HEARTS 0x27
#define CARD_SUIT_SPADES 0x34
////////////////////////////////////////////////////////////////////////////////
// Card numbers
////////////////////////////////////////////////////////////////////////////////
#define CARD_ACE 0x00
#define CARD_TWO 0x01
#define CARD_THREE 0x02
#define CARD_FOUR 0x03
#define CARD_FIVE 0x04
#define CARD_SIX 0x05
#define CARD_SEVEN 0x06
#define CARD_EIGHT 0x07
#define CARD_NINE 0x08
#define CARD_TEN 0x09
#define CARD_JACK 0x0A
#define CARD_QUEEN 0x0B
#define CARD_KING 0x0C
/** Count of cards in each suit */
#define CARD_COUNT_PER_SUIT 13

View File

@ -110,7 +110,7 @@ typedef struct {
/** Game's Shader */
shader_t shader;
/** Camera for the world and the GUI */
camera_t cameraWorld, cameraGui;
camera_t cameraWorld, cameraGui, cameraTest;
/** Refer to POKER_GUI_HEIGHT */
float guiWidth;

14
package.json Normal file
View File

@ -0,0 +1,14 @@
{
"name": "dawn",
"version": "1.0.0",
"repository": "https://YourWishes@github.com/YourWishes/Dawn.git",
"author": "Dominic Masters <dominic@domsplace.com>",
"license": "MIT",
"private": true,
"dependencies": {
"pngjs": "^6.0.0"
},
"scripts": {
"stitch": "node --max-heap-size=3840 ./tools/stitcher/index.js"
}
}

View File

@ -44,7 +44,8 @@ void pokerUpdate(poker_t *poker, engine_t *engine) {
}
shaderUse(&poker->shader);
pokerFrameWorld(poker, &engine->render);
// pokerFrameWorld(poker, &engine->render);
pokerFrameTest(poker, &engine->render);
pokerWorldRender(poker);
for(uint8_t pi = 0; pi < POKER_PLAYER_COUNT; pi++) {

View File

@ -42,4 +42,19 @@ void pokerFrameGui(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);
}

View File

@ -38,4 +38,6 @@ void pokerFrameWorld(poker_t *poker, render_t *render);
* @param poker Poker game context.
* @param render Rendering engine context.
*/
void pokerFrameGui(poker_t *poker, render_t *render);
void pokerFrameGui(poker_t *poker, render_t *render);
void pokerFrameTest(poker_t *poker, render_t *render);

View File

@ -8,14 +8,44 @@
#pragma once
#include "winner.h"
void pokerWinnerInit(poker_t *poker) {
void pokerWinnerGetFullHand(poker_t *poker,pokerplayer_t *player,card_t *cards){
uint8_t i;
for(i = 0; i < poker->cardsFacing; i++) {
cards[i] = poker->cards[i];
}
for(i = 0; i < player->cardCount; i++) {
cards[i+poker->cardsFacing] = player->cards[i];
}
}
void pokerWinnerInit(poker_t *poker) {
uint8_t winners[POKER_PLAYER_COUNT];
uint8_t winnerCount = 0;
poker->round = POKER_ROUND_WINNER;
printf("Winner Winner Chicken Dinner\n");
// Bruh Moment
for(i = 0; i < POKER_PLAYER_COUNT; i++) {
// Find the player(s) who have a royal flush?
for(uint8_t i = 0; i < POKER_PLAYER_COUNT; i++) {
pokerplayer_t *player = poker->players + i;
if(!pokerPlayerIsAlive(player)) continue;
card_t fullHand[POKER_DEALER_HAND+POKER_PLAYER_HAND];
pokerWinnerGetFullHand(poker, player, fullHand);
uint8_t cardCount = poker->cardsFacing + player->cardCount;
uint8_t suit;
// Find the ace and get it's suit
for(uint8_t j = 0; j < cardCount; j++) {
card_t card = fullHand[j];
if((card % CARD_COUNT_PER_SUIT) != CARD_ACE) continue;
suit = card / CARD_COUNT_PER_SUIT;
break;
}
// Now we have a suit, check we have each of that
}
}

View File

@ -7,5 +7,7 @@
#pragma once
#include <dawn/dawn.h>
#include "../player.h"
void pokerWinnerGetFullHand(poker_t *poker,pokerplayer_t *player,card_t *cards);
void pokerWinnerInit(poker_t *poker);

View File

@ -9,10 +9,17 @@ const IMAGES_ROOT = path.join(...[
'characters',
'penny',
'Sample sets',
'Eyes'
'Mouth'
]);
const FILE_OUT =
const FILE_OUT = path.join(...[
'.',
'assets',
'characters',
'penny',
'textures',
'mouth.png'
])
// Code
@ -84,5 +91,6 @@ const imageWrite = (image, file) => new Promise(resolve => {
}
};
console.log('Writing');
await imageWrite(stitched, FILE_OUT);
})().catch(console.error);