SDLGameEngine

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

Data Structures | Functions

# include/sgesprite.h File Reference

Sprite handling. More...

Go to the source code of this file.

## Data Structures
struct | SGESPRITEWAYPOINT
| a sprite waypoint More...
struct | SGESPRITE
## Functions
SGESPRITE * | sgeSpriteNew (void)
| create a new empty sprite
SGESPRITE * | sgeSpriteNewFile (SGEFILE *f, const char *filename)
| create a new sprite from a file
SGESPRITE * | sgeSpriteNewFileRange (SGEFILE *f, const char *templ, Uint32 start, Uint32 end)
| create a new animated sprite from a range of images
SGESPRITE * | sgeSpriteNewSDLSurface (SDL_Surface *surface)
| create a new sprite from a SDL_Surface
void | sgeSpriteDestroy (SGESPRITE *s)
| destroy a sprite and release all resources
SGESPRITEIMAGE * | sgeSpriteGetCurrentFrame (SGESPRITE *s)
| get the current SGESPRITEIMAGE of the current frame
void | sgeSpriteSetFPS (SGESPRITE *s, Uint32 fps)
| set the animation speed in frames per second
void | sgeSpriteAddSDLSurface (SGESPRITE *s, SDL_Surface *surface)
| add a new frame to the current anim bank from a SDL_Surface
void | sgeSpriteAddSpriteImage (SGESPRITE *s, SGESPRITEIMAGE *i)
| add a new frame to the current anim bank from a SGESPRITEIMAGE
void | sgeSpriteAddFile (SGESPRITE *s, SGEFILE *f, const char *name)
| add a new frame to the current anim bank from a sge archive file
void | sgeSpriteAddFileRange (SGESPRITE *s, SGEFILE *f, const char *templ, Uint32 start, Uint32 end)
| add new frames to the current anim bank from a range of files from a sge archive
SDL_Surface * | sgeSpriteGetSDLSurface (SGESPRITE *s)
| get the SDL_Surface of the current frame of a sprite
void | sgeSpriteDraw (SGESPRITE *s, SDL_Surface *dest)
| draw the sprite on a surface or screen
void | sgeSpriteDrawXY (SGESPRITE *s, int x, int y, SDL_Surface *dest)
| draw the sprite on a surface or screen on a certain position
void | sgeSpriteDrawRotoZoomed (SGESPRITE *s, float rotation, float zoom, SDL_Surface *dest)
| draw the sprite with zoom and rotation values
void | sgeSpriteDrawXYRotoZoomed (SGESPRITE *s, int x, int y, float rotation, float zoom, SDL_Surface *dest)
| draw the sprite at a certain position with zoom and rotation values
void | sgeAnimatedSpriteUseAlpha (SGESPRITE *s)
| switch all sprites of the current animation to use alpha data for collision information
void | sgeAnimatedSpriteIgnoreAlpha (SGESPRITE *s)
| switch all sprites of the current animation to NOT use alpha data for collision information
int | sgeSpriteBoxCollide (SGESPRITE *a, SGESPRITE *b)
| test collision between the bounding box of two sprites
int | sgeSpriteCollide (SGESPRITE *a, SGESPRITE *b)
| test a collision between two sprites
int | sgeSpriteBoxCollideSpriteImage (SGESPRITE *a, SGESPRITEIMAGE *b)
| test collision between the bounding box of a sprite and a spriteimage
int | sgeSpriteCollideSpriteImage (SGESPRITE *a, SGESPRITEIMAGE *b)
| test a collision between a sprite and a spriteimage
int | sgeSpriteWidth (SGESPRITE *s)
| get the with of a sprite image
int | sgeSpriteHeight (SGESPRITE *s)
| get the height of a sprite image
void | sgeSpriteAddWayPoint (SGESPRITE *s, int x, int y)
| add a way point to a sprite
void | sgeSpriteRemoveNextWayPoint (SGESPRITE *s)
| remove the next (aka current) way point from a sprite
void | sgeSpriteClearWayPoints (SGESPRITE *s)
| remove all remaining way points from a sprite
void | sgeSpriteStartMovement (SGESPRITE *s, float speed)
| start the automatic movement of a sprite along its way points
void | sgeSpriteAbortMovement (SGESPRITE *s)
| stop automatic movement of a sprite and remove all remaining way points
void | sgeSpriteMoveTowards (SGESPRITE *s, int x, int y)
| move a sprite one step towards a certain coordinate
void | sgeSpriteSetUserData (SGESPRITE *s, void *data)
| add custom user data to a sprite
void * | sgeSpriteGetUserData (SGESPRITE *s)
| get custom user data from a sprite
void | sgeSpriteUpdatePosition (SGESPRITE *s)
| copies the sprite position to the current frame
void | sgeSpriteUpdate (SGESPRITE *s)
| updates a sprite without drawing it
Uint32 | sgeSpriteGetNumberOfFrames (SGESPRITE *s)
| get the number of frames in the current anim bank
void | sgeSpriteSetNumberOfFrames (SGESPRITE *s, Uint32 number)
| set the number of frames in the current anim bank
SGEARRAY * | sgeSpriteGetCurrentSpriteArray (SGESPRITE *s)
| get the current array of frames
void | sgeSpriteSetAnimBank (SGESPRITE *s, Uint32 bank)
| switch to a anim bank (aka animation)
void | sgeSpriteAddAnimBank (SGESPRITE *s)
| add a new anim bank (aka animation) the the sprite
Uint32 | sgeSpriteGetAnimBank (SGESPRITE *s)
| get the index of the current anim bank
void | sgeSpriteAnimate (SGESPRITE *s, int state)
| enable/disable animation of a sprite
void | sgeSpriteResetAnimation (SGESPRITE *s)
| forces next frame to be frame 0 of the current anim bank
void | sgeSpriteForceFrame (SGESPRITE *s, Uint32 frame)
| sets a specific frame of the current animation
SGESPRITE * | sgeSpriteDuplicate (SGESPRITE *s)
| duplicate (copy) a sprite

## Detailed Description

Sprite handling.

Definition in file sgesprite.h.

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines