summaryrefslogtreecommitdiff
path: root/include/sprite.h
blob: dcc4ddab0895ac3d7d8491ddb6cdbffd8fe91e0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef __SPRITE_H__
#define __SPRITE_H__

#include <vector>
#include <Exceptions.h>
#include <Handle.h>
#include <mcolor.h>
#include <texture.h>

namespace mogltk {
    class Sprite : public Base {
      public:
          Sprite(Handle *, int, int);
	  Sprite(Uint8 *, int, int);
	  virtual ~Sprite();
	void draw(int, int, ColorP = WHITE);
      protected:
        void Bind();
	int GetSX();
	int GetSY();
	int GetPX();
	int GetPY();
      private:
        class TexList : public Base {
	  public:
	      TexList(int);
	      virtual ~TexList();
	    Sprite * sprheader;
	    const texture * GetTex() const;
	    texture * GetTex();
	    static const TexList * GetHead();
	    const TexList * GetNext() const;
	    TexList * GetNext();
	    void Bind() const;
	  private:
	    texture * tex;
	    static TexList * header;
	    TexList * next, * prev;
	};
	Sprite * next, * prev;
	TexList * tlist;
	int sx, sy, posx, posy;
	void alloc();
	bool canfit(int, int, int, int) const;
	bool intersect(int, int, int, int) const;
    };

};

#endif