Página principal   Lista de componentes   Lista de archivos   Miembros de las clases   Archivos de los miembros   Páginas relacionadas  

Referencia del Archivo sprite.h

#include <SDL.h>
#include <action.h>
#include <object.h>

Definiciones

#define obj_sprite(world, id, x, y, angle, lifetime, color)   object_init(sprite_init(world,id,x,y,angle,lifetime,color),&sprite_object_operations)
 Macro to make it easy to construct an object of a sprite.


Funciones

sprite sprite_init (world, display display, id, int x, int y, int w, int h, int lifetime, char *bitmap)
 Initializes a sprite. Más...

void sprite_destroy (sprite)
 Destroy a sprite object. Más...

int sprite_step (sprite)
 A function part of the object operations. Más...

int sprite_alive (sprite)
 A function part of the object operations. Más...

int sprite_show (sprite)
 A function needed to create an object to attach to a world. Más...

int sprite_action (sprite, SDL_Event *action)
 A function needed to create an object to attach to a world. Más...


Variables

object_operations sprite_object_operations
 Template of the object_operation related with a sprite. Más...

object sprite_obj_template
 Template of a sprite object. Más...


Descripción detallada

Sprite object interface. Here a sprite is a thing that desn't do much more than simply display itself in the screen.


Documentación de las funciones

sprite sprite_init world    world,
display    display,
id    id,
int    x,
int    y,
int    w,
int    h,
int    lifetime,
char *    spritef
 

Initializes a sprite.

Allocates the resorces needed by a sprite, loads the grapics. It must be called befor te use of any other function related to this sprite.

Devuelve:
A ready for use spriute.
Parámetros:
world  The world wich is attached to.
display  A display to draw himself.
id  The unique object id, needed for event passing.
y  Y position relative to te left top corner of the display.
x  X position relative to te left top corner of the display.
w  The width of tyhe sprite.
h  The heigth of tyhe sprite.
lifetime  How many steps it has to exist.
spritef  A graphic filename where the sprites are stored.

void sprite_destroy sprite    sprite
 

Destroy a sprite object.

It unallocates the resources used by the prite.

Parámetros:
sprite  A sprite.

int sprite_step sprite    sprite
 

A function part of the object operations.

It doesn't do anything.

Bug:
In fact, it doesn't have to do anything... All the work must be y sprite_show.
Parámetros:
sprite  A sprite.

int sprite_alive sprite    sprite
 

A function part of the object operations.

It checks if the sprite is still alive or active or running or being.

Devuelve:
-0 Not running -1 running
Parámetros:
sprite  A sprite.

int sprite_show sprite    sprite
 

A function needed to create an object to attach to a world.

Draw the sprite in the display.

Parámetros:
sprite  A sprite.

int sprite_action sprite    sprite,
SDL_Event *    action
 

A function needed to create an object to attach to a world.

Dummy


Documentación de las variables

struct object_operations sprite_object_operations
 

Valor inicial:

{
    obj_step: &sprite_step,
    obj_action: &sprite_action,
    obj_alive: &sprite_alive,
    obj_destroy: &sprite_destroy
}
Template of the object_operation related with a sprite.

struct object sprite_obj_template
 

Valor inicial:

{
    object_ops: &sprite_object_operations,
}
Template of a sprite object.


Generado el Tue Oct 14 12:05:06 2003 para Repune por doxygen1.2.15