ML_sprites.h File Reference

This file contains sprites headers. More...

Functions

void ML_DrawSprite (ML_Sprite *sprite)
 This function shows the sprite which is already loaded, of course.
void ML_DrawSpriteXY (ML_Sprite *sprite, int x, int y)
 This function shows the sprite which is already loaded. At X and Y positions.
void ML_DrawSpriteFull (ML_Sprite *sprite, int x, int y, float angle, float scaleX, float scaleY, u8 alpha)
 This function shows the sprite which is already loaded.
It can be faster when you have many things to do on the sprites in a time.
void ML_InitTile (ML_Sprite *sprite, u16 width, u16 height)
 This function inits the tile system of the sprite.
void ML_DrawTile (ML_Sprite *sprite, int x, int y, u16 frame)
 This function draws a tile.
void ML_DrawSpriteText (ML_Sprite *sprite, int x, int y, const char *text,...)
 This function draws some graphic text.
void ML_DrawSpriteTextLimit (ML_Sprite *sprite, int x, int y, char *text, u8 limit)
 This function draws some graphic text with a limit of characters.
void ML_DrawSpriteTextBox (ML_Sprite *sprite, int x, int y, int x2, int y2, const char *text,...)
 This function draws some graphic text within a box.
void ML_DrawSpriteSimpleText (ML_Sprite *sprite, int x, int y, const char *text)
 This function draws some graphic text, but with no arguments and other funny thing : just faster !
void ML_CloneSprite (ML_Sprite *sprite1, ML_Sprite *sprite2)
 This function clones two sprites.
bool ML_IsSpriteVisible (ML_Sprite *sprite)
 This function checks if the sprite is visible.
void ML_AnimateSprite (ML_Sprite *sprite, bool enabled, u8 waitForXSecondsBetweenFrames)
 This function animates the sprite which needs to be tiled (and initialized for that).
void ML_AnimateSpriteEx (ML_Sprite *sprite, bool enabled, u8 waitForXRefreshBetweenFrames, u8 from, u8 to)
 This function animates the sprite which needs to be tiled (and initialized for that).
It will animate from "from" to "to" in loops.
void ML_AnimateSpriteEx2 (ML_Sprite *sprite, bool enabled, u8 waitForXRefreshBetweenFrames, u8 from, u8 to, u8 times)
 This function animates the sprite which needs to be tiled (and initialized for that).
It will animate from "from" to "to" in "time" loops.
void ML_MoveSpriteWiimotePad (ML_Sprite *sprite, u8 wpad)
 This function moves the sprite with the D-Pad of the Wiimote.
void ML_MoveSpriteWiimoteIR (ML_Sprite *sprite, u8 wpad)
 This function moves the sprite with Wiimote IR.
bool ML_IsWiimoteInSprite (u8 wpad, const ML_Sprite *sprite)
 This function checks if the Wiimote pointer is in the sprite.
bool ML_IsWiimoteInSpriteEx (u8 wpad, const ML_Sprite *sprite)
 Prefer not to use this because it's slower.
This function checks if the Wiimote pointer is in the sprite.
It's a pixel-detection.
bool ML_IsCollision (const ML_Sprite *sprite, const ML_Sprite *sprite2)
 This function checks if there is a collision between two sprites.
It's a box-detection.
bool ML_IsCollisionEx (const ML_Sprite *sprite, const ML_Sprite *sprite2)
 Prefer not to use this because it's slower.
This function checks if there is a collision between two sprites.
It's a pixel-detection.
bool ML_IsCollisionSpriteRect (const ML_Sprite *sprite, int x, int y, int width, int height)
 Detects a collision between a sprite and a rectangle.
bool ML_IsCollisionSpriteCircle (const ML_Sprite *sprite, int centerX, int centerY, int radius)
 Detects a collision between a sprite and a circle.
bool ML_IsCollisionRectRect (int x1, int y1, int width1, int height1, int x2, int y2, int width2, int height2)
 Detects a collision between two rectangles.
bool ML_IsCollisionCircleCircle (int centerX1, int centerY1, int radius1, int centerX2, int centerY2, int radius2)
 Detects a collision between two circles.
bool ML_IsCollisionRectCircle (int x, int y, int width, int height, int centerX, int centerY, int radius)
 Detects a collision between a rectangle and a circle.
void ML_Cursor (ML_Sprite *sprite, u8 wpad)
 This function draws the sprite as a cursor.
Wiimote pointer will be in the center of the sprite.
X and Y of the cursor will be where the wiimote point to.
void ML_RotateSprite (ML_Sprite *sprite, float angle, u8 autoRotate)
 This function rotates the sprite.
void ML_SetSpriteXY (ML_Sprite *sprite, int x, int y)
 This function changes the X and Y positions of the sprite.
void ML_SetSpriteX (ML_Sprite *sprite, int x)
 This function changes the X position of the sprite.
void ML_SetSpriteY (ML_Sprite *sprite, int y)
 This function changes the Y position of the sprite.
void ML_SetSpriteScale (ML_Sprite *sprite, float scaleX, float scaleY)
 This function changes the Scale X and Scale Y of the sprite.
void ML_SetSpriteSize (ML_Sprite *sprite, u16 width, u16 height)
 This function changes the size of your sprite.
void ML_SetSpriteVelocity (ML_Sprite *sprite, int dx, int dy)
 This function sets the velocity members of the sprite.
void ML_SetSpriteAlpha (ML_Sprite *sprite, u8 alpha)
 This function sets the transparency of the sprite.
void ML_FlipSpriteX (ML_Sprite *sprite, bool flipX)
 This function flips the sprite horizontally if flipX is set to 1.
void ML_FlipSpriteY (ML_Sprite *sprite, bool flipY)
 This function flips the sprite vertically if flipY is set to 1.
void ML_FlipSpriteXY (ML_Sprite *sprite, bool flipX, bool flipY)
 This function flips the sprite.

Detailed Description

This file contains sprites headers.


Function Documentation

void ML_AnimateSprite ( ML_Sprite sprite,
bool  enabled,
u8  waitForXRefreshBetweenFrames 
)

This function animates the sprite which needs to be tiled (and initialized for that).

Parameters:
sprite Sprite
enabled Animation enabled (1) or disabled (0)
waitForXRefreshBetweenFrames This is the last of time between each frames.
void ML_AnimateSpriteEx ( ML_Sprite sprite,
bool  enabled,
u8  waitForXRefreshBetweenFrames,
u8  from,
u8  to 
)

This function animates the sprite which needs to be tiled (and initialized for that).
It will animate from "from" to "to" in loops.

Parameters:
sprite Sprite
enabled Animation enabled (1) or disabled (0)
waitForXRefreshBetweenFrames This is the last of time between each frames.
from From where the sprite will begin the animation
to To where the sprite will finish the animations
void ML_AnimateSpriteEx2 ( ML_Sprite sprite,
bool  enabled,
u8  waitForXRefreshBetweenFrames,
u8  from,
u8  to,
u8  times 
)

This function animates the sprite which needs to be tiled (and initialized for that).
It will animate from "from" to "to" in "time" loops.

Parameters:
sprite Sprite
enabled Animation enabled (1) or disabled (0)
waitForXRefreshBetweenFrames This is the last of time between each frames.
from From where the sprite will begin the animation
to To where the sprite will finish the animations
times How many times it will be looped. (0 means infinite)
void ML_CloneSprite ( ML_Sprite sprite1,
ML_Sprite sprite2 
)

This function clones two sprites.

Parameters:
sprite1 The original sprite
sprite2 The sprite which will be the same as sprite1
void ML_Cursor ( ML_Sprite sprite,
u8  wpad 
)

This function draws the sprite as a cursor.
Wiimote pointer will be in the center of the sprite.
X and Y of the cursor will be where the wiimote point to.

Parameters:
sprite Sprite
wpad Which Wiimote
void ML_DrawSprite ( ML_Sprite sprite  ) 

This function shows the sprite which is already loaded, of course.

Parameters:
sprite Sprite
void ML_DrawSpriteFull ( ML_Sprite sprite,
int  x,
int  y,
float  angle,
float  scaleX,
float  scaleY,
u8  alpha 
)

This function shows the sprite which is already loaded.
It can be faster when you have many things to do on the sprites in a time.

Parameters:
sprite Sprite
x X position
y Y position
angle Angle in degrees ( -180 -> +180 )
scaleX Horizontal scale
scaleY Vertical scale
alpha Transparency ( 0 -> 255 )
void ML_DrawSpriteSimpleText ( ML_Sprite sprite,
int  x,
int  y,
const char *  text 
)

This function draws some graphic text, but with no arguments and other funny thing : just faster !

Parameters:
sprite Sprite for extra-features like transparency, etc...
x X position
y Y position
text Text
void ML_DrawSpriteText ( ML_Sprite sprite,
int  x,
int  y,
const char *  text,
  ... 
)

This function draws some graphic text.

Parameters:
sprite Sprite for extra-features like transparency, etc...
x X position
y Y position
text Text which can have arguments
void ML_DrawSpriteTextBox ( ML_Sprite sprite,
int  x,
int  y,
int  x2,
int  y2,
const char *  text,
  ... 
)

This function draws some graphic text within a box.

Parameters:
sprite Sprite for extra-features like transparency, etc...
x X position of the left-upper corner
y Y position of the left-bottom corner
x2 X position of the right-upper corner
y2 Y position of the right-bottom corner
text Text
void ML_DrawSpriteTextLimit ( ML_Sprite sprite,
int  x,
int  y,
char *  text,
u8  limit 
) [inline]

This function draws some graphic text with a limit of characters.

Parameters:
sprite Sprite for extra-features like transparency, etc...
x X position
y Y position
text Text
limit Limit of characters
void ML_DrawSpriteXY ( ML_Sprite sprite,
int  x,
int  y 
)

This function shows the sprite which is already loaded. At X and Y positions.

Parameters:
sprite Sprite
x X position
y Y position
void ML_DrawTile ( ML_Sprite sprite,
int  x,
int  y,
u16  frame 
)

This function draws a tile.

Parameters:
sprite Sprite
x X position
y Y position
frame Tile n°<frame>
void ML_FlipSpriteX ( ML_Sprite sprite,
bool  flipX 
)

This function flips the sprite horizontally if flipX is set to 1.

Parameters:
sprite Sprite
flipX Flipping enabled (1) or disabled (0)
void ML_FlipSpriteXY ( ML_Sprite sprite,
bool  flipX,
bool  flipY 
)

This function flips the sprite.

Parameters:
sprite Sprite
flipX Horizontal flipping enabled (1) or disabled (0)
flipY Vertical flipping enabled (1) or disabled (0)
void ML_FlipSpriteY ( ML_Sprite sprite,
bool  flipY 
)

This function flips the sprite vertically if flipY is set to 1.

Parameters:
sprite Sprite
flipY Flipping enabled (1) or disabled (0)
void ML_InitTile ( ML_Sprite sprite,
u16  width,
u16  height 
)

This function inits the tile system of the sprite.

Parameters:
sprite Sprite
width Width of the tile
height Height of the tile
bool ML_IsCollision ( const ML_Sprite sprite,
const ML_Sprite sprite2 
)

This function checks if there is a collision between two sprites.
It's a box-detection.

Warning:
Don't use it if your sprite is a cursor. (use ML_IsWiimoteInSprite() instead)
Parameters:
sprite 1st Sprite
sprite2 2nd Sprite
Returns:
1 if there is collision, 0 else.
bool ML_IsCollisionCircleCircle ( int  centerX1,
int  centerY1,
int  radius1,
int  centerX2,
int  centerY2,
int  radius2 
)

Detects a collision between two circles.

Parameters:
centerX1 X position of the first circle
centerY1 Y position of the first circle
radius1 Radius of the first circle
centerX2 X position of the second circle
centerY2 Y position of the second circle
radius2 Radius of the second circle
Returns:
1 if there is collision, 0 else.
bool ML_IsCollisionEx ( const ML_Sprite sprite,
const ML_Sprite sprite2 
)

Prefer not to use this because it's slower.
This function checks if there is a collision between two sprites.
It's a pixel-detection.

Warning:
Don't use it if your sprite is a cursor. (use ML_IsWiimoteInSprite() instead)
Also make sure that your sprite is not rotated !
Don't use with tiled sprites.
Parameters:
sprite 1st Sprite
sprite2 2nd Sprite
Returns:
1 if there is collision, 0 else.
bool ML_IsCollisionRectCircle ( int  x,
int  y,
int  width,
int  height,
int  centerX,
int  centerY,
int  radius 
)

Detects a collision between a rectangle and a circle.

Parameters:
x X position of the rectangle
y Y position of the rectangle
width Width of the rectangle
height Height of the rectangle
centerX X position of the circle
centerY Y position of the circle
radius Radius of the circle
Returns:
1 if there is collision, 0 else.
bool ML_IsCollisionRectRect ( int  x1,
int  y1,
int  width1,
int  height1,
int  x2,
int  y2,
int  width2,
int  height2 
)

Detects a collision between two rectangles.

Parameters:
x1 X position of the first rectangle
y1 Y position of the first rectangle
width1 Width of the first rectangle
height1 Height of the first rectangle
x2 X position of the second rectangle
y2 Y position of the second rectangle
width2 Width of the second rectangle
height2 Height of the second rectangle
Returns:
1 if there is collision, 0 else.
bool ML_IsCollisionSpriteCircle ( const ML_Sprite sprite,
int  centerX,
int  centerY,
int  radius 
)

Detects a collision between a sprite and a circle.

Parameters:
sprite Sprite
centerX X position of the circle
centerY Y position of the circle
radius Radius of the circle
Returns:
1 if there is collision, 0 else.
bool ML_IsCollisionSpriteRect ( const ML_Sprite sprite,
int  x,
int  y,
int  width,
int  height 
)

Detects a collision between a sprite and a rectangle.

Parameters:
sprite Sprite
x X position of the rectangle
y Y position of the rectangle
width Width of the rectangle
height Height of the rectangle
Returns:
1 if there is collision, 0 else.
bool ML_IsSpriteVisible ( ML_Sprite sprite  ) 

This function checks if the sprite is visible.

Parameters:
sprite Sprite
Returns:
1 if it's visible, 0 else.
bool ML_IsWiimoteInSprite ( u8  wpad,
const ML_Sprite sprite 
)

This function checks if the Wiimote pointer is in the sprite.

Parameters:
wpad Wiimote number
sprite Sprite
Returns:
1 if it's in the sprite, 0 else.
bool ML_IsWiimoteInSpriteEx ( u8  wpad,
const ML_Sprite sprite 
)

Prefer not to use this because it's slower.
This function checks if the Wiimote pointer is in the sprite.
It's a pixel-detection.

Warning:
Make sure that your sprite is not rotated !
Don't use with tiled sprites.
Parameters:
wpad Wiimote number
sprite Sprite
Returns:
1 if it's in the sprite, 0 else.
void ML_MoveSpriteWiimoteIR ( ML_Sprite sprite,
u8  wpad 
)

This function moves the sprite with Wiimote IR.

Parameters:
sprite Sprite
wpad Which Wiimote
void ML_MoveSpriteWiimotePad ( ML_Sprite sprite,
u8  wpad 
)

This function moves the sprite with the D-Pad of the Wiimote.

Parameters:
sprite Sprite
wpad Which Wiimote
void ML_RotateSprite ( ML_Sprite sprite,
float  angle,
u8  autoRotate 
)

This function rotates the sprite.

Parameters:
sprite Sprite
angle Angle of rotation (degrees)
autoRotate If TRUE, the sprite will rotate of <angle> degrees each frame.
If it's FALSE, the sprite will rotate to the angle indicated.
void ML_SetSpriteAlpha ( ML_Sprite sprite,
u8  alpha 
)

This function sets the transparency of the sprite.

Parameters:
sprite Sprite
alpha Transparency ( 0 -> 255 )
void ML_SetSpriteScale ( ML_Sprite sprite,
float  scaleX,
float  scaleY 
)

This function changes the Scale X and Scale Y of the sprite.

Parameters:
sprite Sprite
scaleX New scale for the width of the sprite
scaleY New scale for the height of the sprite
void ML_SetSpriteSize ( ML_Sprite sprite,
u16  width,
u16  height 
)

This function changes the size of your sprite.

Parameters:
sprite Sprite
width New width
height New height
void ML_SetSpriteVelocity ( ML_Sprite sprite,
int  dx,
int  dy 
)

This function sets the velocity members of the sprite.

Parameters:
sprite Sprite
dx New horizontal velocity
dy New vertical velocity
void ML_SetSpriteX ( ML_Sprite sprite,
int  x 
)

This function changes the X position of the sprite.

Parameters:
sprite Sprite
x New X position
void ML_SetSpriteXY ( ML_Sprite sprite,
int  x,
int  y 
)

This function changes the X and Y positions of the sprite.

Parameters:
sprite Sprite
x New X position
y New Y position
void ML_SetSpriteY ( ML_Sprite sprite,
int  y 
)

This function changes the Y position of the sprite.

Parameters:
sprite Sprite
y New Y position
 All Data Structures Files Functions Variables Defines

Generated on Wed Jan 19 18:15:34 2011 for MLlib by  doxygen 1.6.1