raylibstarter 0.1.0
game::core::Actor Class Reference

Actor base class. Actors represent all game objects, such as players, enemies and other obstacles. More...

#include <actor.h>

Collaboration diagram for game::core::Actor:

Public Member Functions

 Actor ()=delete
 
 Actor (std::shared_ptr< game::core::Sprite > sprite)
 Constructor. More...
 
 Actor (const game::core::Actor &actor)=delete
 
Actoroperator= (const Actor &)=delete
 
virtual ~Actor ()
 
const std::shared_ptr< game::core::Sprite > & sprite () const
 Returns the sprite object of the actor. More...
 
void sprite (std::shared_ptr< game::core::Sprite > sprite)
 Replaces the current sprite object of the actor. More...
 

Private Attributes

std::shared_ptr< game::core::Spritesprite_
 

Detailed Description

Actor base class. Actors represent all game objects, such as players, enemies and other obstacles.

Graphically, actors are represented via a sprite object associated with them. The sprite must be passed in the constructor call.

Actors can be placed in the actor-map of a scene object and will be drawn automatically if their visible attribute is true. If actor objects are supposed to be available across scenes, they can be stored in game::core::actors. Objects that are only referenced there will not be drawn automatically. The position and appearance of an actor object in the game depends on attributes (e.g. position and rotation) of its sprite member.

Definition at line 16 of file actor.h.

Constructor & Destructor Documentation

◆ Actor() [1/3]

game::core::Actor::Actor ( )
delete

◆ Actor() [2/3]

game::core::Actor::Actor ( std::shared_ptr< game::core::Sprite sprite)
explicit

Constructor.

Create a new Actor object.

Parameters
spriteSprite object that is assigned to the Actor.

Definition at line 5 of file actor.cpp.

◆ Actor() [3/3]

game::core::Actor::Actor ( const game::core::Actor actor)
delete

◆ ~Actor()

game::core::Actor::~Actor ( )
virtual

Definition at line 9 of file actor.cpp.

Member Function Documentation

◆ operator=()

Actor & game::core::Actor::operator= ( const Actor )
delete

◆ sprite() [1/2]

const std::shared_ptr< game::core::Sprite > & game::core::Actor::sprite ( ) const

Returns the sprite object of the actor.

Returns
Shared pointer of the objects Sprite.

Definition at line 13 of file actor.cpp.

◆ sprite() [2/2]

void game::core::Actor::sprite ( std::shared_ptr< game::core::Sprite sprite)

Replaces the current sprite object of the actor.

Definition at line 17 of file actor.cpp.

Member Data Documentation

◆ sprite_

std::shared_ptr<game::core::Sprite> game::core::Actor::sprite_
private

Definition at line 18 of file actor.h.


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