Sparkle 0.0.1
Loading...
Searching...
No Matches
spk::GameEngine Class Reference

Root container that manages entities and dispatches events. More...

#include <spk_game_engine.hpp>

Collaboration diagram for spk::GameEngine:
Collaboration graph

Public Member Functions

 GameEngine ()
 Creates a new game engine.
void clear ()
 Clears all entities from the engine.
spk::EntityrootObject ()
 Returns the root entity.
void addEntity (Entity *p_entity)
 Adds an entity to the engine.
void removeEntity (Entity *p_entity)
 Removes an entity from the engine.
EntitygetEntity (const std::wstring &p_name)
 Returns the first entity matching the name.
const EntitygetEntity (const std::wstring &p_name) const
 Returns the first entity matching the name.
std::vector< Entity * > getEntities (const std::wstring &p_name)
 Returns all entities matching the name.
std::vector< const Entity * > getEntities (const std::wstring &p_name) const
 Returns all entities matching the name.
EntitygetEntityByTag (const std::wstring &p_name)
 Returns the first entity matching a tag.
const EntitygetEntityByTag (const std::wstring &p_name) const
 Returns the first entity matching a tag.
std::vector< Entity * > getEntitiesByTag (const std::wstring &p_name)
 Returns all entities matching a tag.
std::vector< const Entity * > getEntitiesByTag (const std::wstring &p_name) const
 Returns all entities matching a tag.
bool contains (const std::wstring &p_name) const
 Checks if an entity with the name exists.
size_t count (const std::wstring &p_name) const
 Counts entities matching the name.
virtual void handleGeometryChange (const spk::Extend2D &p_geometry) final
 Dispatches geometry change events to entities.
virtual void handlePaintEvent (spk::PaintEvent &p_event) final
 Dispatches paint events to entities.
virtual void handleKeyPressEvent (spk::KeyPressEvent &p_event) final
 Dispatches key press events to entities.
virtual void handleKeyReleaseEvent (spk::KeyReleaseEvent &p_event) final
 Dispatches key release events to entities.
virtual void handleGlyphEvent (spk::GlyphEvent &p_event) final
 Dispatches glyph input events to entities.
virtual void handleMousePressEvent (spk::MousePressEvent &p_event) final
 Dispatches mouse press events to entities.
virtual void handleMouseReleaseEvent (spk::MouseReleaseEvent &p_event) final
 Dispatches mouse release events to entities.
virtual void handleMouseDoubleClickEvent (spk::MouseDoubleClickEvent &p_event) final
 Dispatches mouse double click events to entities.
virtual void handleMouseMotionEvent (spk::MouseMotionEvent &p_event) final
 Dispatches mouse motion events to entities.
virtual void handleMouseWheelEvent (spk::MouseWheelEvent &p_event) final
 Dispatches mouse wheel events to entities.
virtual void handleEnterResizeModeEvent (spk::EnterResizeModeEvent &p_event) final
 Dispatches enter resize mode events to entities.
virtual void handleResizeEvent (spk::ResizeEvent &p_event) final
 Dispatches resize events to entities.
virtual void handleExitResizeModeEvent (spk::ExitResizeModeEvent &p_event) final
 Dispatches exit resize mode events to entities.
virtual void handleQuitEvent (spk::QuitEvent &p_event) final
 Dispatches quit events to entities.
virtual void handleMoveEvent (spk::MoveEvent &p_event) final
 Dispatches move events to entities.
virtual void handleFullScreenModeEvent (spk::FullScreenModeEvent &p_event) final
 Dispatches fullscreen events to entities.
virtual void handleMaximizedModeEvent (spk::MaximizedModeEvent &p_event) final
 Dispatches maximized events to entities.
virtual void handleFocusEvent (spk::FocusEvent &p_event) final
 Dispatches focus events to entities.
virtual void handleUpdateEvent (spk::UpdateEvent &p_event) final
 Dispatches update events to entities.

Friends

class Entity

Detailed Description

Root container that manages entities and dispatches events.

Member Function Documentation

◆ addEntity()

void spk::GameEngine::addEntity ( spk::Entity * p_entity)

Adds an entity to the engine.

Parameters
p_entityEntity to add.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ contains()

bool spk::GameEngine::contains ( const std::wstring & p_name) const

Checks if an entity with the name exists.

Parameters
p_nameEntity name.
Returns
True if at least one match exists.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ count()

size_t spk::GameEngine::count ( const std::wstring & p_name) const

Counts entities matching the name.

Parameters
p_nameEntity name.
Returns
Number of matching entities.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getEntities() [1/2]

std::vector< spk::Entity * > spk::GameEngine::getEntities ( const std::wstring & p_name)

Returns all entities matching the name.

Parameters
p_nameEntity name.
Returns
Vector of matching entities.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getEntities() [2/2]

std::vector< const Entity * > spk::GameEngine::getEntities ( const std::wstring & p_name) const

Returns all entities matching the name.

Parameters
p_nameEntity name.
Returns
Vector of matching entities.
Here is the call graph for this function:

◆ getEntitiesByTag() [1/2]

std::vector< Entity * > spk::GameEngine::getEntitiesByTag ( const std::wstring & p_name)

Returns all entities matching a tag.

Parameters
p_nameTag name.
Returns
Vector of matching entities.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getEntitiesByTag() [2/2]

std::vector< const Entity * > spk::GameEngine::getEntitiesByTag ( const std::wstring & p_name) const

Returns all entities matching a tag.

Parameters
p_nameTag name.
Returns
Vector of matching entities.
Here is the call graph for this function:

◆ getEntity() [1/2]

spk::Entity * spk::GameEngine::getEntity ( const std::wstring & p_name)

Returns the first entity matching the name.

Parameters
p_nameEntity name.
Returns
Matching entity or nullptr.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getEntity() [2/2]

const Entity * spk::GameEngine::getEntity ( const std::wstring & p_name) const

Returns the first entity matching the name.

Parameters
p_nameEntity name.
Returns
Matching entity or nullptr.
Here is the call graph for this function:

◆ getEntityByTag() [1/2]

Entity * spk::GameEngine::getEntityByTag ( const std::wstring & p_name)

Returns the first entity matching a tag.

Parameters
p_nameTag name.
Returns
Matching entity or nullptr.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getEntityByTag() [2/2]

const Entity * spk::GameEngine::getEntityByTag ( const std::wstring & p_name) const

Returns the first entity matching a tag.

Parameters
p_nameTag name.
Returns
Matching entity or nullptr.
Here is the call graph for this function:

◆ handleEnterResizeModeEvent()

void spk::GameEngine::handleEnterResizeModeEvent ( spk::EnterResizeModeEvent & p_event)
finalvirtual

Dispatches enter resize mode events to entities.

Parameters
p_eventEnter resize mode event.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleExitResizeModeEvent()

void spk::GameEngine::handleExitResizeModeEvent ( spk::ExitResizeModeEvent & p_event)
finalvirtual

Dispatches exit resize mode events to entities.

Parameters
p_eventExit resize mode event.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleFocusEvent()

void spk::GameEngine::handleFocusEvent ( spk::FocusEvent & p_event)
finalvirtual

Dispatches focus events to entities.

Parameters
p_eventFocus event.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleFullScreenModeEvent()

void spk::GameEngine::handleFullScreenModeEvent ( spk::FullScreenModeEvent & p_event)
finalvirtual

Dispatches fullscreen events to entities.

Parameters
p_eventFullscreen event.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGeometryChange()

void spk::GameEngine::handleGeometryChange ( const spk::Extend2D & p_geometry)
finalvirtual

Dispatches geometry change events to entities.

Parameters
p_geometryUpdated geometry.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleGlyphEvent()

void spk::GameEngine::handleGlyphEvent ( spk::GlyphEvent & p_event)
finalvirtual

Dispatches glyph input events to entities.

Parameters
p_eventGlyph event.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleKeyPressEvent()

void spk::GameEngine::handleKeyPressEvent ( spk::KeyPressEvent & p_event)
finalvirtual

Dispatches key press events to entities.

Parameters
p_eventKey press event.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleKeyReleaseEvent()

void spk::GameEngine::handleKeyReleaseEvent ( spk::KeyReleaseEvent & p_event)
finalvirtual

Dispatches key release events to entities.

Parameters
p_eventKey release event.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleMaximizedModeEvent()

void spk::GameEngine::handleMaximizedModeEvent ( spk::MaximizedModeEvent & p_event)
finalvirtual

Dispatches maximized events to entities.

Parameters
p_eventMaximized event.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleMouseDoubleClickEvent()

void spk::GameEngine::handleMouseDoubleClickEvent ( spk::MouseDoubleClickEvent & p_event)
finalvirtual

Dispatches mouse double click events to entities.

Parameters
p_eventMouse double click event.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleMouseMotionEvent()

void spk::GameEngine::handleMouseMotionEvent ( spk::MouseMotionEvent & p_event)
finalvirtual

Dispatches mouse motion events to entities.

Parameters
p_eventMouse motion event.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleMousePressEvent()

void spk::GameEngine::handleMousePressEvent ( spk::MousePressEvent & p_event)
finalvirtual

Dispatches mouse press events to entities.

Parameters
p_eventMouse press event.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleMouseReleaseEvent()

void spk::GameEngine::handleMouseReleaseEvent ( spk::MouseReleaseEvent & p_event)
finalvirtual

Dispatches mouse release events to entities.

Parameters
p_eventMouse release event.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleMouseWheelEvent()

void spk::GameEngine::handleMouseWheelEvent ( spk::MouseWheelEvent & p_event)
finalvirtual

Dispatches mouse wheel events to entities.

Parameters
p_eventMouse wheel event.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleMoveEvent()

void spk::GameEngine::handleMoveEvent ( spk::MoveEvent & p_event)
finalvirtual

Dispatches move events to entities.

Parameters
p_eventMove event.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handlePaintEvent()

void spk::GameEngine::handlePaintEvent ( spk::PaintEvent & p_event)
finalvirtual

Dispatches paint events to entities.

Parameters
p_eventPaint event.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleQuitEvent()

void spk::GameEngine::handleQuitEvent ( spk::QuitEvent & p_event)
finalvirtual

Dispatches quit events to entities.

Parameters
p_eventQuit event.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleResizeEvent()

void spk::GameEngine::handleResizeEvent ( spk::ResizeEvent & p_event)
finalvirtual

Dispatches resize events to entities.

Parameters
p_eventResize event.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleUpdateEvent()

void spk::GameEngine::handleUpdateEvent ( spk::UpdateEvent & p_event)
finalvirtual

Dispatches update events to entities.

Parameters
p_eventUpdate event.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeEntity()

void spk::GameEngine::removeEntity ( spk::Entity * p_entity)

Removes an entity from the engine.

Parameters
p_entityEntity to remove.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rootObject()

spk::Entity & spk::GameEngine::rootObject ( )

Returns the root entity.

Returns
Root entity reference.
Here is the call graph for this function:
Here is the caller graph for this function:

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