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

A system that uses player input to drive a paddle. More...

#include <PlayerInputSystem.hpp>

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

Public Member Functions

 PlayerInputSystem ()
 Construct a new PlayerInputSystem.
 
- 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)
 Updates the behavior of a player paddle based on the current keyboard inputs. 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 uses player input to drive a paddle.

It acts on entities with a LocationComponent, VelocityComponent, and PlayerComponent.

Member Function Documentation

◆ process()

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

Updates the behavior of a player paddle based on the current keyboard inputs.

The paddle moves up if W or Up are pressed and down if S or Down are pressed.

Parameters
entityThe current player being processed
deltaTimeThe time that has passed since process() was last called on this entity.

Implements IteratingSystem.


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