10#ifndef TOYMAKERENGINE_APPLICATION_H
11#define TOYMAKERENGINE_APPLICATION_H
64 template <
typename TObject,
typename=
void>
93 static std::shared_ptr<Application>
instantiate(
const std::string& projectPath);
102 template <
typename TObject>
103 TObject
getObject(
const std::string& path=
"");
128 template <
typename TObject,
typename Enable>
143 TObject
get(
const std::string& path=
"");
150 friend class Application;
158 void initialize(
const nlohmann::json& windowProperties);
205 template <
typename TObject>
210 template <
typename TObject,
typename Enable>
212 static_assert(
false &&
"No getter for this object type is known.");
216 template <
typename TObject>
219 typename
std::enable_if_t<
220 SceneNodeCore::getByPath_Helper<TObject>::s_valid
224 TObject
get(
const std::string& path) {
225 return mApplication->mSceneSystem.lock()->getByPath<TObject>(path);
227 Application* mApplication;
232 assert(path ==
"" &&
"Getter for InputManager does not accept any path parameter");
233 return mApplication->mInputManager;
Base template for engine object getter, used by Application::getObject().
Definition application.hpp:129
TObject get(const std::string &path="")
The actual method used when getting an application object.
Definition application.hpp:211
Application * mApplication
A pointer to the application object, which provides the methods used by the helper to actually fetch ...
Definition application.hpp:149
getByPath_Helper(Application *application)
Create the getByPath_Helper object.
Definition application.hpp:135
SignalTracker mSignalTracker
The signal tracker associated with this object, which broadcasts Application events and receives even...
Definition application.hpp:170
InputManager mInputManager
The input manager associated with this object.
Definition application.hpp:184
static bool s_instantiated
A small static helper variable to determine whether application instantiation has occurred,...
Definition application.hpp:196
Application(const std::string &projectPath)
Constructs a new Application object.
Definition application.cpp:61
static std::weak_ptr< Application > s_pInstance
A pointer to the (sole) instance of the Application for this project.
Definition application.hpp:190
static std::shared_ptr< Application > instantiate(const std::string &projectPath)
Creates the single Application object used by the project and returns a reference to it.
Definition application.cpp:223
SignalTracker & getSignalTracker()
Gets the signal tracker associated with the application.
Definition application.hpp:112
~Application()
Destroys the application object.
Definition application.cpp:219
std::weak_ptr< SceneSystem > mSceneSystem
A pointer to this project's scene system, valid throughout the project.
Definition application.hpp:202
void execute()
Runs the application loop after setup.
Definition application.cpp:112
void initialize(const nlohmann::json &windowProperties)
Initializes this project's 3rd party packages, creates an application window.
Definition application.cpp:236
TObject getObject(const std::string &path="")
Gets an object of a specific type by its scene path.
Definition application.hpp:206
uint32_t mSimulationStep
The simulation step for the application specified in the app's project file.
Definition application.hpp:176
static Application & getInstance()
Gets the (sole) instance of Application for this project.
Definition application.cpp:231
void cleanup()
Clean up of 3rd party packages and window resources, if required.
Definition application.cpp:246
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:25
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.