diff --git a/sonic3air-main/Oxygen/oxygenengine/source/engineapp/ConfigurationImpl.h b/sonic3air-main/Oxygen/oxygenengine/source/engineapp/ConfigurationImpl.h new file mode 100644 index 00000000..f1f17989 --- /dev/null +++ b/sonic3air-main/Oxygen/oxygenengine/source/engineapp/ConfigurationImpl.h @@ -0,0 +1,16 @@ +#pragma once + +#include "oxygen/application/Configuration.h" + + +class ConfigurationImpl : public ::Configuration +{ +public: + ConfigurationImpl(); + +protected: + inline void preLoadInitialization() override {} + bool loadConfigurationInternal(JsonHelper& jsonHelper) override; + bool loadSettingsInternal(JsonHelper& jsonHelper, SettingsType settingsType) override; + inline void saveSettingsInternal(Json::Value& root, SettingsType settingsType) override {} +}; diff --git a/sonic3air-main/Oxygen/oxygenengine/source/engineapp/EngineDelegate.cpp b/sonic3air-main/Oxygen/oxygenengine/source/engineapp/EngineDelegate.cpp new file mode 100644 index 00000000..0fe23d99 --- /dev/null +++ b/sonic3air-main/Oxygen/oxygenengine/source/engineapp/EngineDelegate.cpp @@ -0,0 +1,136 @@ +#include "engineapp/pch.h" +#include "engineapp/EngineDelegate.h" +#include "engineapp/GameApp.h" +#include "engineapp/audio/AudioOut.h" + + +const EngineDelegateInterface::AppMetaData& EngineDelegate::getAppMetaData() +{ + if (mAppMetaData.mTitle.empty()) + { + mAppMetaData.mTitle = "Oxygen Engine"; + mAppMetaData.mBuildVersionString = "0.1.0"; // Oxygen Engine currently doesn't use a version number to take serious in any way... + mAppMetaData.mBuildVersionNumber = 0x00010000; + } + mAppMetaData.mAppDataFolder = L"OxygenEngine"; + return mAppMetaData; +} + +GuiBase& EngineDelegate::createGameApp() +{ + return *new GameApp(); +} + +AudioOutBase& EngineDelegate::createAudioOut() +{ + return *new AudioOut(); +} + +bool EngineDelegate::onEnginePreStartup() +{ + return true; +} + +bool EngineDelegate::setupCustomGameProfile() +{ + // Return false to signal that there's no custom game profile, and the oxygenproject.json should be loaded instead + return false; +} + +void EngineDelegate::startupGame(EmulatorInterface& emulatorInterface) +{ +} + +void EngineDelegate::shutdownGame() +{ +} + +void EngineDelegate::updateGame(float timeElapsed) +{ +} + +void EngineDelegate::registerScriptBindings(lemon::Module& module) +{ +#ifdef USE_EXPERIMENTS + mExperiments.registerScriptBindings(module); +#endif +} + +void EngineDelegate::registerNativizedCode(lemon::Program& program) +{ +} + +void EngineDelegate::onRuntimeInit(CodeExec& codeExec) +{ +} + +void EngineDelegate::onPreFrameUpdate() +{ +#ifdef USE_EXPERIMENTS + mExperiments.onPreFrameUpdate(); +#endif +} + +void EngineDelegate::onPostFrameUpdate() +{ +#ifdef USE_EXPERIMENTS + mExperiments.onPostFrameUpdate(); +#endif +} + +void EngineDelegate::onControlsUpdate() +{ +} + +void EngineDelegate::onPreSaveStateLoad() +{ +} + +bool EngineDelegate::mayLoadScriptMods() +{ + return true; +} + +bool EngineDelegate::allowModdedData() +{ + return true; +} + +bool EngineDelegate::useDeveloperFeatures() +{ + return true; +} + +void EngineDelegate::onActiveModsChanged() +{ +} + +void EngineDelegate::onGameRecordingHeaderLoaded(const std::string& buildString, const std::vector& buffer) +{ +} + +void EngineDelegate::onGameRecordingHeaderSave(std::vector& buffer) +{ +} + +Font& EngineDelegate::getDebugFont(int size) +{ + if (size >= 10) + { + static Font font10; + if (font10.getLineHeight() == 0) + font10.loadFromFile("data/font/oxyfont_regular.json", 0.0f); + return font10; + } + else + { + static Font font3; + if (font3.getLineHeight() == 0) + font3.loadFromFile("data/font/smallfont.json", 0.0f); + return font3; + } +} + +void EngineDelegate::fillDebugVisualization(Bitmap& bitmap, int& mode) +{ +} diff --git a/sonic3air-main/Oxygen/oxygenengine/source/engineapp/EngineDelegate.h b/sonic3air-main/Oxygen/oxygenengine/source/engineapp/EngineDelegate.h new file mode 100644 index 00000000..52edd66e --- /dev/null +++ b/sonic3air-main/Oxygen/oxygenengine/source/engineapp/EngineDelegate.h @@ -0,0 +1,51 @@ +#pragma once + +#include "engineapp/ConfigurationImpl.h" +#include "engineapp/experiments/Experiments.h" +#include "engineapp/version.inc" + +#include "oxygen/application/EngineMain.h" + + +class EngineDelegate : public EngineDelegateInterface +{ +public: + const AppMetaData& getAppMetaData() override; + GuiBase& createGameApp() override; + AudioOutBase& createAudioOut() override; + + bool onEnginePreStartup() override; + bool setupCustomGameProfile() override; + + void startupGame(EmulatorInterface& emulatorInterface) override; + void shutdownGame() override; + void updateGame(float timeElapsed) override; + + void registerScriptBindings(lemon::Module& module) override; + void registerNativizedCode(lemon::Program& program) override; + + void onRuntimeInit(CodeExec& codeExec) override; + void onPreFrameUpdate() override; + void onPostFrameUpdate() override; + void onControlsUpdate() override; + void onPreSaveStateLoad() override; + + bool mayLoadScriptMods() override; + bool allowModdedData() override; + bool useDeveloperFeatures() override; + void onActiveModsChanged() override; + + void onGameRecordingHeaderLoaded(const std::string& buildString, const std::vector& buffer) override; + void onGameRecordingHeaderSave(std::vector& buffer) override; + + Font& getDebugFont(int size) override; + void fillDebugVisualization(Bitmap& bitmap, int& mode) override; + +private: + AppMetaData mAppMetaData; + ConfigurationImpl mConfiguration; + +#ifdef USE_EXPERIMENTS + Experiments mExperiments; +#endif +}; diff --git a/sonic3air-main/Oxygen/oxygenengine/source/engineapp/GameApp.cpp b/sonic3air-main/Oxygen/oxygenengine/source/engineapp/GameApp.cpp new file mode 100644 index 00000000..3915c8ff --- /dev/null +++ b/sonic3air-main/Oxygen/oxygenengine/source/engineapp/GameApp.cpp @@ -0,0 +1,44 @@ +#include "engineapp/pch.h" +#include "engineapp/GameApp.h" + +#include "oxygen/application/Application.h" +#include "oxygen/simulation/Simulation.h" + + +GameApp::GameApp() +{ +} + +GameApp::~GameApp() +{ +} + +void GameApp::initialize() +{ + Simulation& simulation = Application::instance().getSimulation(); + simulation.setRunning(true); +} + +void GameApp::deinitialize() +{ +} + +void GameApp::mouse(const rmx::MouseEvent& ev) +{ + GuiBase::mouse(ev); +} + +void GameApp::keyboard(const rmx::KeyboardEvent& ev) +{ + GuiBase::keyboard(ev); +} + +void GameApp::update(float timeElapsed) +{ + GuiBase::update(timeElapsed); +} + +void GameApp::render() +{ + GuiBase::render(); +}