summaryrefslogtreecommitdiff
path: root/include/glsprite.h
blob: 3f481c581b28fd41b3a3880a92b2677550b5488f (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
#ifndef __GLSPRITE_H__
#define __GLSPRITE_H__

#include <vector>
#include <Exceptions.h>
#include <Handle.h>
#include <glcolor.h>
#include "gltexture.h"
#include "sprite.h"

namespace mogltk {
    class glSprite : public Sprite {
      public:
          glSprite(Handle *, int, int);
	  glSprite(Uint8 *, int, int);
	  virtual ~glSprite();
	virtual void draw(int, int, ColorP = WHITE);
      private:
        class TexList : public Base {
	  public:
	      TexList(int);
	      virtual ~TexList();
	    glSprite * 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;
	};
	glSprite * 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