Adding more TS

This commit is contained in:
2021-09-25 11:29:23 -07:00
parent 1bccf9b7e2
commit 4fcfb550a7
13 changed files with 136 additions and 13 deletions

View File

@ -12,7 +12,7 @@ bool gameInit(game_t *game) {
engineInit(&game->engine);
// Send off to the game instance
return gameInstanceInit(game);
return GAME_INIT(game);
}
bool gameUpdate(game_t *game, float platformDelta) {
@ -20,7 +20,7 @@ bool gameUpdate(game_t *game, float platformDelta) {
engineUpdateStart(&game->engine, platformDelta);
// Hand off to the game to update
gameInstanceUpdate(game);
GAME_UPDATE(game);
// Hand back to the engine.
return engineUpdateEnd(&game->engine);
@ -28,7 +28,7 @@ bool gameUpdate(game_t *game, float platformDelta) {
void gameDispose(game_t *game) {
// Cleanup the game
gameInstanceDispose(game);
GAME_DISPOSE(game);
engineDispose(&game->engine);
}

View File

@ -12,12 +12,21 @@
#if SETTING_GAME == SETTING_GAME_POKER
#include "poker/game.h"
typedef pokergame_t game_t;
#define GAME_INIT poekrGameInit
#define GAME_UPDATE pokerGameUpdate
#define GAME_DISPOSE pokerGameDispose
#elif SETTING_GAME == SETTING_GAME_DAWN
#include "dawn/game.h"
typedef dawngame_t game_t;
#elif SETTING_GAME == SETTING_GAME_SANDBOX
#include "sandbox/game.h"
#include "sandbox/sandboxscene.h"
typedef sandboxscene_t game_t;
#define GAME_INIT sandboxSceneInit
#define GAME_UPDATE sandboxSceneUpdate
#define GAME_DISPOSE sandboxSceneDispose
#endif
/**

View File

@ -7,7 +7,7 @@
#include "game.h"
bool gameInstanceInit(pokergame_t *game) {
bool pokerGameInit(pokergame_t *game) {
// Load the Assets.
pokerGameAssetsInit(&game->assets);
@ -30,7 +30,7 @@ bool gameInstanceInit(pokergame_t *game) {
return true;
}
void gameInstanceUpdate(pokergame_t *game) {
void pokerGameUpdate(pokergame_t *game) {
// Update the VN Engine.
vnSceneUpdate(&game->scene, &game->engine);
@ -58,7 +58,7 @@ void gameInstanceUpdate(pokergame_t *game) {
pokerUiRender(&game->ui, &game->engine, &game->assets, &game->poker);
}
void gameInstanceDispose(pokergame_t *game) {
void pokerGameDispose(pokergame_t *game) {
//Cleanup the UI
pokerUiDispose(&game->ui);

View File

@ -24,16 +24,16 @@
* @param game Game to initialize.
* @returns True if successful, otherwise false.
*/
bool gameInstanceInit(pokergame_t *game);
bool pokerGameInit(pokergame_t *game);
/**
* Updates the poker game instance.
* @param game Poker game to update for.
*/
void gameInstanceUpdate(pokergame_t *game);
void pokerGameUpdate(pokergame_t *game);
/**
* Disposes a previously initialized poker game instance.
* @param game Game to dispose.
*/
void gameInstanceDispose(pokergame_t *game);
void pokerGameDispose(pokergame_t *game);

View File

@ -14,6 +14,14 @@ bool sandboxSceneInit(sandboxscene_t *game) {
"shaders/textured.vert", "shaders/textured.frag"
);
// Init Scripter
scripter_t scripter;
scripterInit(&scripter, &game->engine);
scripter.user = game;
scriptsApiIo(&scripter);
assetScripterAppend(&scripter, "scripts/main.js");
return true;
}

View File

@ -19,13 +19,15 @@
#include "../../file/xml.h"
#include "../../file/asset.h"
#include "../../script/scripter.h"
#include "../../ui/grid.h"
#include "../../ui/menu.h"
#include "../../ui/textmenu.h"
#include "../../ui/image.h"
#include "../../ui/framedtextmenu.h"
#include "../../script/scripter.h"
#include "../../script/api/io.h"
typedef struct {
engine_t engine;
camera_t camera;