From be0486797260377246c1ea1229cca27c19c64ad2 Mon Sep 17 00:00:00 2001 From: pixel Date: Wed, 26 Mar 2003 17:19:23 +0000 Subject: bleh --- include/font.h | 1 + include/glfont.h | 3 +++ include/glshape.h | 6 +++--- include/glsprite.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ include/gltexture.h | 29 +++++++++-------------------- include/sprite.h | 4 ++-- include/texture.h | 22 +++++++--------------- 7 files changed, 70 insertions(+), 40 deletions(-) create mode 100644 include/glsprite.h (limited to 'include') 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 +#include +#include +#include +#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 #include #include +#include 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 #include #include -#include -#include "gltexture.h" +#include +#include 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 -#include #include #include #include @@ -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; }; }; -- cgit v1.2.3