rag
graphic 2d engine
Classes | Public Member Functions | Public Attributes | List of all members
rag::MovieClip Class Reference

Allows to use imported animations created by Flash CS tool. More...

#include <MovieClip.h>

Inheritance diagram for rag::MovieClip:
rag::DisplayObject events::EventDispatcher

Classes

struct  Frame
 Internal of MovieClip, represents a single frame. More...
 

Public Member Functions

 MovieClip (std::vector< Frame > frames)
 
int getCurrentFrame ()
 Specifies the number of the frame in which the playhead is located in the timeline of the MovieClip instance.
 
std::string getCurrentFrameLabel ()
 Returns the label in the current frame. It may be empty.
 
int getTotalFrames ()
 Returns the total number of frames in the MovieClip.
 
void play ()
 Simple playback. More...
 
void stop ()
 Stops the playhead in the movie clip.
 
void gotoAndPlay (int frame)
 Goes to a specific frame, then starts playing from there.
 
void gotoAndPlay (const std::string &frame, bool loop, bool forceFirstFrame=false)
 Goes to a specific frame, then starts playing from there.
 
void gotoAndStop (int frame)
 Goes to a specific frame, then stops there.
 
void gotoAndStop (const std::string &frame)
 Goes to a specific frame by name, then stops there.
 
void nextFrame ()
 Sends the playhead to the next frame and stops it.
 
void prevFrame ()
 Sends the playhead to the previous frame and stops it.
 
FramegetCurrentFrameNode ()
 Returns the current frame internals.
 
virtual void logicUpdate () override
 Display object update.
 
void setFPS (int fps)
 Sets the speed in frames per second the MovieClip should use.
 
void replace (const std::string &name, const std::string &library, const std::string &replacement)
 Replace an instance of a Displayobject named "name" with a library item called "replacement".
 
bool isPlaying ()
 Returns true if is currently playing.
 
std::vector< Frame > & getFrames ()
 Returns all Frame instances.
 
- Public Member Functions inherited from rag::DisplayObject
void addChild (DisplayObject *child)
 Adds a DisplayObject child.
 
void addChildAt (DisplayObject *child, int index)
 Adds a DisplayObject child in a specific order.
 
void removeChild (DisplayObject *child)
 Removes a child DisplayObject. More...
 
void deleteChild (DisplayObject *child)
 Deletes a specific child from the DisplayList. More...
 
DisplayObjectgetChildByName (const std::string &name)
 Returns a child by name.
 
DisplayObjectgetChildAt (int index)
 Returns a child by index.
 
int getChildIndex (DisplayObject *child) const
 Returns a child's index.
 
bool contains (const DisplayObject *child) const
 Returns true if the child DisplayObject exists as a child.
 
int getNumChilds ()
 Returns the number of childs.
 
void swapChildren (DisplayObject *child1, DisplayObject *child2)
 Swaps two childs indexes.
 
virtual void logicTraversal ()
 Recursively calls logicUpdate in all child objects. More...
 
virtual void render ()
 Renders the DisplayObject in the screen.
 
virtual void renderTraversal (const Color &color)
 Recursively calls render in all childs objects.
 
virtual void prerender ()
 Temporal transition to new automatic batch render.
 
void setX (float x)
 Sets x position.
 
float getX ()
 Returns x position.
 
void setY (float y)
 Sets y position.
 
float getY ()
 Returns y position.
 
void setPosition (float x, float y)
 Sets x and y position.
 
void setPosition (glm::vec2 p)
 Sets object position.
 
glm::vec2 getPosition () const
 Returns object position.
 
void setScale (float scale)
 Sets object scale.
 
void setScaleX (float scaleX)
 Sets object x scale.
 
float getScaleX () const
 Returns object x scale.
 
void setScaleY (float scaleY)
 Sets object y scale.
 
float getScaleY () const
 Returns object y scale.
 
void setAngle (float angle)
 Sets object orientation angle.
 
float getAngle () const
 Returns object orientation angle.
 
void setSkewX (float skewX)
 Sets object x skew.
 
float getSkewX () const
 Returns object x skew.
 
void setSkewY (float skewY)
 Sets object y skew.
 
float getSkewY () const
 Returns object y skew.
 
void setWidth (float width)
 Sets object width.
 
float getWidth ()
 Returns object width.
 
void setHeight (float height)
 Sets object width.
 
float getHeight ()
 Returns object width.
 
virtual bool hitTestPoint (int x, int y)
 Returns true if the point lies inside the object boundary box.
 
glm::vec2 localToGlobal (const glm::vec2 &point)
 Converts local coordinates to global coordinates.
 
glm::vec2 globalToLocal (const glm::vec2 &point)
 Convert global coordinates to local coordinates.
 
void setClipRectangle (const Rectangle &rect)
 This allow to render just a part of the bitmap.
 
Rectangle getBounds (DisplayObject *targetCoordinateSpace=NULL)
 Returns the boundary box of the object.
 
void onNativeEvent (events::TouchEvent &event)
 Notifies the object about an input event. More...
 
void setText (rag::DisplayObject *displayObject, const std::string &text)
 Helper function to set a text.
 
void setText (rag::DisplayObject *displayObject, int value)
 Helper function to set a text number.
 
void destroy ()
 self-destroy the object and all its childs. More...
 
void updateMatrix ()
 
- Public Member Functions inherited from events::EventDispatcher
void addEventListener (std::string type, EventListener *listener)
 
void dispatchEvent (Event &event)
 
bool hasEventListener (std::string type)
 
void removeEventListener (std::string type, EventListener *listener)
 

Public Attributes

std::string fileName
 MovieClip filename.
 
- Public Attributes inherited from rag::DisplayObject
std::string name
 
DisplayObjectparent
 
std::vector< DisplayObject * > childs
 List of childs.
 
Color color
 Color of the object.
 
Material material
 Material of the object.
 
MaterialrenderMaterial
 The render material modified by the display list hierarchy.
 
glm::mat4 matrix
 The object matrix.
 
bool visible
 Determines object visibility.
 
bool autoScaleOnTouch
 When true, the bounds scale when is touched. More...
 
bool captureInput
 When true, input events are captured and propagation stops.
 
bool checkHitPoint
 When captureInput, checkHitPoint makes capture input only when hitTest is true. Defaults to false.
 
std::string soundName
 
std::string script
 

Additional Inherited Members

- Static Public Member Functions inherited from rag::DisplayObject
static void deletePendentObjects ()
 Deletes from memory all the nodes currently on the toDelete list. More...
 
static void showLivingObjects ()
 Logs information about the current number of living DisplayObject.
 
- Protected Member Functions inherited from rag::DisplayObject
virtual void updateBounds (rag::DisplayObject *targetCoordinateSpace)
 Updates the bounding box of the object according to childs bounds. More...
 
- Protected Attributes inherited from rag::DisplayObject
float scaleX
 
float scaleY
 
float x
 
float y
 
float width
 
float height
 
float angle
 
float skewX
 
float skewY
 
Rectangle bounds
 
int numChilds
 
bool dirty
 
Color colorTransform
 
Rectangle clipRect
 

Detailed Description

Allows to use imported animations created by Flash CS tool.

Constructor & Destructor Documentation

MovieClip::MovieClip ( std::vector< Frame _frames)

TODO: MovieClip way of handle labels. Labels are used for loops, but should be used only as extra information. TODO: Imitate flash way of do stuff with Movieclips and add an extra layer (outside MovieClip) to handle animations and loops in a convenient way.

Member Function Documentation

void MovieClip::play ( )

Simple playback.

Moves the playhead in the timeline of the movie clip.


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