2024-03-24 02:01:28 -06:00
|
|
|
#pragma once
|
|
|
|
|
2024-04-06 14:25:40 -06:00
|
|
|
#define LOAD_ASSET(path) (path == NULL ? NULL : (GameEngine_OTRSigCheck((const char*) path) ? ResourceGetDataByName((const char*) path) : path))
|
2024-04-06 04:25:11 -06:00
|
|
|
#define LOAD_ASSET_RAW(path) ResourceGetDataByName((const char*) path)
|
|
|
|
|
2024-03-24 02:01:28 -06:00
|
|
|
#ifdef __cplusplus
|
|
|
|
#include <vector>
|
|
|
|
#include <Fast3D/gfx_pc.h>
|
2024-04-03 02:18:17 -06:00
|
|
|
#include "libultraship/src/Context.h"
|
2024-03-24 02:01:28 -06:00
|
|
|
|
|
|
|
#define SAMPLES_HIGH 544
|
|
|
|
#define SAMPLES_LOW 528
|
|
|
|
#define AUDIO_FRAMES_PER_UPDATE 2
|
|
|
|
#define NUM_AUDIO_CHANNELS 2
|
|
|
|
#define SAMPLES_PER_FRAME (SAMPLES_HIGH * NUM_AUDIO_CHANNELS * 2)
|
|
|
|
|
|
|
|
class GameEngine {
|
|
|
|
public:
|
|
|
|
static GameEngine* Instance;
|
|
|
|
|
2024-05-20 22:29:07 -06:00
|
|
|
std::shared_ptr<Ship::Context> context;
|
2024-03-24 02:01:28 -06:00
|
|
|
|
|
|
|
GameEngine();
|
|
|
|
static void Create();
|
|
|
|
void StartFrame() const;
|
|
|
|
static void RunCommands(Gfx* Commands);
|
|
|
|
void ProcessFrame(void (*run_one_game_iter)()) const;
|
|
|
|
static void Destroy();
|
2024-04-01 23:13:52 -06:00
|
|
|
static void ProcessGfxCommands(Gfx* commands);
|
2024-03-24 02:01:28 -06:00
|
|
|
};
|
|
|
|
#else
|
|
|
|
void GameEngine_ProcessGfxCommands(Gfx* commands);
|
|
|
|
float GameEngine_GetAspectRatio();
|
2024-04-07 18:01:42 -06:00
|
|
|
uint8_t GameEngine_OTRSigCheck(char* imgData);
|
2024-05-27 15:27:19 -06:00
|
|
|
uint32_t OTRGetCurrentWidth(void);
|
|
|
|
uint32_t OTRGetCurrentHeight(void);
|
|
|
|
float OTRGetAspectRatio(void);
|
|
|
|
int32_t OTRConvertHUDXToScreenX(int32_t v);
|
|
|
|
float OTRGetDimensionFromLeftEdge(float v);
|
|
|
|
float OTRGetDimensionFromRightEdge(float v);
|
|
|
|
int16_t OTRGetRectDimensionFromLeftEdge(float v);
|
|
|
|
int16_t OTRGetRectDimensionFromRightEdge(float v);
|
|
|
|
uint32_t OTRGetGameRenderWidth();
|
|
|
|
uint32_t OTRGetGameRenderHeight();
|
2024-03-24 02:01:28 -06:00
|
|
|
#endif
|