Engine²
Open-source game engine written in C++.
Loading...
Searching...
No Matches
Engine::APlugin Class Referenceabstract

Abstract plugin class that add some utility functions to make it easier to register systems and resources. More...

#include <APlugin.hpp>

Inheritance diagram for Engine::APlugin:
Engine::IPlugin CameraMovement::Plugin DefaultPipeline::Plugin Event::Plugin Graphic::Plugin Input::Plugin NativeScripting::Plugin Physics::Plugin PluginTestA PluginTestB RenderingPipeline::Plugin Rmlui::Plugin Scene::Plugin Sound::Plugin Window::Plugin

Public Member Functions

 APlugin (Core &core)
 Constructor for APlugin. It takes a reference to the Core, which is used to register systems and resources in the Bind method.
virtual void Bind (void)=0
 Pure virtual method that must be implemented by derived plugin classes. This method is called when the plugin is added to the engine, and is where the plugin should register its systems, resources, and any other functionality it provides to the engine.
template<CScheduler TScheduler, typename... Systems>
decltype(auto) RegisterSystems (Systems... systems)
 Register systems to a scheduler.
template<typename TResource>
TResource & RegisterResource (TResource &&resource)
 Register a resource in the core.
template<CPlugin... TPlugins>
void RequirePlugins ()
 Add a plugin to the core.
template<CScheduler TScheduler, typename... Args>
TScheduler & RegisterScheduler (Args &&...args)
 Register a scheduler in the core.
CoreGetCore ()
 Get a reference to the core. This can be used to register systems and resources in the Bind method.
Public Member Functions inherited from Engine::IPlugin
virtual ~IPlugin ()=default
 Virtual destructor for IPlugin.

Private Member Functions

template<CPlugin TPlugin>
void RequirePlugin ()
 Add a plugin to the core if it is not already added.

Private Attributes

Core_core
 Reference to the core, which is used to register systems and resources in the Bind method.

Detailed Description

Abstract plugin class that add some utility functions to make it easier to register systems and resources.

Constructor & Destructor Documentation

◆ APlugin()

Engine::APlugin::APlugin ( Core & core)
inlineexplicit

Constructor for APlugin. It takes a reference to the Core, which is used to register systems and resources in the Bind method.

Parameters
coreReference to the Core, which is used to register systems and resources in the Bind method.
Todo
put the implementation in the cpp file

Member Function Documentation

◆ Bind()

virtual void Engine::APlugin::Bind ( void )
pure virtual

Pure virtual method that must be implemented by derived plugin classes. This method is called when the plugin is added to the engine, and is where the plugin should register its systems, resources, and any other functionality it provides to the engine.

See also
Engine::Core
Engine::APlugin

Implements Engine::IPlugin.

Implemented in CameraMovement::Plugin, DefaultPipeline::Plugin, Event::Plugin, Graphic::Plugin, Input::Plugin, NativeScripting::Plugin, Physics::Plugin, PluginTestA, PluginTestB, RenderingPipeline::Plugin, Rmlui::Plugin, Scene::Plugin, Sound::Plugin, and Window::Plugin.

◆ GetCore()

Core & Engine::APlugin::GetCore ( )
inline

Get a reference to the core. This can be used to register systems and resources in the Bind method.

Returns
A reference to the core.
See also
Engine::Core
Todo
put the implementation in the cpp file

◆ RegisterResource()

template<typename TResource>
TResource & Engine::APlugin::RegisterResource ( TResource && resource)
inline

Register a resource in the core.

Template Parameters
TResourceThe type of the resource to register.
Parameters
resourceThe resource to register.
Returns
A reference to the registered resource.
See also
Engine::Core::RegisterResource
Todo
put the implementation in the inl file

◆ RegisterScheduler()

template<CScheduler TScheduler, typename... Args>
TScheduler & Engine::APlugin::RegisterScheduler ( Args &&... args)
inline

Register a scheduler in the core.

Template Parameters
...ArgsThe types of the arguments to pass to the scheduler constructor.
TSchedulerThe type of the scheduler to register.
Parameters
...argsThe arguments to pass to the scheduler constructor.
Returns
A reference to the registered scheduler.
See also
Engine::Core::RegisterScheduler
Engine::CScheduler
Todo
put the implementation in the inl file

◆ RegisterSystems()

template<CScheduler TScheduler, typename... Systems>
decltype(auto) Engine::APlugin::RegisterSystems ( Systems... systems)
inline

Register systems to a scheduler.

Template Parameters
TSchedulerThe type of the scheduler to register the systems to.
...SystemsThe types of the systems to register. They should be invocable with a Core reference as the first parameter.
Parameters
...systemsThe systems to register. They should be invocable with a Core reference as the first parameter.
Returns
The registered systems.
See also
Engine::Core::RegisterSystem
Engine::CScheduler
Todo
put the implementation in the inl file

◆ RequirePlugin()

template<CPlugin TPlugin>
void Engine::APlugin::RequirePlugin ( )
inlineprivate

Add a plugin to the core if it is not already added.

Template Parameters
TPluginThe type of the plugin to add.
See also
Engine::APlugin::RequirePlugins
Engine::Core::HasPlugin
Engine::Core::AddPlugins
Todo
put the implementation in the inl file

◆ RequirePlugins()

template<CPlugin... TPlugins>
void Engine::APlugin::RequirePlugins ( )
inline

Add a plugin to the core.

Template Parameters
...TPluginsThe types of the plugins to add. They should be derived from APlugin.
See also
Engine::APlugin::RequirePlugin
Todo
put the implementation in the inl file

Member Data Documentation

◆ _core

Core& Engine::APlugin::_core
private

Reference to the core, which is used to register systems and resources in the Bind method.


The documentation for this class was generated from the following file: