#include "sprite.h"
/********************************************************************/
-void setBackground(SDL_Surface** screen, struct sprite** movie){
-
-SDL_Rect rect;
+static void
+setBackground(SDL_Surface **screen, struct sprite **movie)
+{
+ SDL_Rect rect;
rect.x = (*movie)->x;
rect.y = (*movie)->y;
}
/********************************************************************/
-void showSprite(SDL_Surface** screen, struct sprite** movie){
-
-SDL_Rect rect;
+static void
+showSprite(SDL_Surface **screen, struct sprite **movie)
+{
+ SDL_Rect rect;
rect.x = (*movie)->x;
rect.y = (*movie)->y;
}
/********************************************************************/
-void resetBackground(SDL_Surface** screen, struct sprite** movie){
-
-SDL_Rect rect;
+static void
+resetBackground(SDL_Surface** screen, struct sprite** movie)
+{
+ SDL_Rect rect;
rect.x = (*movie)->x;
rect.y = (*movie)->y;
/* returns true if this sprite needs to move */
return (p->y != p->toY) || (p->x != p->toX);
}
+
int
anySpritesMoving(struct sprite **letters)
{
}
/********************************************************************/
-void moveSprite(SDL_Surface** screen, struct sprite** movie, int letterSpeed){
-
-int i;
-int x, y;
-int Xsteps;
+static void
+moveSprite(SDL_Surface** screen, struct sprite** movie, int letterSpeed)
+{
+ int i;
+ int x, y;
+ int Xsteps;
// move a sprite from it's curent location to the new location
if( ( (*movie)->y != (*movie)->toY ) || ( (*movie)->x != (*movie)->toX ) ){
}
/********************************************************************/
-void moveSprites(SDL_Surface** screen, struct sprite** letters, int letterSpeed){
-
-struct sprite* current;
+void
+moveSprites(SDL_Surface** screen, struct sprite** letters, int letterSpeed)
+{
+ struct sprite* current;
current= *letters;
while(current!=NULL){
}
/********************************************************************/
-void destroyLetters(struct sprite** letters){
-struct sprite* current = *letters;
-struct sprite* previous = NULL;
-
- while(current!=NULL){
+void
+destroyLetters(struct sprite **letters)
+{
+ struct sprite *current = *letters;
+ while (current != NULL) {
+ struct sprite *tmp = current;
SDL_FreeSurface(current->sprite);
SDL_FreeSurface(current->replace);
- previous = current;
current = current->next;
- free(previous);
+ free(tmp);
}
-
- (*letters)=NULL;
-
+ *letters = NULL;
}
+
+/*
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: nil
+ * c-basic-offset: 4
+ * End:
+ */
#define BOX_START_X 80
#define ANSWER_BOX_Y 243
-struct sprite{
+struct sprite {
SDL_Surface* sprite;
SDL_Surface* replace;
char letter;
int box;
};
-void setBackground(SDL_Surface** screen, struct sprite** movie);
-void showSprite(SDL_Surface** screen, struct sprite** movie);
-void resetBackground(SDL_Surface** screen, struct sprite** movie);
-void moveSprite(SDL_Surface** screen, struct sprite** movie, int letterSpeed);
void moveSprites(SDL_Surface** screen, struct sprite** letters, int LetterSpeed);
-int nextBlankPosition(int box, int* index);
-//void clickDetect(int button, int x, int y, SDL_Surface *screen, struct sprite** letters);
-void destroyLetters(struct sprite** letters);
-//void buildLetters(struct sprite** letters, SDL_Surface* screen);
+int nextBlankPosition(int box, int *index);
+void destroyLetters(struct sprite **letters);
int anySpritesMoving(struct sprite **letters);