Peoplemon  0.1.0
Peoplemon 3 game source documentation
Public Member Functions | Static Public Member Functions | Friends | List of all members
core::component::Renderable Class Reference

Adding this component to an entity will allow it to be rendered. More...

#include <Renderable.hpp>

Public Member Functions

 Renderable ()
 Does nothing. More...
 
float animLength () const
 Returns the length of the contained animation, or 0.f if no animation. More...
 
void triggerAnim (bool loop)
 Triggers the current animation if any. More...
 
void notifyMoveState (bl::tmap::Direction dir, bool moving, bool running)
 Call when the entity starts or stops moving or changes direction. More...
 
void setAngle (float angle)
 Sets the angle to render the entity at. More...
 
bl::com::Transform2D & getTransform ()
 Returns the render transform. More...
 
void setHidden (bool hide)
 Set whether the entity is hidden or not. More...
 

Static Public Member Functions

static RenderablecreateFromSprite (bl::engine::Engine &engine, bl::ecs::Entity entity, bl::rc::Scene *scene, const std::string &path)
 Creates a renderable component for a static sprite. More...
 
static RenderablecreateFromMoveAnims (bl::engine::Engine &engine, bl::ecs::Entity entity, bl::rc::Scene *scene, const std::string &path)
 Creates a renderable component for movement animations. More...
 
static RenderablecreateFromFastMoveAnims (bl::engine::Engine &engine, bl::ecs::Entity entity, bl::rc::Scene *scene, const std::string &path)
 Creates a renderable component for movement animations with running. More...
 
static RenderablecreateFromAnimation (bl::engine::Engine &engine, bl::ecs::Entity entity, bl::rc::Scene *scene, const std::string &path)
 Creates a renderable component from a single animation. More...
 

Friends

class system::Render
 

Detailed Description

Adding this component to an entity will allow it to be rendered.

Definition at line 28 of file Renderable.hpp.

Constructor & Destructor Documentation

◆ Renderable()

core::component::Renderable::Renderable ( )

Does nothing.

Definition at line 100 of file Renderable.cpp.

Member Function Documentation

◆ animLength()

float core::component::Renderable::animLength ( ) const

Returns the length of the contained animation, or 0.f if no animation.

Definition at line 110 of file Renderable.cpp.

◆ createFromAnimation()

Renderable & core::component::Renderable::createFromAnimation ( bl::engine::Engine &  engine,
bl::ecs::Entity  entity,
bl::rc::Scene *  scene,
const std::string &  path 
)
static

Creates a renderable component from a single animation.

Parameters
engineThe game engine instance
sceneThe scene to add to
entityThe entity to construct the component on
pathThe path of the animation
Returns
Renderable The created component

Definition at line 71 of file Renderable.cpp.

◆ createFromFastMoveAnims()

Renderable & core::component::Renderable::createFromFastMoveAnims ( bl::engine::Engine &  engine,
bl::ecs::Entity  entity,
bl::rc::Scene *  scene,
const std::string &  path 
)
static

Creates a renderable component for movement animations with running.

Parameters
engineThe game engine instance
entityThe entity to construct the component on
sceneThe scene to add to
pathThe path to the movement animations
Returns
Renderable A usable component

Definition at line 49 of file Renderable.cpp.

◆ createFromMoveAnims()

Renderable & core::component::Renderable::createFromMoveAnims ( bl::engine::Engine &  engine,
bl::ecs::Entity  entity,
bl::rc::Scene *  scene,
const std::string &  path 
)
static

Creates a renderable component for movement animations.

Parameters
engineThe game engine instance
entityThe entity to construct the component on
sceneThe scene to add to
pathThe path to the movement animations
Returns
Renderable A usable component

Definition at line 28 of file Renderable.cpp.

◆ createFromSprite()

Renderable & core::component::Renderable::createFromSprite ( bl::engine::Engine &  engine,
bl::ecs::Entity  entity,
bl::rc::Scene *  scene,
const std::string &  path 
)
static

Creates a renderable component for a static sprite.

Parameters
engineThe game engine instance
entityThe entity to construct the component on
sceneThe scene to add to
pathThe path to the sprite
Returns
Renderable A usable component

Definition at line 12 of file Renderable.cpp.

◆ getTransform()

bl::com::Transform2D& core::component::Renderable::getTransform ( )
inline

Returns the render transform.

Definition at line 114 of file Renderable.hpp.

◆ notifyMoveState()

void core::component::Renderable::notifyMoveState ( bl::tmap::Direction  dir,
bool  moving,
bool  running 
)

Call when the entity starts or stops moving or changes direction.

Parameters
dirThe direction the entity is facing
movingWhether or not the entity is moving
runningWhether or not the entity is running

Definition at line 130 of file Renderable.cpp.

◆ setAngle()

void core::component::Renderable::setAngle ( float  angle)

Sets the angle to render the entity at.

Parameters
angleRotation in degrees

Definition at line 108 of file Renderable.cpp.

◆ setHidden()

void core::component::Renderable::setHidden ( bool  hide)

Set whether the entity is hidden or not.

Parameters
hideTrue to hide, false to render

Definition at line 144 of file Renderable.cpp.

◆ triggerAnim()

void core::component::Renderable::triggerAnim ( bool  loop)

Triggers the current animation if any.

Parameters
loopTrue to loop, false to play once

Definition at line 123 of file Renderable.cpp.

Friends And Related Function Documentation

◆ system::Render

friend class system::Render
friend

Definition at line 136 of file Renderable.hpp.

Member Data Documentation

◆ animSrc

bl::gfx::a2d::AnimationData* core::component::Renderable::animSrc

Definition at line 128 of file Renderable.hpp.

◆ runSrc

res::RunWalkAnimations* core::component::Renderable::runSrc

Definition at line 127 of file Renderable.hpp.

◆ walkSrc

res::WalkAnimations* core::component::Renderable::walkSrc

Definition at line 126 of file Renderable.hpp.


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