Code:
//class for a sprite handler that uses linked list
#ifndef SPRITEHANDLER_H
#define SPRITEHANDLER_H
#include <string>
#include <allegro.h>
#include <iostream>
class SpriteHandler
{
public:
SpriteHandler();
~SpriteHandler();
int Length();
bool Empty() const;
bool AtEnd();
void Modify(string member, int dat);
void Modify(string member, BITMAP *bmp);
int Access(string member);
void First();
void Next();
void Insert(const int &dat);/*,const int x, const int y, const int ...*/
void Update();
void Bounce();
void Move();
private:
struct node;
typedef node *node_ptr;
struct node
{
BITMAP *sprite;
int data;
int x,y;
int width, height;
int xspeed, yspeed;
int xdelay, ydelay;
int xcount, ycount;
int curframe, maxframe, animdir;
int framecount, framedelay;
node *next;
};
node_ptr myFirst, myCurrent, myPrevious;
int Size;
node_ptr GetNode(const int &dat);
};
#endif