Aether
SDL2 based UI Framework for NX
Public Member Functions | List of all members
Aether::Animation Class Reference

An animation is an element containing a list of textures which are changed through to create the animation. Frames are managed by using *Element calls. More...

#include <Animation.hpp>

Inheritance diagram for Aether::Animation:
Aether::Element

Public Member Functions

 Animation (int x, int y, int w, int h)
 Construct a new Animation object. More...
 
void update (unsigned int dt)
 Updates handles switching between frames. More...
 
void render ()
 All children aren't rendered - only the current one.
 
void pause ()
 Pause the animation.
 
void resume ()
 Resume the animation.
 
bool isPaused ()
 Check if animation is paused. More...
 
void setAnimateSpeed (int t)
 Set time for each frame. More...
 
unsigned int animateSpeed ()
 Returns animation time. More...
 
bool setFrameIndex (unsigned int i)
 Set current frame to element at given index. More...
 
bool setFrameElement (Element *e)
 Set current frame to given element. More...
 
- Public Member Functions inherited from Aether::Element
 Element (int x=0, int y=0, int w=100, int h=100)
 Construct a new Element object. More...
 
int x ()
 Returns x-coordinate of element. More...
 
int y ()
 Returns y-coordinate of element. More...
 
int w ()
 Returns width of element. More...
 
int h ()
 Returns height of element. More...
 
virtual void setX (int x)
 Set x-coordinate of element. More...
 
virtual void setY (int y)
 Set y-coordinate of element. More...
 
virtual void setW (int w)
 Set width of element. More...
 
virtual void setH (int h)
 Set height of element. More...
 
virtual void setXY (int x, int y)
 Set co-ordinates of element. More...
 
virtual void setWH (int w, int h)
 Set size of element. More...
 
virtual void setXYWH (int x, int y, int w, int h)
 Setter size and co-ordinates of element. More...
 
Elementparent ()
 Returns the parent element of this element. More...
 
void setParent (Element *p)
 Set the parent element of this element. More...
 
virtual void addElement (Element *e)
 Adds new element a child. More...
 
virtual bool removeElement (Element *e)
 Attempt to delete given child element. More...
 
virtual void removeAllElements ()
 Deletes all children elements.
 
virtual bool returnElement (Element *e)
 Attempt to remove the given child element. More...
 
virtual void returnAllElements ()
 Removes (but does not delete) all children elements.
 
bool isVisible ()
 Check if current element is visible on-screen. More...
 
bool hidden ()
 Check if current element is hidden. More...
 
void setHidden (bool b)
 Set whether element is hidden or not. More...
 
bool selected ()
 Check if current element is selected. More...
 
virtual void setSelected (bool b)
 Set whether element is selected or not. More...
 
bool selectable ()
 Check if current element is selectable. More...
 
void setSelectable (bool b)
 Set whether element is selectable or not. More...
 
bool touchable ()
 Check if current element is touch responsive. More...
 
void setTouchable (bool b)
 Set whether element is touch responsive or not. More...
 
bool highlighted ()
 Check if current element is highlighted. More...
 
void setHighlighted (bool b)
 Set whether element is highlighted or not. More...
 
bool hasHighlighted ()
 Check if current element has highlighted children element. More...
 
void setHasHighlighted (bool b)
 Set whether element has highlighted children element or not. More...
 
bool hasSelectable ()
 Check if current element has selectable children element. More...
 
void setHasSelectable (bool b)
 Set whether element has selectable children element or not. More...
 
bool hasSelected ()
 Check if current element has selected children element. More...
 
void setHasSelected (bool b)
 Set whether element has selected children element or not. More...
 
virtual void setActive ()
 Set element as activated.
 
virtual void setInactive ()
 Set element as in-activated.
 
void setFocused (Element *e)
 Sets current element as unfocused and instead focuses a sub-element. More...
 
void setFocussed (Element *e)
 Sets current element as unfocused and instead focuses a sub-element. More...
 
Elementfocused ()
 Returns the currently focused element. More...
 
Elementfocussed ()
 Returns the currently focused element. More...
 
std::function< void()> onPressFunc ()
 Returns function invoked when the element is pressed. More...
 
void onPress (std::function< void()> f)
 Sets the function to invoked when the element is pressed. More...
 
virtual bool handleEvent (InputEvent *e)
 Attempt to handle a given event. More...
 
virtual DrawablerenderHighlightBG ()
 Renders the highlight background. More...
 
virtual DrawablerenderHighlight ()
 Renders the highlight border. More...
 
virtual DrawablerenderSelection ()
 Renders the selection overlay. More...
 
virtual ~Element ()
 Destroy the Element object.
 

Additional Inherited Members

- Protected Member Functions inherited from Aether::Element
void renderHighlightTextures ()
 Renders cached highlight textures.
 
void renderSelectionTexture ()
 Renders cached selection texture.
 
void addElementAt (Element *e, size_t i)
 Add element at given index in vector. More...
 
- Protected Attributes inherited from Aether::Element
Elementparent_
 Pointer to parent element, if there is one.
 
std::vector< Element * > children
 Vector of child elements (used to call their methods)
 
Elementfocused_
 Children element which is highlighted/focused (to regain focus on activation)
 
- Static Protected Attributes inherited from Aether::Element
static Colour hiBGColour
 Background colour if element is highlighted.
 
static Colour hiBorderColour
 Border colour if element is highlighted.
 
static Colour selColour
 Selected colour if element is highlighted.
 
static unsigned int hiSize
 Size of highlight border.
 
static DrawablehiBGTex
 Highlight background texture.
 
static DrawablehiBorderTex
 Highlight border texture.
 
static DrawableselTex
 Selection texture.
 
static Rendererrenderer
 
static bool isTouch
 Indicator on whether the touch is "active" (i.e. hide highlighting) or not.
 

Detailed Description

An animation is an element containing a list of textures which are changed through to create the animation. Frames are managed by using *Element calls.

Note
Removing an element will delete it!
Resizing this element does not resize the frames - it is up to you!

Constructor & Destructor Documentation

◆ Animation()

Aether::Animation::Animation ( int  x,
int  y,
int  w,
int  h 
)

Construct a new Animation object.

Parameters
xx-coordinate of start position offset
yy-coordinate of start position offset
wwidth of animation
hheight of animation

Member Function Documentation

◆ animateSpeed()

unsigned int Aether::Animation::animateSpeed ( )

Returns animation time.

Returns
animation time

◆ isPaused()

bool Aether::Animation::isPaused ( )

Check if animation is paused.

Returns
true if animation is paused
false otherwise

◆ setAnimateSpeed()

void Aether::Animation::setAnimateSpeed ( int  t)

Set time for each frame.

Parameters
ttime for each frame

◆ setFrameElement()

bool Aether::Animation::setFrameElement ( Element e)

Set current frame to given element.

Parameters
eelement to set to
Returns
true if element is not a part of the animation
false otherwise

◆ setFrameIndex()

bool Aether::Animation::setFrameIndex ( unsigned int  i)

Set current frame to element at given index.

Parameters
ielement index
Returns
true if within range
false otherwise

◆ update()

void Aether::Animation::update ( unsigned int  dt)
virtual

Updates handles switching between frames.

Parameters
dtchange in time

Reimplemented from Aether::Element.


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