#include <EntityView.h>
|
| | EntityView (const std::shared_ptr< logic::EntityModel > &model, float frameDuration) |
| bool | shouldDelete () const |
| size_t | getFrameIndex (float dt, size_t frameLimit) |
| | Calculates the current frameIndex based on the elapsed time.
|
| virtual void | resized () |
| | Determines how the sprites should react when the Screen dimension changes.
|
| virtual void | render () |
| | Determines what needs to happen to sprites when they should be rendered.
|
| virtual | ~Observer ()=default |
| virtual void | update (Events event)=0 |
| | Update method that is called by the observed Subjects.
|
◆ EntityView()
| EntityView::EntityView |
( |
const std::shared_ptr< logic::EntityModel > & | model, |
|
|
float | frameDuration ) |
|
explicit |
Abstract EntityView class. Initiates sprite offset to 0.8, 0.8 as that is centered on my 16x16 pixel representation.
- Parameters
-
| model | Reference model |
| frameDuration | Length of a single frame |
◆ getFrameIndex()
| size_t EntityView::getFrameIndex |
( |
float | dt, |
|
|
size_t | frameLimit ) |
|
nodiscard |
Calculates the current frameIndex based on the elapsed time.
- Parameters
-
| dt | Stopwatch time. |
| frameLimit | Maximum frame index. |
- Returns
- Current frame index.
◆ render()
| void EntityView::render |
( |
| ) |
|
|
virtual |
Determines what needs to happen to sprites when they should be rendered.
Reimplemented in GhostView, and PacmanView.
◆ resized()
| void EntityView::resized |
( |
| ) |
|
|
virtual |
Determines how the sprites should react when the Screen dimension changes.
Reimplemented in PacmanView.
◆ shouldDelete()
| bool EntityView::shouldDelete |
( |
| ) |
const |
|
nodiscard |
- Returns
- Whether Entity is marked for deletion.
◆ elapsedTime
| float EntityView::elapsedTime = 0 |
|
protected |
◆ frameDuration
| float EntityView::frameDuration |
|
protected |
◆ frameIndex
| size_t EntityView::frameIndex = 0 |
|
protected |
◆ markedForDeletion
| bool EntityView::markedForDeletion = false |
|
protected |
◆ model
◆ sprite
| sf::Sprite EntityView::sprite |
|
protected |
The documentation for this class was generated from the following files: