summaryrefslogtreecommitdiff
path: root/include/sprite.h
blob: aed711e241a3b836487d6a4e5e490898dd10a035 (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
#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);
      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