From c00cd54ca5ed959cbccff7aa7261fb5025d1832c Mon Sep 17 00:00:00 2001 From: pixel Date: Wed, 26 Mar 2003 14:07:43 +0000 Subject: bleh --- include/Makefile.am | 3 ++- include/base.h | 25 +++++++++++++++++++++ include/engine.h | 4 ++++ include/font.h | 43 +++++++++++++++++++++++++++++++++++ include/glbase.h | 20 ++++++++--------- include/glcolor.h | 10 ++++----- include/glfont.h | 35 +++++------------------------ include/glshape.h | 60 +++++++++---------------------------------------- include/mcolor.h | 18 +++++++++++++++ include/shape.h | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++ include/texture.h | 39 ++++++++++++++++++++++++++++++++ 11 files changed, 224 insertions(+), 98 deletions(-) create mode 100644 include/base.h create mode 100644 include/font.h create mode 100644 include/mcolor.h create mode 100644 include/shape.h create mode 100644 include/texture.h (limited to 'include') diff --git a/include/Makefile.am b/include/Makefile.am index 283156d..948adba 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,4 +1,5 @@ pkginclude_HEADERS = \ -engine.h glbase.h glcolor.h glfont.h gltexture.h glshape.h glwidgets.h sprite.h +engine.h glbase.h glcolor.h glfont.h gltexture.h glshape.h glwidgets.h sprite.h \ +base.h font.h shape.h mcolor.h noinst_HEADERS = gettext.h diff --git a/include/base.h b/include/base.h new file mode 100644 index 0000000..65326bc --- /dev/null +++ b/include/base.h @@ -0,0 +1,25 @@ +#ifndef __BASE_H__ +#define __BASE_H__ + +#include +#include +#include + +namespace mogltk { + class base : public Base { + public: + base(int w = 640, int h = 480, int flags = 0) throw(GeneralException); + virtual ~base(); + int GetWidth(void); + int GetHeight(void); + virtual void Flip(void); + protected: + base(int, int, int, int); + void setsurface(SDL_Surface *) throw (GeneralException); + private: + int width, height; + SDL_Surface * surface; + }; +}; + +#endif diff --git a/include/engine.h b/include/engine.h index 56c9279..a72e7b1 100644 --- a/include/engine.h +++ b/include/engine.h @@ -4,6 +4,8 @@ #include #include #include +#include "base.h" +#include "glbase.h" namespace mogltk { class engine : public Base { @@ -24,6 +26,8 @@ namespace mogltk { static double FPS(); static void lockmouse(); static void unlockmouse(); + static glbase * glbase_o; + static base * base_o; private: static bool inited; static bool postsetuped; diff --git a/include/font.h b/include/font.h new file mode 100644 index 0000000..a6f4a16 --- /dev/null +++ b/include/font.h @@ -0,0 +1,43 @@ +#ifndef __FONT_H__ +#define __FONT_H__ + +#include +#include +#include +#include +#include +#include + +namespace mogltk { + class font : public Base { + public: + font(Handle *); + virtual ~font(); + virtual void drawentry(Uint16, int, int, ColorP = WHITE); + void putcursor(int, int); + void putentry(Uint16, ColorP = WHITE); + void putchar(char, ColorP = WHITE); + void newline(void); + int printf(const ugly_string &, ...); + int printf(const char *, ...); + int printf(const ugly_string &, va_list); + void setcolor(ColorP); + void setshadow(int); + void setwspace(int); + int getchar(char) const; + int singletextsize(const String &) const; + + protected: + 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; + }; + extern font * SystemFont; +}; + +#endif diff --git a/include/glbase.h b/include/glbase.h index b83f044..90732ef 100644 --- a/include/glbase.h +++ b/include/glbase.h @@ -4,25 +4,23 @@ #include #include #include +#include "base.h" namespace mogltk { - class glbase : public Base { + class glbase : public base { public: - static int setup(int w = 640, int h = 480, int flags = 0) throw(GeneralException); - static int GetWidth(void); - static int GetHeight(void); - static int GetInited(void); - static void Enter2DMode(void); - static void Leave2DMode(void); - static void Flip(void); - static bool is2D(void); + glbase(int w = 640, int h = 480, int flags = 0) throw(GeneralException); + virtual ~glbase(); + void Enter2DMode(void); + void Leave2DMode(void); + virtual void Flip(void); + bool is2D(void); static void glVertex(GLshort, GLshort, GLshort = 0, GLshort = 1); static void glVertex(GLint, GLint, GLint = 0, GLint = 1); static void glVertex(GLfloat, GLfloat, GLfloat = 0.0, GLfloat = 1.0); static void glVertex(GLdouble, GLdouble, GLdouble = 0.0, GLdouble = 1.0); private: - static int width, height, inited, twoD; - static SDL_Surface * surface; + int twoD; }; }; diff --git a/include/glcolor.h b/include/glcolor.h index 28ce1f7..f62334b 100644 --- a/include/glcolor.h +++ b/include/glcolor.h @@ -3,16 +3,14 @@ #include #include +#include "mcolor.h" namespace mogltk { - class ColorP : public Base { + class glColorP : public ColorP { public: - ColorP(const Color &); - ColorP(Uint8, Uint8, Uint8, Uint8); + glColorP(const Color &); + glColorP(Uint8, Uint8, Uint8, Uint8); void Bind(); - static Color Min; - static Color Max; - Color c; }; }; diff --git a/include/glfont.h b/include/glfont.h index 87efd12..b8663d7 100644 --- a/include/glfont.h +++ b/include/glfont.h @@ -2,43 +2,18 @@ #define __GLFONT_H__ #include -#include -#include -#include -#include -#include +#include "font.h" namespace mogltk { - class font : public Base { + class glfont : public font { public: - font(Handle *); - virtual ~font(); - void drawentry(Uint16, int, int, ColorP = WHITE); - void putcursor(int, int); - void putentry(Uint16, ColorP = WHITE); - void putchar(char, ColorP = WHITE); - void newline(void); - int printf(const ugly_string &, ...); - int printf(const char *, ...); - int printf(const ugly_string &, va_list); - void setcolor(ColorP); - void setshadow(int); - void setwspace(int); - int getchar(char) const; - int singletextsize(const String &) const; + glfont(Handle *); + virtual ~glfont(); + void drawentry(Uint16, int, int, glColorP = WHITE); private: - Uint8 * sizes; - Uint16 nbentries, nbcT, nbT; - Uint8 flags, maxX, maxY, nbcU, nbcV, base, inter; - texture ** fonttex; - Uint16 * corresp; void Bind(int); - int cx, cy, ox; - ColorP textcolor; - int shadow, wspace; }; - extern font * SystemFont; }; #endif diff --git a/include/glshape.h b/include/glshape.h index b65c21e..81439ad 100644 --- a/include/glshape.h +++ b/include/glshape.h @@ -5,60 +5,20 @@ #include #include #include +#include namespace mogltk { - typedef enum { - LEFT, - CENTER, - RIGHT - } align_t; - class shape : public Base { + class glshape : public shape { public: - static void pixel(int x, int y, ColorP = WHITE); - static void box(int x1, int y1, int x2, int y2, ColorP = WHITE); - static void box3d(int x1, int y1, int x2, int y2, ColorP = DOS_WHITE, ColorP = DOS_HIGH_WHITE, ColorP = DOS_GRAY, int = 2, bool = false); - static void box(int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP); - static void obox(int x1, int y1, int x2, int y2, ColorP = WHITE); - static void obox3d(int x1, int y1, int x2, int y2, ColorP = DOS_HIGH_WHITE, ColorP = DOS_GRAY, bool = false); - static void obox(int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP); - static void tbox(texture *, int x1, int y1, int x2, int y2, int tx = 0, int ty = 0, double = 1.0, ColorP = WHITE); - static void tbox(texture *, int x1, int y1, int x2, int y2, int tx1, int ty1, int tx2, int ty2, ColorP = WHITE); - static void tbox(texture *, int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP, int tx = 0, int ty = 0, double = 1.0); - static void tbox(texture *, int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP, int tx1, int ty1, int tx2, int ty2); - static void hline(int x1, int x2, int y, ColorP = WHITE); - static void hline3d(int x1, int x2, int y, ColorP = DOS_HIGH_WHITE, ColorP = DOS_GRAY, bool = false); - static void hline(int x1, int x2, int y, ColorP, ColorP); - static void vline(int x, int y1, int y2, ColorP = WHITE); - static void vline3d(int x, int y1, int y2, ColorP = DOS_HIGH_WHITE, ColorP = DOS_GRAY, bool = false); - static void vline(int x, int y1, int y2, ColorP, ColorP); - static void window(int x1, int y1, int x2, int y2, - const String & title = "", - ColorP titlecolor = DOS_HIGH_WHITE, - ColorP titlebackcolor = DOS_MAGENTA, - ColorP front = DOS_WHITE, - ColorP shade1 = DOS_HIGH_WHITE, - ColorP shade2 = DOS_GRAY); - static void text(int x, int y, const String &, - ColorP textcolor = DOS_HIGH_WHITE, - align_t align = LEFT); - static void text3d(int x, int y, const String &, - ColorP textcolor = DOS_BLACK, - ColorP shade1 = DOS_HIGH_WHITE, - ColorP shade2 = DOS_GRAY, - align_t align = LEFT, - bool bevel = false); - static void button(int x1, int y1, int x2, int y2, const String &, - bool bevel = false, - ColorP front = DOS_WHITE, - ColorP shade1 = DOS_HIGH_WHITE, - ColorP shade2 = DOS_GRAY, - ColorP round = DOS_BLACK, - ColorP textcolor = DOS_BLACK, - ColorP tshade1 = DOS_HIGH_WHITE, - ColorP tshade2 = DOS_GRAY); + 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 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); private: - static bool in2D(bool); - static void out2D(bool); + bool Enter(bool); + virtual bool Enter(); + virtual void Leave(bool); }; }; diff --git a/include/mcolor.h b/include/mcolor.h new file mode 100644 index 0000000..cd91923 --- /dev/null +++ b/include/mcolor.h @@ -0,0 +1,18 @@ +#ifndef __MCOLOR_H__ +#define __MCOLOR_H__ + +#include +#include + +namespace mogltk { + class ColorP : public Base { + public: + ColorP(const Color &); + ColorP(Uint8, Uint8, Uint8, Uint8); + static Color Min; + static Color Max; + Color c; + }; +}; + +#endif diff --git a/include/shape.h b/include/shape.h new file mode 100644 index 0000000..1aa8168 --- /dev/null +++ b/include/shape.h @@ -0,0 +1,65 @@ +#ifndef __SHAPE_H__ +#define __SHAPE_H__ + +#include +#include +#include +#include + +namespace mogltk { + typedef enum { + LEFT, + CENTER, + RIGHT + } align_t; + class shape : public Base { + public: + virtual void pixel(int x, int y, ColorP = WHITE); + 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 obox(int x1, int y1, int x2, int y2, ColorP = WHITE); + virtual void obox3d(int x1, int y1, int x2, int y2, ColorP = DOS_HIGH_WHITE, ColorP = DOS_GRAY, bool = false); + virtual void obox(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); + virtual void hline(int x1, int x2, int y, ColorP = WHITE); + virtual void hline3d(int x1, int x2, int y, ColorP = DOS_HIGH_WHITE, ColorP = DOS_GRAY, bool = false); + virtual void hline(int x1, int x2, int y, ColorP, ColorP); + virtual void vline(int x, int y1, int y2, ColorP = WHITE); + virtual void vline3d(int x, int y1, int y2, ColorP = DOS_HIGH_WHITE, ColorP = DOS_GRAY, bool = false); + virtual void vline(int x, int y1, int y2, ColorP, ColorP); + virtual void window(int x1, int y1, int x2, int y2, + const String & title = "", + ColorP titlecolor = DOS_HIGH_WHITE, + ColorP titlebackcolor = DOS_MAGENTA, + ColorP front = DOS_WHITE, + ColorP shade1 = DOS_HIGH_WHITE, + ColorP shade2 = DOS_GRAY); + virtual void text(int x, int y, const String &, + ColorP textcolor = DOS_HIGH_WHITE, + align_t align = LEFT); + virtual void text3d(int x, int y, const String &, + ColorP textcolor = DOS_BLACK, + ColorP shade1 = DOS_HIGH_WHITE, + ColorP shade2 = DOS_GRAY, + align_t align = LEFT, + bool bevel = false); + virtual void button(int x1, int y1, int x2, int y2, const String &, + bool bevel = false, + ColorP front = DOS_WHITE, + ColorP shade1 = DOS_HIGH_WHITE, + ColorP shade2 = DOS_GRAY, + ColorP round = DOS_BLACK, + ColorP textcolor = DOS_BLACK, + ColorP tshade1 = DOS_HIGH_WHITE, + ColorP tshade2 = DOS_GRAY); + private: + virtual bool Enter(); + virtual void Leave(bool); + }; +}; + +#endif diff --git a/include/texture.h b/include/texture.h new file mode 100644 index 0000000..4f5e162 --- /dev/null +++ b/include/texture.h @@ -0,0 +1,39 @@ +#ifndef __GLTEXTURE_H__ +#define __GLTEXTURE_H__ + +#include +#include +#include +#include +#include + +namespace mogltk { + class texture : public Base { + 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) ; + void Generate(); + 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; + }; +}; + +#endif -- cgit v1.2.3