Example #1
0
static void draw_particles()
{
    Particle *p;
    Node *current_node = list_first_node(particles);
    int OFFSETX, OFFSETY;

    while(current_node){
        p = (Particle*) node_value(current_node);
        p->draw(p);
        current_node = node_next(current_node);
    }
}
Example #2
0
/**
 * Updates a particle array (eg blood). will move the particles according to
 * the particles velocity, and if a particle hits a solid block, will stop
 * the particle.
 */
static void update_particles()
{
    Particle *p;
    Node *current_node = list_first_node(particles);
    while(current_node){
        p = node_value(current_node);
        if(p->update(p)){
            Node *next = node_next(current_node);
            list_remove(particles, current_node);
            current_node = next;
        } else {
            current_node = node_next(current_node);
        }
    }
}
Example #3
0
/**
 * Updates a particle array (eg blood). will move the particles according to
 * the particles velocity, and if a particle hits a solid block, will stop
 * the particle.
 */
static void update_particles()
{
    Particle *p;
    Node *current_node = list_first_node(particles);
    if (SDL_MUSTLOCK(map_buffer)) SDL_LockSurface(map_buffer);
    while(current_node){
        p = node_value(current_node);
        if(p->update(p)){
            Node *next = node_next(current_node);
            list_remove(particles, current_node);
            current_node = next;
        } else {
            current_node = node_next(current_node);
        }
    }
    if (SDL_MUSTLOCK(map_buffer)) SDL_UnlockSurface(map_buffer);
}