10#ifndef TOYMAKERENGINE_APPLICATION_H
11#define TOYMAKERENGINE_APPLICATION_H
20#include "sound/system.hpp"
65 template <
typename TObject,
typename=
void>
87 static const std::string projectDataPath { SDL_GetBasePath() + std::string{
"data"} };
88 return projectDataPath;
112 template <
typename TObject>
113 TObject
getObject(
const std::string& path=
"");
133 template <
typename TObject,
typename Enable>
148 TObject
get(
const std::string& path=
"");
155 friend class Application;
163 void initialize(
const nlohmann::json& windowProperties);
216 template <
typename TObject>
221 template <
typename TObject,
typename Enable>
223 static_assert(
false &&
"No getter for this object type is known.");
227 template <
typename TObject>
230 typename
std::enable_if_t<
231 SceneNodeCore::getByPath_Helper<TObject>::s_valid
235 TObject
get(
const std::string& path) {
236 return mApplication->mSceneSystem.lock()->getByPath<TObject>(path);
238 Application* mApplication;
243 assert(path ==
"" &&
"Getter for InputManager does not accept any path parameter");
244 return mApplication->mInputManager;
Base template for engine object getter, used by Application::getObject().
Definition application.hpp:134
TObject get(const std::string &path="")
The actual method used when getting an application object.
Definition application.hpp:222
Application * mApplication
A pointer to the application object, which provides the methods used by the helper to actually fetch ...
Definition application.hpp:154
getByPath_Helper(Application *application)
Create the getByPath_Helper object.
Definition application.hpp:140
Class that handles setup for the rest of the engine and application.
Definition application.hpp:64
SignalTracker mSignalTracker
The signal tracker associated with this object, which broadcasts Application events and receives even...
Definition application.hpp:175
InputManager mInputManager
The input manager associated with this object.
Definition application.hpp:189
std::weak_ptr< SoundSystem > mSoundSystem
A pointer to this project's sound system, valid throughout the project.
Definition application.hpp:213
static bool s_instantiated
A small static helper variable to determine whether application instantiation has occurred,...
Definition application.hpp:201
static std::weak_ptr< Application > s_pInstance
A pointer to the (sole) instance of the Application for this project.
Definition application.hpp:195
SignalTracker & getSignalTracker()
Gets the signal tracker associated with the application.
Definition application.hpp:122
~Application()
Destroys the application object.
Definition application.cpp:224
std::weak_ptr< SceneSystem > mSceneSystem
A pointer to this project's scene system, valid throughout the project.
Definition application.hpp:207
void execute()
Runs the application loop after setup.
Definition application.cpp:115
void initialize(const nlohmann::json &windowProperties)
Initializes this project's 3rd party packages, creates an application window.
Definition application.cpp:241
static const std::string & getProjectDataPath()
Returns a const reference to the base path in which application data is stored.
Definition application.hpp:86
TObject getObject(const std::string &path="")
Gets an object of a specific type by its scene path.
Definition application.hpp:217
uint32_t mSimulationStep
The simulation step for the application specified in the app's project file.
Definition application.hpp:181
static Application & getInstance()
Gets the (sole) instance of Application for this project.
Definition application.cpp:236
void cleanup()
Clean up of 3rd party packages and window resources, if required.
Definition application.cpp:251
static std::shared_ptr< Application > instantiate()
Creates the single Application object used by the project and returns a reference to it.
Definition application.cpp:228
A signal tracker, the main interface between an object and the signal system.
Definition signals.hpp:164
ToyMaker Engine's implementation of an ECS system.
Namespace containing all class definitions and functions related to the ToyMaker engine.
Definition application.hpp:26
File containing ToyMaker's implementation of XPBD, extended position based dynamics.
Contains definitions relating to the render system defined for this object.
Headers relating to resources and their management for a given project.
System classes relating to the SceneSystem, which in some ways lies at the heart of the engine.
Classes relating to this engine's implementation of signals. Contains template classes used to define...
Contains classes and functions for managing the (at present, single) window of this application.