Created
February 21, 2012 01:02
-
-
Save cfcosta/1872685 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "sprite_stack.h" | |
void stack_remove(sprite_node *node) | |
{ | |
node->previous->next = node->next; | |
SDL_FreeSurface(node->sprite->image); | |
free(node); | |
} | |
void stack_unshift(sprite_node *node) | |
{ | |
first->previous = node; | |
node->last = first; | |
first = node; | |
} | |
void stack_append(sprite_node *node) | |
{ | |
last->next = node; | |
node->previous = last; | |
last = node; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef H_STACK_COLLECTION | |
#define H_STACK_COLLECTION | |
#include "graphics.h" | |
typedef struct { | |
sprite *sprite; | |
sprite_node *previous; | |
sprite_node *next; | |
} sprite_node; | |
sprite_node *first; | |
sprite_node *last; | |
void stack_remove(sprite_node *node); | |
void stack_unshift(sprite_node *node); | |
void stack_append(sprite_node *node); | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment