summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorpixel <pixel>2003-03-26 17:19:23 +0000
committerpixel <pixel>2003-03-26 17:19:23 +0000
commitbe0486797260377246c1ea1229cca27c19c64ad2 (patch)
tree2d6f03e0e8cad191250239b69205c727c5551323 /include
parentc00cd54ca5ed959cbccff7aa7261fb5025d1832c (diff)
bleh
Diffstat (limited to 'include')
-rw-r--r--include/font.h1
-rw-r--r--include/glfont.h3
-rw-r--r--include/glshape.h6
-rw-r--r--include/glsprite.h45
-rw-r--r--include/gltexture.h29
-rw-r--r--include/sprite.h4
-rw-r--r--include/texture.h22
7 files changed, 70 insertions, 40 deletions
diff --git a/include/font.h b/include/font.h
index a6f4a16..fcc2e03 100644
--- a/include/font.h
+++ b/include/font.h
@@ -36,6 +36,7 @@ namespace mogltk {
int cx, cy, ox;
ColorP textcolor;
int shadow, wspace;
+ virtual texture * alloctexture();
};
extern font * SystemFont;
};
diff --git a/include/glfont.h b/include/glfont.h
index b8663d7..1931467 100644
--- a/include/glfont.h
+++ b/include/glfont.h
@@ -10,6 +10,9 @@ namespace mogltk {
glfont(Handle *);
virtual ~glfont();
void drawentry(Uint16, int, int, glColorP = WHITE);
+
+ protected:
+ virtual gltexture * alloctexture();
private:
void Bind(int);
diff --git a/include/glshape.h b/include/glshape.h
index 81439ad..465f60b 100644
--- a/include/glshape.h
+++ b/include/glshape.h
@@ -11,10 +11,10 @@ namespace mogltk {
class glshape : public shape {
public:
virtual void box(int x1, int y1, int x2, int y2, glColorP = WHITE);
- virtual void box3d(int x1, int y1, int x2, int y2, glColorP = DOS_WHITE, ColorP = DOS_HIGH_WHITE, ColorP = DOS_GRAY, int = 2, bool = false);
+ virtual void box3d(int x1, int y1, int x2, int y2, glColorP = DOS_WHITE, glColorP = DOS_HIGH_WHITE, glColorP = DOS_GRAY, int = 2, bool = false);
virtual void box(int x1, int y1, int x2, int y2, glColorP, glColorP, glColorP, glColorP);
- virtual void tbox(texture *, int x1, int y1, int x2, int y2, int tx1, int ty1, int tx2, int ty2, ColorP = WHITE);
- virtual void tbox(texture *, int x1, int y1, int x2, int y2, glColorP, glColorP, glColorP, glColorP, int tx1, int ty1, int tx2, int ty2);
+ virtual void tbox(gltexture *, int x1, int y1, int x2, int y2, int tx1, int ty1, int tx2, int ty2, glColorP = WHITE);
+ virtual void tbox(gltexture *, int x1, int y1, int x2, int y2, glColorP, glColorP, glColorP, glColorP, int tx1, int ty1, int tx2, int ty2);
private:
bool Enter(bool);
virtual bool Enter();
diff --git a/include/glsprite.h b/include/glsprite.h
new file mode 100644
index 0000000..3f481c5
--- /dev/null
+++ b/include/glsprite.h
@@ -0,0 +1,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
diff --git a/include/gltexture.h b/include/gltexture.h
index 4f5e162..a5137db 100644
--- a/include/gltexture.h
+++ b/include/gltexture.h
@@ -6,33 +6,22 @@
#include <Handle.h>
#include <Exceptions.h>
#include <generic.h>
+#include <texture.h>
namespace mogltk {
- class texture : public Base {
+ class gltexture : public texture {
public:
- texture(int = 256, int = 256, bool = false) throw (GeneralException);
- texture(Handle *, bool = false) throw (GeneralException);
- virtual ~texture();
- SDL_Surface * GetSurface();
- Uint32 * GetPixels();
- static SDL_Surface * LoadNTEX(Handle * h) throw (GeneralException) ;
+ gltexture(int = 256, int = 256, bool = false) throw (GeneralException);
+ gltexture(Handle *, bool = false) throw (GeneralException);
+ virtual ~gltexture();
void Generate();
+ void Taint();
void Bind(bool = true);
- GLuint GetWidth();
- GLuint GetHeight();
static void Unbind(void);
- void Taint(void);
private:
- GLuint width, height, tex;
- bool texture_allocated;
- SDL_Surface * surface;
- bool planar, tainted;
-#ifdef TRACE_TEXTURES
- static texture * header;
- static texture * footer;
- texture * next, * prev;
-#endif
- static texture * active;
+ GLuint tex;
+ bool texture_allocated, planar, tainted;
+ static gltexture * active;
};
};
diff --git a/include/sprite.h b/include/sprite.h
index 16565d0..aed711e 100644
--- a/include/sprite.h
+++ b/include/sprite.h
@@ -4,8 +4,8 @@
#include <vector>
#include <Exceptions.h>
#include <Handle.h>
-#include <glcolor.h>
-#include "gltexture.h"
+#include <mcolor.h>
+#include <texture.h>
namespace mogltk {
class Sprite : public Base {
diff --git a/include/texture.h b/include/texture.h
index 4f5e162..904eeae 100644
--- a/include/texture.h
+++ b/include/texture.h
@@ -1,8 +1,7 @@
-#ifndef __GLTEXTURE_H__
-#define __GLTEXTURE_H__
+#ifndef __TEXTURE_H__
+#define __TEXTURE_H__
#include <SDL.h>
-#include <SDL_opengl.h>
#include <Handle.h>
#include <Exceptions.h>
#include <generic.h>
@@ -10,29 +9,22 @@
namespace mogltk {
class texture : public Base {
public:
- texture(int = 256, int = 256, bool = false) throw (GeneralException);
- texture(Handle *, bool = false) throw (GeneralException);
+ texture(int = 256, int = 256) throw (GeneralException);
+ texture(Handle *) throw (GeneralException);
virtual ~texture();
SDL_Surface * GetSurface();
Uint32 * GetPixels();
static SDL_Surface * LoadNTEX(Handle * h) throw (GeneralException) ;
- void Generate();
- void Bind(bool = true);
- GLuint GetWidth();
- GLuint GetHeight();
- static void Unbind(void);
- void Taint(void);
+ Uint32 GetWidth();
+ Uint32 GetHeight();
private:
- GLuint width, height, tex;
- bool texture_allocated;
+ Uint32 width, height;
SDL_Surface * surface;
- bool planar, tainted;
#ifdef TRACE_TEXTURES
static texture * header;
static texture * footer;
texture * next, * prev;
#endif
- static texture * active;
};
};