Raylib Bubbles
C++11 Raylib bubble shooter game.
GameActionMgr::AnimState Struct Reference

Represents the state of an object to be animated. More...

#include <action.hpp>

Public Types

enum class  AnimType { BUBBLE , BUBBLE_GLOW , PARTICLE }
 Selects the type of object being animated, to later determine what to draw. More...
 

Public Member Functions

 AnimState (const float x, const float y, const float xVel, const float yVel, const AnimType type, const size_t hue, const ssize_t duration, const bool hasGravity)
 Constructs an animation state with the given data. More...
 

Static Public Member Functions

Alternative constructors for common animations.
static AnimState bubble (const float x, const float y, const float xVel, const float yVel, const size_t hue)
 
static AnimState gravityBubble (const float x, const float y, const float xVel, const float yVel, const size_t hue)
 
static AnimState particle (const float x, const float y, const float xVel, const float yVel, const ssize_t duration)
 
static AnimState gravityParticle (const float x, const float y, const float xVel, const float yVel, const ssize_t duration)
 

Public Attributes

size_t hue
 
ssize_t duration
 
AnimType type
 
float x
 
float y
 
float xVel
 
float yVel
 
bool hasGravity
 

Detailed Description

Represents the state of an object to be animated.

This struct is used to represent the state of an object to be animated, such as a bubble or particle. It lays out multiple parameters that are essential to animating an object, as well as cleanly describing how to make the objects behave, such as applying gravity or setting a duration in frames.

Member Enumeration Documentation

◆ AnimType

Selects the type of object being animated, to later determine what to draw.

Todo:
Can be extended to other things other than bubbles.

Constructor & Destructor Documentation

◆ AnimState()

GameActionMgr::AnimState::AnimState ( const float  x,
const float  y,
const float  xVel,
const float  yVel,
const AnimType  type,
const size_t  hue,
const ssize_t  duration,
const bool  hasGravity 
)
inline

Constructs an animation state with the given data.

Parameters
xThe x coordinate of the object.
yThe y coordinate of the object.
xVelThe velocity of the object in the x axis.
yVelThe velocity of the object in the y axis.
typeThe type of object being animated.
hueThe hue of the object, for drawing purposes.
durationThe duration of the animation, in steps. -1 disables the check. (ssize_t).
Warning
The duration parameter is supposed to be used only for very short animations, as it is not scaled by delta time.
See also
AnimType, ActionType

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