Added JS engine.

This commit is contained in:
2021-09-18 00:39:00 -07:00
parent 9dd9ce7cbd
commit ef9137fabb
52 changed files with 547 additions and 35712 deletions

View File

@ -69,6 +69,9 @@
#include "poker/turn.h"
#include "poker/winner.h"
// Script engine
#include "script/scripter.h"
// User Interface Objects
#include "ui/align.h"
#include "ui/breakpoint.h"

View File

@ -12,6 +12,7 @@
#include "pokerworld.h"
#include "pokergameaction.h"
#include "ui/pokerui.h"
#include "../../engine/engine.h"
#include "../../poker/poker.h"
#include "../../poker/player.h"
#include "../../poker/dealer.h"
@ -58,4 +59,7 @@ typedef struct {
/** Data for the actions */
pokergameactiondata_t actionData[ANIMATION_QUEUE_ITEM_MAX];
/** Pointer back to the game engine */
engine_t *engine;
} pokergame_t;

View File

@ -17,6 +17,7 @@ typedef struct {
texture_t testTexture;
texture_t roomTexture;
texture_t cardTexture;
texture_t pennyTexture;
} pokergameassets_t;

View File

@ -17,6 +17,9 @@
#include "../../../ui/align.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

View File

@ -9,7 +9,9 @@
#include "../../../libs.h"
#include "../../../poker/player.h"
#include "pokerplayerui.h"
#include "../../../ui/image.h"
typedef struct {
pokerplayerui_t player[POKER_PLAYER_COUNT];
image_t card;
} pokerui_t;

View File

@ -10,6 +10,7 @@
// Static Libs
#include <cglm/cglm.h>
#include <duktape.h>
#if SETTING_PLATFORM_USE_GLAD == 1
#include <glad/glad.h>

View File

@ -21,6 +21,16 @@
#define POKER_TURN_CARD_COUNT 1
#define POKER_RIVER_CARD_COUNT 1
#define POKER_STATE_NULL 0x00
#define POKER_STATE_STARTING_MATCH 0x01
#define POKER_STATE_STARTING_ROUND 0x02
#define POKER_STATE_TAKING_BLINDS 0x03
#define POKER_STATE_DEALING 0x04
#define POKER_STATE_CARDS_FLOPPING 0x05
#define POKER_STATE_BETTING 0x06
#define POKER_STATE_DECIDING_WINNER 0x07
typedef struct {
/** Poker betting state */
pokerbet_t bet;
@ -40,4 +50,6 @@ typedef struct {
/** Which player is the big blind for this round */
uint8_t roundBigBlind;
uint8_t state;
} poker_t;

View File

@ -0,0 +1,24 @@
// Copyright (c) 2021 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#include "../libs.h"
/** Implies that the arguments the function will take is variable */
#define SCRIPTER_VARIABLE_ARGUMENT_COUNT DUK_VARARGS
/** Global context defintion of the pointer referring back to the scripter */
#define SCRIPTER_SELF_NAME "__scripter"
/** Type forwarders */
typedef duk_context scriptercontext_t;
typedef duk_ret_t scripterreturn_t;
typedef struct {
duk_context *context;
engine_t *engine;
void *user;
} scripter_t;
typedef scripterreturn_t scriptermethod_t(scriptercontext_t *context);

View File

@ -12,7 +12,5 @@
typedef struct {
texture_t *texture;
primitive_t quad;
float u0, v0;
float u1, v1;
float width, height;
} image_t;