From 541c00c93fcd98f766cce661aa83ef4ffe713e57 Mon Sep 17 00:00:00 2001 From: pixel Date: Fri, 28 Mar 2003 12:30:26 +0000 Subject: First part of the backend separation --- include/Makefile.am | 4 ++-- include/base.h | 2 +- include/engine.h | 4 ++-- include/font.h | 12 +++++++----- include/gettext.h | 3 +++ include/glbase.h | 2 +- include/glcolor.h | 17 ----------------- include/glfont.h | 11 +++-------- include/glshape.h | 16 +++++++++------- include/glsprite.h | 30 +++--------------------------- include/gltexture.h | 28 ---------------------------- include/glwidgets.h | 2 +- include/mcolor.h | 1 + include/sprite.h | 6 ++++++ include/texture.h | 18 +++++++++++++----- 15 files changed, 52 insertions(+), 104 deletions(-) delete mode 100644 include/glcolor.h delete mode 100644 include/gltexture.h (limited to 'include') diff --git a/include/Makefile.am b/include/Makefile.am index 948adba..60c38b6 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,5 +1,5 @@ pkginclude_HEADERS = \ -engine.h glbase.h glcolor.h glfont.h gltexture.h glshape.h glwidgets.h sprite.h \ -base.h font.h shape.h mcolor.h +engine.h glbase.h glfont.h glshape.h glwidgets.h sprite.h \ +base.h font.h shape.h mcolor.h glsprite.h noinst_HEADERS = gettext.h diff --git a/include/base.h b/include/base.h index 65326bc..4e4cd5a 100644 --- a/include/base.h +++ b/include/base.h @@ -2,7 +2,6 @@ #define __BASE_H__ #include -#include #include namespace mogltk { @@ -13,6 +12,7 @@ namespace mogltk { int GetWidth(void); int GetHeight(void); virtual void Flip(void); + SDL_Surface * getsurface(); protected: base(int, int, int, int); void setsurface(SDL_Surface *) throw (GeneralException); diff --git a/include/engine.h b/include/engine.h index a72e7b1..66f2f3c 100644 --- a/include/engine.h +++ b/include/engine.h @@ -4,8 +4,8 @@ #include #include #include -#include "base.h" -#include "glbase.h" +#include +#include namespace mogltk { class engine : public Base { diff --git a/include/font.h b/include/font.h index fcc2e03..3377ef0 100644 --- a/include/font.h +++ b/include/font.h @@ -5,8 +5,8 @@ #include #include #include -#include -#include +#include +#include namespace mogltk { class font : public Base { @@ -31,12 +31,14 @@ namespace mogltk { Uint8 * sizes; Uint16 nbentries, nbcT, nbT; Uint8 flags, maxX, maxY, nbcU, nbcV, base, inter; - texture ** fonttex; - Uint16 * corresp; int cx, cy, ox; ColorP textcolor; int shadow, wspace; - virtual texture * alloctexture(); + texture * alloctexture(); + void Bind(int); + private: + texture ** fonttex; + Uint16 * corresp; }; extern font * SystemFont; }; diff --git a/include/gettext.h b/include/gettext.h index 8b262f4..248bf2e 100644 --- a/include/gettext.h +++ b/include/gettext.h @@ -66,4 +66,7 @@ initializer for static 'char[]' or 'const char[]' variables. */ #define gettext_noop(String) String +#define _(Text) dgettext ("Baltisot", Text) +#define N_(Text) Text + #endif /* _LIBGETTEXT_H */ diff --git a/include/glbase.h b/include/glbase.h index 90732ef..7fa3b06 100644 --- a/include/glbase.h +++ b/include/glbase.h @@ -4,7 +4,7 @@ #include #include #include -#include "base.h" +#include namespace mogltk { class glbase : public base { diff --git a/include/glcolor.h b/include/glcolor.h deleted file mode 100644 index f62334b..0000000 --- a/include/glcolor.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef __GLCOLOR_H__ -#define __GLCOLOR_H__ - -#include -#include -#include "mcolor.h" - -namespace mogltk { - class glColorP : public ColorP { - public: - glColorP(const Color &); - glColorP(Uint8, Uint8, Uint8, Uint8); - void Bind(); - }; -}; - -#endif diff --git a/include/glfont.h b/include/glfont.h index 1931467..2076675 100644 --- a/include/glfont.h +++ b/include/glfont.h @@ -2,20 +2,15 @@ #define __GLFONT_H__ #include -#include "font.h" +#include +#include namespace mogltk { class glfont : public font { public: glfont(Handle *); virtual ~glfont(); - void drawentry(Uint16, int, int, glColorP = WHITE); - - protected: - virtual gltexture * alloctexture(); - - private: - void Bind(int); + void drawentry(Uint16, int, int, ColorP = WHITE); }; }; diff --git a/include/glshape.h b/include/glshape.h index 465f60b..bca4410 100644 --- a/include/glshape.h +++ b/include/glshape.h @@ -3,18 +3,20 @@ #include #include -#include -#include +#include +#include #include 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, 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(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); + virtual void box(int x1, int y1, int x2, int y2, ColorP = WHITE); + virtual void box3d(int x1, int y1, int x2, int y2, ColorP = DOS_WHITE, ColorP = DOS_HIGH_WHITE, ColorP = DOS_GRAY, int = 2, bool = false); + virtual void box(int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP); + virtual void tbox(texture *, int x1, int y1, int x2, int y2, int tx = 0, int ty = 0, double = 1.0, ColorP = WHITE); + 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, ColorP, ColorP, ColorP, ColorP, int tx = 0, int ty = 0, double = 1.0); + virtual void tbox(texture *, int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP, 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 index 3f481c5..a7b2bfd 100644 --- a/include/glsprite.h +++ b/include/glsprite.h @@ -4,9 +4,9 @@ #include #include #include -#include -#include "gltexture.h" -#include "sprite.h" +#include +#include +#include namespace mogltk { class glSprite : public Sprite { @@ -15,31 +15,7 @@ namespace mogltk { 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 deleted file mode 100644 index a5137db..0000000 --- a/include/gltexture.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef __GLTEXTURE_H__ -#define __GLTEXTURE_H__ - -#include -#include -#include -#include -#include -#include - -namespace mogltk { - class gltexture : public texture { - public: - 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); - static void Unbind(void); - private: - GLuint tex; - bool texture_allocated, planar, tainted; - static gltexture * active; - }; -}; - -#endif diff --git a/include/glwidgets.h b/include/glwidgets.h index 0ee9cea..86688ef 100644 --- a/include/glwidgets.h +++ b/include/glwidgets.h @@ -1,7 +1,7 @@ #ifndef __GLWIDGETS_H__ #define __GLWIDGETS_H__ -#include "Exceptions.h" +#include namespace mogltk { class widget : public Base { diff --git a/include/mcolor.h b/include/mcolor.h index cd91923..bbad479 100644 --- a/include/mcolor.h +++ b/include/mcolor.h @@ -9,6 +9,7 @@ namespace mogltk { public: ColorP(const Color &); ColorP(Uint8, Uint8, Uint8, Uint8); + void Bind(); static Color Min; static Color Max; Color c; diff --git a/include/sprite.h b/include/sprite.h index aed711e..dcc4dda 100644 --- a/include/sprite.h +++ b/include/sprite.h @@ -14,6 +14,12 @@ namespace mogltk { 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: diff --git a/include/texture.h b/include/texture.h index 904eeae..4f14ba4 100644 --- a/include/texture.h +++ b/include/texture.h @@ -2,6 +2,7 @@ #define __TEXTURE_H__ #include +#include #include #include #include @@ -9,22 +10,29 @@ namespace mogltk { class texture : public Base { public: - texture(int = 256, int = 256) throw (GeneralException); - texture(Handle *) throw (GeneralException); + 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) ; - Uint32 GetWidth(); - Uint32 GetHeight(); + void Generate(); + void Bind(bool = true); + GLuint GetWidth(); + GLuint GetHeight(); + static void Unbind(void); + void Taint(void); private: - Uint32 width, height; + 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; }; }; -- cgit v1.2.3