Simple C++ Game
Public Member Functions | Protected Member Functions | List of all members
RenderSystem Class Reference

A system that manages Entity sprite sizes, positions, and drawing. More...

#include <RenderSystem.hpp>

Inheritance diagram for RenderSystem:
Inheritance graph
[legend]
Collaboration diagram for RenderSystem:
Collaboration graph
[legend]

Public Member Functions

 RenderSystem ()
 Construct a new RenderSystem.
 
void render (sf::RenderTarget &target) const
 Draws the prepared sprites to the sf::RenderTarget. More...
 
- Public Member Functions inherited from IteratingSystem
 IteratingSystem ()
 Construct a new IteratingSystem with the default EntitySystem constructor. More...
 
 IteratingSystem (const std::shared_ptr< EntityFamily > &family)
 Construct a new IteratingSystem with the EntityFamily EntitySystem constructor. More...
 
void update (const sf::Time deltaTime)
 Iterates through each element in the system to perform updates. More...
 
- Public Member Functions inherited from EntitySystem
 EntitySystem ()
 Construct a new default EntitySystem. More...
 
 EntitySystem (const std::shared_ptr< EntityFamily > &family)
 Construct a new EntitySystem that acts on a specified family. More...
 
virtual void engineEntityAdded (const std::shared_ptr< Entity > &entity)
 Performs any operations required after an entity has been added to an EntityEngine the system is a part of. More...
 

Protected Member Functions

void process (std::shared_ptr< Entity > &entity, sf::Time deltaTime)
 Processes the Entity graphical data. More...
 
- Protected Member Functions inherited from EntitySystem
virtual std::map< int, std::shared_ptr< Entity > > getEntities () const
 Get the Entities in the system. More...
 

Detailed Description

A system that manages Entity sprite sizes, positions, and drawing.

It acts on all elements with a RenderComponent and LocationComponent

Member Function Documentation

◆ process()

void RenderSystem::process ( std::shared_ptr< Entity > &  entity,
sf::Time  deltaTime 
)
protectedvirtual

Processes the Entity graphical data.

Sprites are moved and scaled to align with the Entity LocationComponent data.

Parameters
entityThe entity being processed
deltaTimeThe amount of time that has passed since process() was last called on this entity

Implements IteratingSystem.

◆ render()

void RenderSystem::render ( sf::RenderTarget &  target) const

Draws the prepared sprites to the sf::RenderTarget.

This method assumes that it is part of a larger pipeline and that entities may not be the only thing being rendered. Methods such as sf::RenderWindow.display() need to be called after RenderSystem::render() to ensure everything is displayed correctly.

Parameters
targetThe target to draw the entities on.

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