GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
Public Member Functions | List of all members
gd::Sprite Class Reference

Represents a sprite to be displayed on the screen. More...

#include <Sprite.h>

Public Member Functions

void SetImageName (const gd::String &image_)
 Change the name of the sprite image.
 
const gd::StringGetImageName () const
 Get the name of the sprite image.
 
gd::StringGetImageName ()
 Get the name of the sprite image.
 
std::vector< Polygon2dGetCollisionMask () const
 Get the collision mask (custom or automatically generated owing to IsFullImageCollisionMask()) More...
 
std::vector< Polygon2d > & GetCustomCollisionMask ()
 Get the custom collision mask.
 
const std::vector< Polygon2d > & GetCustomCollisionMask () const
 Get the custom collision mask.
 
void SetCustomCollisionMask (const std::vector< Polygon2d > &collisionMask)
 Set the custom collision mask. Call then SetFullImageCollisionMask(false) to use it.
 
bool IsFullImageCollisionMask () const
 Return true if the collision mask is a bounding box, false if a custom collision mask is used.
 
void SetFullImageCollisionMask (bool enabled)
 Un/set use of the custom collision mask.
 
std::vector< Point > & GetAllNonDefaultPoints ()
 Return all points, excluding origin and center.
 
const std::vector< Point > & GetAllNonDefaultPoints () const
 Return all points, excluding origin and center.
 
void AddPoint (const Point &point)
 Add a point.
 
void DelPoint (const gd::String &name)
 Delete a point.
 
const PointGetPoint (const gd::String &name) const
 Get the specified point.
 
PointGetPoint (const gd::String &name)
 Get the specified point.
 
bool HasPoint (const gd::String &name) const
 Return true if the point exists.
 
const PointGetOrigin () const
 Return Origin point.
 
PointGetOrigin ()
 Return Origin point.
 
const PointGetCenter () const
 Return Center point. More...
 
PointGetCenter ()
 Return Center point. More...
 
bool IsDefaultCenterPoint () const
 Return true if the center point is automatically computed.
 
bool SetDefaultCenterPoint (bool enabled)
 Un/set center as being automatically computed.
 

Detailed Description

Represents a sprite to be displayed on the screen.

See also
Direction
SpriteObject

Member Function Documentation

◆ GetCenter() [1/2]

Point& gd::Sprite::GetCenter ( )
inline

Return Center point.

Warning
If the image has not been loaded (using LoadImage) and the center point is set as automatic, the returned point won't be correct.

◆ GetCenter() [2/2]

const Point& gd::Sprite::GetCenter ( ) const
inline

Return Center point.

Warning
If the image has not been loaded (using LoadImage) and the center point is set as automatic, the returned point won't be correct.

◆ GetCollisionMask()

std::vector< Polygon2d > gd::Sprite::GetCollisionMask ( ) const

Get the collision mask (custom or automatically generated owing to IsFullImageCollisionMask())

Warning
If the image has not been loaded ( using LoadImage ) and the collision mask is set as automatic, the returned mask won't be correct.

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