summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorpixel <pixel>2003-03-28 12:30:26 +0000
committerpixel <pixel>2003-03-28 12:30:26 +0000
commit541c00c93fcd98f766cce661aa83ef4ffe713e57 (patch)
tree2300eff5c56164578988d4f4d57147c60657c7ad /include
parentbe0486797260377246c1ea1229cca27c19c64ad2 (diff)
First part of the backend separation
Diffstat (limited to 'include')
-rw-r--r--include/Makefile.am4
-rw-r--r--include/base.h2
-rw-r--r--include/engine.h4
-rw-r--r--include/font.h12
-rw-r--r--include/gettext.h3
-rw-r--r--include/glbase.h2
-rw-r--r--include/glcolor.h17
-rw-r--r--include/glfont.h11
-rw-r--r--include/glshape.h16
-rw-r--r--include/glsprite.h30
-rw-r--r--include/gltexture.h28
-rw-r--r--include/glwidgets.h2
-rw-r--r--include/mcolor.h1
-rw-r--r--include/sprite.h6
-rw-r--r--include/texture.h18
15 files changed, 52 insertions, 104 deletions
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 <SDL.h>
-#include <SDL_opengl.h>
#include <Exceptions.h>
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 <SDL.h>
#include <Handle.h>
#include <Exceptions.h>
-#include "base.h"
-#include "glbase.h"
+#include <base.h>
+#include <glbase.h>
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 <stdarg.h>
#include <BString.h>
#include <Handle.h>
-#include <gltexture.h>
-#include <glcolor.h>
+#include <texture.h>
+#include <mcolor.h>
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 <SDL.h>
#include <SDL_opengl.h>
#include <Exceptions.h>
-#include "base.h"
+#include <base.h>
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 <Exceptions.h>
-#include <Color.h>
-#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 <SDL.h>
-#include "font.h"
+#include <font.h>
+#include <mcolor.h>
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 <Exceptions.h>
#include <BString.h>
-#include <glcolor.h>
-#include <gltexture.h>
+#include <mcolor.h>
+#include <texture.h>
#include <shape.h>
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 <vector>
#include <Exceptions.h>
#include <Handle.h>
-#include <glcolor.h>
-#include "gltexture.h"
-#include "sprite.h"
+#include <mcolor.h>
+#include <texture.h>
+#include <sprite.h>
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 <SDL.h>
-#include <SDL_opengl.h>
-#include <Handle.h>
-#include <Exceptions.h>
-#include <generic.h>
-#include <texture.h>
-
-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 <Exceptions.h>
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 <SDL.h>
+#include <SDL_opengl.h>
#include <Handle.h>
#include <Exceptions.h>
#include <generic.h>
@@ -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;
};
};