Game Develop C++ Platform: RuntimeSpriteObject Class Reference

| Game Develop C++ Platform Platform for developing native games based on OpenGL and SFML with Game Develop

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Groups Pages
Public Member Functions | List of all members
RuntimeSpriteObject Class Reference
Inheritance diagram for RuntimeSpriteObject:
[legend]
Collaboration diagram for RuntimeSpriteObject:
[legend]

## Public Member Functions

| RuntimeSpriteObject (RuntimeScene &scene, const gd::Object &object)
virtual RuntimeObject * | Clone () const
| Must return a pointer to a copy of the object. A such method is needed to do polymorphic copies. More...
virtual bool | ExtraInitializationFromInitialInstance (const gd::InitialInstance &position)
virtual bool | Draw (sf::RenderTarget &renderTarget)
virtual void | UpdateTime (float timeElapsed)
virtual void | OnPositionChanged ()
virtual float | GetWidth () const
virtual float | GetHeight () const
virtual void | SetWidth (float newWidth)
| Set the new width of the object. More...
virtual void | SetHeight (float newHeight)
| Set the new height of the object. More...
virtual void | SetOriginalSize ()
virtual float | GetDrawableX () const
virtual float | GetDrawableY () const
virtual float | GetCenterX () const
virtual float | GetCenterY () const
float | GetPointX (const std::string &point) const
float | GetPointY (const std::string &point) const
void | UpdateCurrentSprite () const
const sf::Sprite & | GetCurrentSFMLSprite () const
const Sprite & | GetCurrentSprite () const
bool | CursorOnObject (RuntimeScene &scene, bool accurate)
virtual bool | SetAngle (float newAngle)
virtual float | GetAngle () const
bool | SetDirection (float nb)
unsigned int | GetCurrentDirection () const
float | GetCurrentDirectionOrAngle () const
bool | SetSprite (unsigned int nb)
unsigned int | GetSpriteNb () const
void | SetOpacity (float val)
float | GetOpacity () const
void | SetBlendMode (unsigned int blendMode_)
unsigned int | GetBlendMode () const
void | SetScaleX (float val)
float | GetScaleX () const
void | SetScaleY (float val)
float | GetScaleY () const
void | SetColor (unsigned int r, unsigned int v, unsigned int b)
unsigned int | GetColorR () const
unsigned int | GetColorV () const
unsigned int | GetColorB () const
virtual std::vector< Polygon2d > | GetHitBoxes () const
void | FlipX (bool flip=true)
void | FlipY (bool flip=true)
bool | IsFlippedX () const
bool | IsFlippedY () const
void | TurnTowardPosition (float Xposition, float Yposition)
void | TurnTowardObject (RuntimeObject *object)
void | ChangeScale (const std::string &operatorStr, double newValue)
void | SetColor (const std::string &colorStr)
void | CopyImageOnImageOfCurrentSprite (RuntimeScene &scene, const std::string &imageName, float xPosition, float yPosition, bool useTransparency)
void | MakeColorTransparent (const std::string &colorStr)
Current animation
Managing the animation being played
void | StopAnimation ()
void | PlayAnimation ()
bool | IsAnimationStopped () const
bool | AnimationEnded () const
unsigned int | GetAnimationCount () const
unsigned int | GetCurrentAnimation () const
bool | SetCurrentAnimation (unsigned int nb)
Public Member Functions inherited from RuntimeObject
| RuntimeObject (RuntimeScene &scene, const gd::Object &object)
| Construct a RuntimeObject from an object. More...
| RuntimeObject (const RuntimeObject &object)
| Copy constructor. Calls Init().
RuntimeObject & | operator= (const RuntimeObject &object)
| Assignment operator. Calls Init().
virtual | ~RuntimeObject ()
| Default destructor.
const std::string & | GetName () const
| Get the name of the object.
const std::string & | GetType () const
| Get the type of the object.
int | GetZOrder () const
| Query the Z order of the object.
void | SetZOrder (int zOrder_)
| Change the Z order of the object.
bool | IsHidden () const
| Return if the object is hidden or not.
bool | IsVisible () const
| Return if the object is visible ( not hidden )
void | SetHidden (bool hide=true)
| Hide/Show the object.
void | SetLayer (const std::string &layer_)
| Change the layer of the object.
const std::string & | GetLayer () const
| Get the layer of the object.
bool | IsOnLayer (const std::string &layer_) const
| Check if the object is on a layer.
float | GetX () const
| Get the X coordinate of the object in the layout.
float | GetY () const
| Get the Y coordinate of the object in the layout.
void | SetX (float x_)
| Change X position of the object. More...
void | SetY (float y_)
| Change Y position of the object. More...
bool | ClearForce ()
| Delete all forces applied to the object.
const gd::VariablesContainer & | GetVariables () const
| Provide access to the gd::VariablesContainer member containing the object variables.
gd::VariablesContainer & | GetVariables ()
| Provide access to the gd::VariablesContainer member containing the object variables.
void | DoAutomatismsPreEvents (RuntimeScene &scene)
| Call each automatism so that they do their work before events.
void | DoAutomatismsPostEvents (RuntimeScene &scene)
| Call each automatism so that they do their work after the events were runn.
gd::Automatism * | GetAutomatismRawPointer (const std::string &name)
gd::Automatism * | GetAutomatismRawPointer (const std::string &name) const
virtual bool | HasAutomatismNamed (const std::string &name) const
| Return true if the object has the automatism with the specified name.
void | DeleteFromScene (RuntimeScene &scene)
void | PutAroundAPosition (float positionX, float positionY, float distance, float angleInDegrees)
void | AddForce (float x, float y, float clearing)
void | AddForceUsingPolarCoordinates (float angle, float length, float clearing)
void | AddForceTowardPosition (float positionX, float positionY, float length, float clearing)
void | AddForceToMoveAround (float positionX, float positionY, float angularVelocity, float distance, float clearing)
void | AddForceTowardObject (RuntimeObject *object, float length, float clearing)
void | AddForceToMoveAroundObject (RuntimeObject *object, float velocity, float length, float clearing)
void | PutAroundObject (RuntimeObject *object, float length, float angleInDegrees)
void | SetXY (const char *xOperator, float xValue, const char *yOperator, float yValue)
void | Duplicate (RuntimeScene &scene, std::map< std::string, std::vector< RuntimeObject * > * > pickedObjectLists)
void | ActivateAutomatism (const std::string &automatismName, bool activate=true)
bool | AutomatismActivated (const std::string &automatismName)
bool | IsStopped ()
bool | TestAngleOfDisplacement (float angle, float tolerance)
double | GetSqDistanceWithObject (RuntimeObject *other)
double | GetDistanceWithObject (RuntimeObject *other)
double | GetVariableValue (const std::string &variable)
const std::string & | GetVariableString (const std::string &variable)
void | SeparateFromObjects (std::map< std::string, std::vector< RuntimeObject * > * > pickedObjectLists)
void | SeparateObjectsWithoutForces (std::map< std::string, std::vector< RuntimeObject * > * > pickedObjectLists)
void | SeparateObjectsWithForces (std::map< std::string, std::vector< RuntimeObject * > * > pickedObjectLists)
bool | UpdateForce (float ElapsedTime)
float | TotalForceX () const
float | TotalForceY () const
float | TotalForceAngle () const
float | TotalForceLength () const

## Additional Inherited Members

Public Attributes inherited from RuntimeObject
Force | force5
Protected Member Functions inherited from RuntimeObject
void | Init (const RuntimeObject &object)
| Initialize object using another object. Used by copy-ctor and assign-op. More...
Protected Attributes inherited from RuntimeObject
std::string | name
| The full name of the object.
std::string | type
| Which type is the object. ( To test if we can do something reserved to some objects with it )
float | X
| X position on the scene.
float | Y
| Y position on the scene.
int | zOrder
| Z order on the scene, to choose if an object is displayed before another object.
bool | hidden
| True to prevent the object from being rendered.
std::string | layer
| Name of the layer on which the object is.
std::map< std::string, gd::Automatism * > | automatisms
| Contains all automatisms of the object. Automatisms are the ownership of the object.
gd::VariablesContainer | objectVariables
| List of the variables of the object.
std::vector< Force > | forces
| Forces applied to the object.

## Member Function Documentation

void RuntimeSpriteObject::ChangeScale | ( | const std::string & | operatorStr,
|  | double | newValue
| ) |  |

Only used internally by GD events generated code: Prefer using (Get/Set)Scale(X/Y).

virtual RuntimeObject* RuntimeSpriteObject::Clone | ( | ) |  | const

inlinevirtual

Must return a pointer to a copy of the object. A such method is needed to do polymorphic copies.

Just redefine this method in your derived object class like this:

return new MyRuntimeObject(*this);

Reimplemented from RuntimeObject.

bool RuntimeSpriteObject::Draw | ( | sf::RenderTarget & | renderTarget) |  |

virtual

Render object at runtime

Reimplemented from RuntimeObject.

Here is the call graph for this function:

bool RuntimeSpriteObject::ExtraInitializationFromInitialInstance | ( | const gd::InitialInstance & | position) |  |

virtual

Update animation and direction from the inital position

Reimplemented from RuntimeObject.

Here is the call graph for this function:

float RuntimeSpriteObject::GetAngle | ( | ) |  | const

virtual

Get the angle of a sprite object, which corresponds to its direction.

Reimplemented from RuntimeObject.

unsigned int RuntimeSpriteObject::GetAnimationCount | ( | ) |  | const

Return the number of animations the object has.

float RuntimeSpriteObject::GetCenterX | ( | ) |  | const

virtual

X center is computed with the current sprite

Reimplemented from RuntimeObject.

Here is the call graph for this function:

float RuntimeSpriteObject::GetCenterY | ( | ) |  | const

virtual

Y center is computed with the current sprite

Reimplemented from RuntimeObject.

Here is the call graph for this function:

float RuntimeSpriteObject::GetCurrentDirectionOrAngle | ( | ) |  | const

Return angle or direction, according to the current direction type.

Here is the call graph for this function:

const sf::Sprite & RuntimeSpriteObject::GetCurrentSFMLSprite | ( | ) |  | const

Get the SFML sprite

Here is the call graph for this function:

const Sprite & RuntimeSpriteObject::GetCurrentSprite | ( | ) |  | const

Get the ( Game Develop ) sprite

Here is the call graph for this function:

float RuntimeSpriteObject::GetDrawableX | ( | ) |  | const

virtual

Get the real X position of the sprite

Reimplemented from RuntimeObject.

Here is the call graph for this function:

float RuntimeSpriteObject::GetDrawableY | ( | ) |  | const

virtual

Get the real Y position of the sprite

Reimplemented from RuntimeObject.

Here is the call graph for this function:

float RuntimeSpriteObject::GetHeight | ( | ) |  | const

virtual

Get the height of the current sprite.

Reimplemented from RuntimeObject.

Here is the call graph for this function:

std::vector< Polygon2d > RuntimeSpriteObject::GetHitBoxes | ( | ) |  | const

virtual

Get object hit box(es)

Reimplemented from RuntimeObject.

Here is the call graph for this function:

float RuntimeSpriteObject::GetWidth | ( | ) |  | const

virtual

Get the width of the current sprite.

Reimplemented from RuntimeObject.

Here is the call graph for this function:

virtual void RuntimeSpriteObject::OnPositionChanged | ( | ) |  |

inlinevirtual

Object can use this function to do special work when position is changed.

Reimplemented from RuntimeObject.

bool RuntimeSpriteObject::SetAngle | ( | float | newAngle) |  |

virtual

Set the angle of a sprite object, which corresponds to its direction. If Sprite is using a direction which do not use angle, the direction is deduced from the angle.

Reimplemented from RuntimeObject.

Here is the call graph for this function:

void RuntimeSpriteObject::SetColor | ( | unsigned int | r,
|  | unsigned int | v,
|  | unsigned int | b
| ) |  |

Change the color filter of the sprite object

void RuntimeSpriteObject::SetColor | ( | const std::string & | colorStr) |  |

Only used internally by GD events generated code: Prefer using original SetColor.

Here is the call graph for this function:

bool RuntimeSpriteObject::SetCurrentAnimation | ( | unsigned int | nb) |  |

Change the number of the current animation

Here is the call graph for this function:

bool RuntimeSpriteObject::SetDirection | ( | float | nb) |  |

Change the value of the current direction. If Sprite is using a direction which use angle, the function behave as SetAngle.

Here is the call graph for this function:

void RuntimeSpriteObject::SetHeight | ( | float | ) |  |

virtual

Set the new height of the object.

The height can be not changed if the object doesn't want/is not designed to.

Reimplemented from RuntimeObject.

Here is the call graph for this function:

void RuntimeSpriteObject::SetOpacity | ( | float | val) |  |

Change the opacity of the object

bool RuntimeSpriteObject::SetSprite | ( | unsigned int | nb) |  |

Change the number of the current sprite

Here is the call graph for this function:

void RuntimeSpriteObject::SetWidth | ( | float | ) |  |

virtual

Set the new width of the object.

The width can be not changed if the object doesn't want/is not designed to.

Reimplemented from RuntimeObject.

Here is the call graph for this function:

void RuntimeSpriteObject::UpdateCurrentSprite | ( | ) |  | const

Prepare the current sprite

Here is the call graph for this function:

void RuntimeSpriteObject::UpdateTime | ( | float | elapsedTime) |  |

virtual

Update the time elpased on the current sprite, and change this latter if needed.

Reimplemented from RuntimeObject.

Here is the call graph for this function:

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

- SpriteObject.h
- SpriteObject.cpp