Even more refactoring

This commit is contained in:
2021-09-19 20:50:35 -07:00
parent 3ed24da3b6
commit e87e04decf
22 changed files with 120 additions and 114 deletions

View File

@ -10,7 +10,7 @@
#include "../game.h"
typedef struct {
int32_t INeedSomePropertyToStopCompilerComplaining;
engine_t engine;
} dawngame_t;
/**

View File

@ -8,28 +8,18 @@
#include "../engine/engine.h"
#include "../locale/language.h"
/** Describes the current game */
#if SETTING_GAME == SETTING_GAME_POKER
#include "poker/pokergame.h"
typedef pokergame_t game_t;
#elif SETTING_GAME == SETTING_GAME_DAWN
#include "dawn/dawngame.h"
typedef dawngame_t game_t;
#elif SETTING_GAME == SETTING_GAME_SANDBOX
#include "sandbox/sandboxscene.h"
typedef sandboxscene_t game_t;
#endif
/** Describes the current game */
typedef struct {
/** Engine for the game */
engine_t engine;
#if SETTING_GAME == SETTING_GAME_POKER
pokergame_t pokerGame;
#elif SETTING_GAME == SETTING_GAME_DAWN
dawngame_t dawnGame;
#elif SETTING_GAME == SETTING_GAME_SANDBOX
sandboxscene_t sandboxScene;
#endif
} game_t;
/**
* Initialize the game context.
*

View File

@ -6,8 +6,8 @@
*/
#pragma once
#include "../../../libs.h"
#include "action.h"
#include "../../../libs.h"
#include "../../../display/animation/queue.h"
#include "../pokerworld.h"

View File

@ -10,9 +10,7 @@
#include "../../../vn/conversation/talk.h"
#include "../../../display/animation/queue.h"
#include "../../../poker/actions/match.h"
#include "../discussion/pokerdiscussion.h"
#include "action.h"
#include "round.h"
/** Callback fired when the game action first starts */
void _pokerGameActionStartOnStart(

View File

@ -12,10 +12,9 @@
#include "../../vn/conversation/talk.h"
#include "../../vn/vnscene.h"
#include "../../util/array.h"
#include "actions/start.h"
#include "ui/pokerui.h"
#include "pokerworld.h"
#include "actions/start.h"
#include "pokergameaction.h"
#define POKER_GAME_SEAT_COUNT 8
#define POKER_GAME_SEAT_FOR_PLAYER(p) (p - (POKER_PLAYER_COUNT/2))
@ -40,6 +39,9 @@
#define POKER_GAME_PENNY_FACE_HEIGHT 280
typedef struct {
/** Game Engine Instance */
engine_t engine;
/** Poker Game State */
poker_t poker;
@ -57,9 +59,6 @@ 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

@ -6,7 +6,7 @@
*/
#pragma once
#include <dawn/dawn.h>
#include "../../libs.h"
typedef struct {
uint8_t lookAtPlayer;

View File

@ -12,6 +12,8 @@
#include "../../display/primitives/skywall.h"
#include "../../vn/vnscene.h"
#include "../../vn/vncharacter.h"
#include "pokergame.h"
#include "pokergameassets.h"
#define POKER_WORLD_SEAT_DISTANCE -1
#define POKER_WORLD_SEAT_ROTATION(n) (n * mathDeg2Rad(45.0f))

View File

@ -13,10 +13,13 @@
#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

View File

@ -10,6 +10,7 @@
#include "../../../ui/label.h"
#include "pokerplayerui.h"
#include "pokercardui.h"
#include "../pokergame.h"
typedef struct {
pokerplayerui_t player[POKER_PLAYER_COUNT];

View File

@ -7,9 +7,7 @@
#include "sandboxscene.h"
scripter_t scripter;
bool sandboxSceneInit(sandboxscene_t *game, engine_t *engine) {
bool sandboxSceneInit(sandboxscene_t *game) {
assetFontLoad(&game->font, "fonts/opensans/OpenSans-Regular.ttf");
assetTextureLoad(&game->texture, "test_texture.png");
assetShaderLoad(&game->shader,
@ -19,11 +17,11 @@ bool sandboxSceneInit(sandboxscene_t *game, engine_t *engine) {
return true;
}
void sandboxSceneUpdate(sandboxscene_t *game, engine_t *engine) {
void sandboxSceneUpdate(sandboxscene_t *game) {
cameraLookAt(&game->camera, 3,3,3, 0,0,0);
cameraPerspective(&game->camera, 45,
engine->render.width/engine->render.height,
game->engine.render.width/game->engine.render.height,
0.01f, 1000.0f
);

View File

@ -27,6 +27,7 @@
#include "../../ui/framedtextmenu.h"
typedef struct {
engine_t engine;
camera_t camera;
primitive_t primitive;
@ -42,7 +43,7 @@ typedef struct {
* @param engine Engine to use during init.
* @return True if successful, otherwise false.
*/
bool sandboxSceneInit(sandboxscene_t *game, engine_t *engine);
bool sandboxSceneInit(sandboxscene_t *game);
/**
* Update a sandbox scene.
@ -50,7 +51,7 @@ bool sandboxSceneInit(sandboxscene_t *game, engine_t *engine);
* @param game Game to update.
* @param engine Engine to use when updating.
*/
void sandboxSceneUpdate(sandboxscene_t *game, engine_t *engine);
void sandboxSceneUpdate(sandboxscene_t *game);
/**
* Dispose a previously created scene game.