diff options
author | pixel <pixel> | 2004-11-27 21:44:50 +0000 |
---|---|---|
committer | pixel <pixel> | 2004-11-27 21:44:50 +0000 |
commit | 1ae229afb9bff4a3636c08632032b509e1e80ec4 (patch) | |
tree | 9a78b288fcff587617d5174d8e74b7bdd6d41aa3 /include | |
parent | 70b1a3c1c6b7f33b3af777bedaa784e34ef81719 (diff) |
Large dos2unix commit...
Diffstat (limited to 'include')
-rw-r--r-- | include/base.h | 114 | ||||
-rw-r--r-- | include/engine.h | 202 | ||||
-rw-r--r-- | include/font.h | 166 | ||||
-rw-r--r-- | include/gettext.h | 126 | ||||
-rw-r--r-- | include/glbase.h | 106 | ||||
-rw-r--r-- | include/glfont.h | 76 | ||||
-rw-r--r-- | include/glshape.h | 114 | ||||
-rw-r--r-- | include/glsprite.h | 88 | ||||
-rw-r--r-- | include/glwidgets.h | 76 | ||||
-rw-r--r-- | include/mcolor.h | 92 | ||||
-rw-r--r-- | include/shape.h | 394 | ||||
-rw-r--r-- | include/sprite.h | 146 | ||||
-rw-r--r-- | include/texture.h | 126 |
13 files changed, 913 insertions, 913 deletions
diff --git a/include/base.h b/include/base.h index 8a2ccbf..8573cff 100644 --- a/include/base.h +++ b/include/base.h @@ -1,57 +1,57 @@ -/* - * mogltk - * Copyright (C) 1999-2004 Nicolas "Pixel" Noble - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* $Id: base.h,v 1.8 2004-07-15 14:21:30 pixel Exp $ */ - -#ifndef __BASE_H__ -#define __BASE_H__ - -#include <SDL.h> -#include <Exceptions.h> -#include <texture.h> - -namespace mogltk { - struct rect { - int x, y, w, h; - }; - 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(bool clear = true); - SDL_Surface * getsurface(); - virtual void Enter2DMode(); - virtual void Leave2DMode(); - virtual bool is2D(); - virtual void changeviewport(int x = 0, int y = 0, unsigned int w = 0, unsigned int h = 0); - void ToggleFullscreen(); - virtual texture * GrabTexture(); - virtual SDL_Surface * GrabSurface(); - protected: - base(int, int, int, int); - void setsurface(SDL_Surface *) throw (GeneralException); - private: - int width, height; - SDL_Surface * surface; - }; -}; - -#endif +/*
+ * mogltk
+ * Copyright (C) 1999-2004 Nicolas "Pixel" Noble
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* $Id: base.h,v 1.9 2004-11-27 21:44:50 pixel Exp $ */
+
+#ifndef __BASE_H__
+#define __BASE_H__
+
+#include <SDL.h>
+#include <Exceptions.h>
+#include <texture.h>
+
+namespace mogltk {
+ struct rect {
+ int x, y, w, h;
+ };
+ 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(bool clear = true);
+ SDL_Surface * getsurface();
+ virtual void Enter2DMode();
+ virtual void Leave2DMode();
+ virtual bool is2D();
+ virtual void changeviewport(int x = 0, int y = 0, unsigned int w = 0, unsigned int h = 0);
+ void ToggleFullscreen();
+ virtual texture * GrabTexture();
+ virtual SDL_Surface * GrabSurface();
+ 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 9d12e95..95b12f7 100644 --- a/include/engine.h +++ b/include/engine.h @@ -1,101 +1,101 @@ -/* - * mogltk - * Copyright (C) 1999-2004 Nicolas "Pixel" Noble - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* $Id: engine.h,v 1.18 2004-07-15 14:21:30 pixel Exp $ */ - -#ifndef __ENGINE_H__ -#define __ENGINE_H__ - -#include <SDL.h> -#include <Handle.h> -#include <Exceptions.h> -#include <base.h> -#include <glbase.h> -#include <widgets.h> - -namespace mogltk { - class engine : public Base { - public: - class keyevent : public Base { - public: - keyevent(); - virtual ~keyevent(); - virtual void down(SDL_keysym) = 0; - virtual void up(SDL_keysym) = 0; - protected: - keyevent * old_handler, * new_handler; - }; - class mouseevent : public Base { - public: - mouseevent(); - virtual ~mouseevent(); - virtual void move(SDL_MouseMotionEvent) = 0; - virtual void action(SDL_MouseButtonEvent) = 0; - protected: - mouseevent * old_handler, * new_handler; - }; - static int setup() throw(GeneralException); - static int postsetup() throw(GeneralException); - static int GetInited(); - static SDL_RWops * RWFromHandle(Handle *) throw (GeneralException); - static void pollevents() throw (GeneralException); - static void setappactive(bool); - static bool getappactive(); - static void setcursorvisible(bool); - static bool getcursorvisible(); - static void quit(); - static bool quitrequested(); - static int mouseX(); - static int mouseY(); - static int mouseZ(); - static void setmouseX(int); - static void setmouseY(int); - static void setmouseZ(int); - static int mousebuttons(); - static double FPS(); - static void lockmouse(); - static void unlockmouse(); - static void setkeyevent(keyevent *); - static void setmouseevent(mouseevent *); - static keyevent * getkeyevent(); - static mouseevent * getmouseevent(); - static glbase * glbase_o; - static base * base_o; - static widget * root; - private: - static bool inited; - static bool postsetuped; - static bool appactive; - static bool cursorvisible; - static bool quitrequest; - static int mx; - static int my; - static int mz; - static int mbuttons; - static int frames; - static double curfps; - static Uint32 curticks; - static int locked; - static keyevent * keyevent_h; - static mouseevent * mouseevent_h; - static void updatemouse(); - }; -}; - -#endif +/*
+ * mogltk
+ * Copyright (C) 1999-2004 Nicolas "Pixel" Noble
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* $Id: engine.h,v 1.19 2004-11-27 21:44:50 pixel Exp $ */
+
+#ifndef __ENGINE_H__
+#define __ENGINE_H__
+
+#include <SDL.h>
+#include <Handle.h>
+#include <Exceptions.h>
+#include <base.h>
+#include <glbase.h>
+#include <widgets.h>
+
+namespace mogltk {
+ class engine : public Base {
+ public:
+ class keyevent : public Base {
+ public:
+ keyevent();
+ virtual ~keyevent();
+ virtual void down(SDL_keysym) = 0;
+ virtual void up(SDL_keysym) = 0;
+ protected:
+ keyevent * old_handler, * new_handler;
+ };
+ class mouseevent : public Base {
+ public:
+ mouseevent();
+ virtual ~mouseevent();
+ virtual void move(SDL_MouseMotionEvent) = 0;
+ virtual void action(SDL_MouseButtonEvent) = 0;
+ protected:
+ mouseevent * old_handler, * new_handler;
+ };
+ static int setup() throw(GeneralException);
+ static int postsetup() throw(GeneralException);
+ static int GetInited();
+ static SDL_RWops * RWFromHandle(Handle *) throw (GeneralException);
+ static void pollevents() throw (GeneralException);
+ static void setappactive(bool);
+ static bool getappactive();
+ static void setcursorvisible(bool);
+ static bool getcursorvisible();
+ static void quit();
+ static bool quitrequested();
+ static int mouseX();
+ static int mouseY();
+ static int mouseZ();
+ static void setmouseX(int);
+ static void setmouseY(int);
+ static void setmouseZ(int);
+ static int mousebuttons();
+ static double FPS();
+ static void lockmouse();
+ static void unlockmouse();
+ static void setkeyevent(keyevent *);
+ static void setmouseevent(mouseevent *);
+ static keyevent * getkeyevent();
+ static mouseevent * getmouseevent();
+ static glbase * glbase_o;
+ static base * base_o;
+ static widget * root;
+ private:
+ static bool inited;
+ static bool postsetuped;
+ static bool appactive;
+ static bool cursorvisible;
+ static bool quitrequest;
+ static int mx;
+ static int my;
+ static int mz;
+ static int mbuttons;
+ static int frames;
+ static double curfps;
+ static Uint32 curticks;
+ static int locked;
+ static keyevent * keyevent_h;
+ static mouseevent * mouseevent_h;
+ static void updatemouse();
+ };
+};
+
+#endif
diff --git a/include/font.h b/include/font.h index 0ad075f..d69fc50 100644 --- a/include/font.h +++ b/include/font.h @@ -1,83 +1,83 @@ -/* - * mogltk - * Copyright (C) 1999-2004 Nicolas "Pixel" Noble - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* $Id: font.h,v 1.8 2004-07-15 14:21:30 pixel Exp $ */ - -#ifndef __FONT_H__ -#define __FONT_H__ - -#include <SDL.h> -#include <stdarg.h> -#include <BString.h> -#include <Handle.h> -#include <texture.h> -#include <mcolor.h> -#include <base.h> - -namespace mogltk { - class font : public Base { - public: - font(Handle *); - virtual ~font(); - virtual void drawentry(Uint16, int, int, ColorP = WHITE); - void drawtotex(texture *, Uint16, int, int, ColorP = WHITE); - void putcursor(int, int); - void putentry(Uint16, ColorP = WHITE); - void putentryontex(texture *, Uint16, ColorP = WHITE); - void drawchar(char, ColorP = WHITE); - void drawcharontex(texture *, char, ColorP = WHITE); - void newline(void); - int printf(const ugly_string &, ...); - int printf(const char *, ...); - int printf(const ugly_string &, va_list); - rect size(const ugly_string &, ...); - rect size(const char *, ...); - rect size(const ugly_string &, va_list); - rect printtotex(texture *, const ugly_string &, ...); - rect printtotex(texture *, const char *, ...); - rect printtotex(texture *, const ugly_string &, va_list); - texture * printtex(rect *, const ugly_string &, ...); - texture * printtex(rect *, const char *, ...); - texture * printtex(rect *, const ugly_string &, va_list); - void setcolor(ColorP); - void setshadow(int); - void setwspace(int); - int findchar(char) const; - int singletextsize(const String &) const; - - protected: - Uint8 * sizes; - Uint16 nbentries, nbcT, nbT; - Uint8 flags, maxX, maxY, nbcU, nbcV, base, inter; - int cx, cy, ox; - ColorP textcolor; - int shadow, wspace; - texture * alloctexture(); - void Bind(int); - private: - void checknbind(int, ColorP); - texture ** fonttex; - texture ** fontcache[16]; - Uint16 * corresp; - }; - extern font * SystemFont; - extern font * FixedFont; -}; - -#endif +/*
+ * mogltk
+ * Copyright (C) 1999-2004 Nicolas "Pixel" Noble
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* $Id: font.h,v 1.9 2004-11-27 21:44:50 pixel Exp $ */
+
+#ifndef __FONT_H__
+#define __FONT_H__
+
+#include <SDL.h>
+#include <stdarg.h>
+#include <BString.h>
+#include <Handle.h>
+#include <texture.h>
+#include <mcolor.h>
+#include <base.h>
+
+namespace mogltk {
+ class font : public Base {
+ public:
+ font(Handle *);
+ virtual ~font();
+ virtual void drawentry(Uint16, int, int, ColorP = WHITE);
+ void drawtotex(texture *, Uint16, int, int, ColorP = WHITE);
+ void putcursor(int, int);
+ void putentry(Uint16, ColorP = WHITE);
+ void putentryontex(texture *, Uint16, ColorP = WHITE);
+ void drawchar(char, ColorP = WHITE);
+ void drawcharontex(texture *, char, ColorP = WHITE);
+ void newline(void);
+ int printf(const ugly_string &, ...);
+ int printf(const char *, ...);
+ int printf(const ugly_string &, va_list);
+ rect size(const ugly_string &, ...);
+ rect size(const char *, ...);
+ rect size(const ugly_string &, va_list);
+ rect printtotex(texture *, const ugly_string &, ...);
+ rect printtotex(texture *, const char *, ...);
+ rect printtotex(texture *, const ugly_string &, va_list);
+ texture * printtex(rect *, const ugly_string &, ...);
+ texture * printtex(rect *, const char *, ...);
+ texture * printtex(rect *, const ugly_string &, va_list);
+ void setcolor(ColorP);
+ void setshadow(int);
+ void setwspace(int);
+ int findchar(char) const;
+ int singletextsize(const String &) const;
+
+ protected:
+ Uint8 * sizes;
+ Uint16 nbentries, nbcT, nbT;
+ Uint8 flags, maxX, maxY, nbcU, nbcV, base, inter;
+ int cx, cy, ox;
+ ColorP textcolor;
+ int shadow, wspace;
+ texture * alloctexture();
+ void Bind(int);
+ private:
+ void checknbind(int, ColorP);
+ texture ** fonttex;
+ texture ** fontcache[16];
+ Uint16 * corresp;
+ };
+ extern font * SystemFont;
+ extern font * FixedFont;
+};
+
+#endif
diff --git a/include/gettext.h b/include/gettext.h index b530d9c..c4fe094 100644 --- a/include/gettext.h +++ b/include/gettext.h @@ -1,63 +1,63 @@ -/* Convenience header for conditional use of GNU <libintl.h>. - Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public License as published - by the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, - USA. */ - -#ifndef _LIBGETTEXT_H -#define _LIBGETTEXT_H 1 - -/* NLS can be disabled through the configure --disable-nls option. */ -#if ENABLE_NLS - -/* Get declarations of GNU message catalog functions. */ -# include <libintl.h> - -#else - -/* Disabled NLS. - The casts to 'const char *' serve the purpose of producing warnings - for invalid uses of the value returned from these functions. - On pre-ANSI systems without 'const', the config.h file is supposed to - contain "#define const". */ -# define gettext(Msgid) ((const char *) (Msgid)) -# define dgettext(Domainname, Msgid) ((const char *) (Msgid)) -# define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid)) -# define ngettext(Msgid1, Msgid2, N) \ - ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) -# define dngettext(Domainname, Msgid1, Msgid2, N) \ - ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) -# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ - ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) -# define textdomain(Domainname) ((const char *) (Domainname)) -# define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname)) -# define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset)) -# define setlocale(a, b) - -#endif - -/* A pseudo function call that serves as a marker for the automated - extraction of messages, but does not call gettext(). The run-time - translation is done at a different place in the code. - The argument, String, should be a literal string. Concatenated strings - and other string expressions won't work. - The macro's expansion is not parenthesized, so that it is suitable as - 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 */ +/* Convenience header for conditional use of GNU <libintl.h>.
+ Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Library General Public License as published
+ by the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA. */
+
+#ifndef _LIBGETTEXT_H
+#define _LIBGETTEXT_H 1
+
+/* NLS can be disabled through the configure --disable-nls option. */
+#if ENABLE_NLS
+
+/* Get declarations of GNU message catalog functions. */
+# include <libintl.h>
+
+#else
+
+/* Disabled NLS.
+ The casts to 'const char *' serve the purpose of producing warnings
+ for invalid uses of the value returned from these functions.
+ On pre-ANSI systems without 'const', the config.h file is supposed to
+ contain "#define const". */
+# define gettext(Msgid) ((const char *) (Msgid))
+# define dgettext(Domainname, Msgid) ((const char *) (Msgid))
+# define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid))
+# define ngettext(Msgid1, Msgid2, N) \
+ ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
+# define dngettext(Domainname, Msgid1, Msgid2, N) \
+ ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
+# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
+ ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
+# define textdomain(Domainname) ((const char *) (Domainname))
+# define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname))
+# define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset))
+# define setlocale(a, b)
+
+#endif
+
+/* A pseudo function call that serves as a marker for the automated
+ extraction of messages, but does not call gettext(). The run-time
+ translation is done at a different place in the code.
+ The argument, String, should be a literal string. Concatenated strings
+ and other string expressions won't work.
+ The macro's expansion is not parenthesized, so that it is suitable as
+ 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 031821e..4528d78 100644 --- a/include/glbase.h +++ b/include/glbase.h @@ -1,53 +1,53 @@ -/* - * mogltk - * Copyright (C) 1999-2004 Nicolas "Pixel" Noble - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* $Id: glbase.h,v 1.10 2004-07-15 14:21:30 pixel Exp $ */ - -#ifndef __GLBASE_H__ -#define __GLBASE_H__ - -#include <SDL.h> -#include <SDL_opengl.h> -#include <Exceptions.h> -#include <base.h> - -namespace mogltk { - class glbase : public base { - public: - glbase(int w = 640, int h = 480, int flags = 0) throw(GeneralException); - virtual ~glbase(); - virtual void Enter2DMode(void); - virtual void Leave2DMode(void); - virtual void Flip(bool clear = true); - virtual bool is2D(void); - virtual void changeviewport(int x = 0, int y = 0, unsigned int w = 0, unsigned int h = 0); - void changefovy(GLdouble); - 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); - virtual texture * GrabTexture(); - virtual SDL_Surface * GrabSurface(); - private: - int twoD; - GLdouble ratio, fovy; - }; -}; - -#endif +/*
+ * mogltk
+ * Copyright (C) 1999-2004 Nicolas "Pixel" Noble
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* $Id: glbase.h,v 1.11 2004-11-27 21:44:50 pixel Exp $ */
+
+#ifndef __GLBASE_H__
+#define __GLBASE_H__
+
+#include <SDL.h>
+#include <SDL_opengl.h>
+#include <Exceptions.h>
+#include <base.h>
+
+namespace mogltk {
+ class glbase : public base {
+ public:
+ glbase(int w = 640, int h = 480, int flags = 0) throw(GeneralException);
+ virtual ~glbase();
+ virtual void Enter2DMode(void);
+ virtual void Leave2DMode(void);
+ virtual void Flip(bool clear = true);
+ virtual bool is2D(void);
+ virtual void changeviewport(int x = 0, int y = 0, unsigned int w = 0, unsigned int h = 0);
+ void changefovy(GLdouble);
+ 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);
+ virtual texture * GrabTexture();
+ virtual SDL_Surface * GrabSurface();
+ private:
+ int twoD;
+ GLdouble ratio, fovy;
+ };
+};
+
+#endif
diff --git a/include/glfont.h b/include/glfont.h index 185b316..bd36f68 100644 --- a/include/glfont.h +++ b/include/glfont.h @@ -1,38 +1,38 @@ -/* - * mogltk - * Copyright (C) 1999-2004 Nicolas "Pixel" Noble - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* $Id: glfont.h,v 1.14 2004-07-15 14:21:30 pixel Exp $ */ - -#ifndef __GLFONT_H__ -#define __GLFONT_H__ - -#include <SDL.h> -#include <font.h> -#include <mcolor.h> - -namespace mogltk { - class glfont : public font { - public: - glfont(Handle *); - virtual ~glfont(); - void drawentry(Uint16, int, int, ColorP = WHITE); - }; -}; - -#endif +/*
+ * mogltk
+ * Copyright (C) 1999-2004 Nicolas "Pixel" Noble
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* $Id: glfont.h,v 1.15 2004-11-27 21:44:50 pixel Exp $ */
+
+#ifndef __GLFONT_H__
+#define __GLFONT_H__
+
+#include <SDL.h>
+#include <font.h>
+#include <mcolor.h>
+
+namespace mogltk {
+ class glfont : public font {
+ public:
+ glfont(Handle *);
+ virtual ~glfont();
+ void drawentry(Uint16, int, int, ColorP = WHITE);
+ };
+};
+
+#endif
diff --git a/include/glshape.h b/include/glshape.h index 9ee541d..0226ac2 100644 --- a/include/glshape.h +++ b/include/glshape.h @@ -1,57 +1,57 @@ -/* - * mogltk - * Copyright (C) 1999-2004 Nicolas "Pixel" Noble - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* $Id: glshape.h,v 1.13 2004-07-15 14:21:30 pixel Exp $ */ - -#ifndef __GLSHAPE_H__ -#define __GLSHAPE_H__ - -#include <Exceptions.h> -#include <BString.h> -#include <mcolor.h> -#include <texture.h> -#include <shape.h> - -namespace mogltk { - class glshape : public shape { - 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 = DOS_WHITE); - virtual void obox(int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP); - virtual void hline(int x1, int x2, int y, ColorP = DOS_WHITE); - virtual void hline(int x1, int x2, int y, ColorP, ColorP); - virtual void vline(int x, int y1, int y2, ColorP = DOS_WHITE); - virtual void vline(int x, int y1, int y2, 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 fdraw(fill * f, ColorP = WHITE, int sx = 0, int sy = 0); - virtual void sdraw(fill * f, ColorP = WHITE, int sx = 0, int sy = 0); - private: - bool Enter(bool); - virtual bool Enter(); - virtual void Leave(bool); - }; -}; - -#endif +/*
+ * mogltk
+ * Copyright (C) 1999-2004 Nicolas "Pixel" Noble
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* $Id: glshape.h,v 1.14 2004-11-27 21:44:50 pixel Exp $ */
+
+#ifndef __GLSHAPE_H__
+#define __GLSHAPE_H__
+
+#include <Exceptions.h>
+#include <BString.h>
+#include <mcolor.h>
+#include <texture.h>
+#include <shape.h>
+
+namespace mogltk {
+ class glshape : public shape {
+ 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 = DOS_WHITE);
+ virtual void obox(int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP);
+ virtual void hline(int x1, int x2, int y, ColorP = DOS_WHITE);
+ virtual void hline(int x1, int x2, int y, ColorP, ColorP);
+ virtual void vline(int x, int y1, int y2, ColorP = DOS_WHITE);
+ virtual void vline(int x, int y1, int y2, 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 fdraw(fill * f, ColorP = WHITE, int sx = 0, int sy = 0);
+ virtual void sdraw(fill * f, ColorP = WHITE, int sx = 0, int sy = 0);
+ private:
+ bool Enter(bool);
+ virtual bool Enter();
+ virtual void Leave(bool);
+ };
+};
+
+#endif
diff --git a/include/glsprite.h b/include/glsprite.h index 031f1b8..3758a3c 100644 --- a/include/glsprite.h +++ b/include/glsprite.h @@ -1,44 +1,44 @@ -/* - * mogltk - * Copyright (C) 1999-2004 Nicolas "Pixel" Noble - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* $Id: glsprite.h,v 1.5 2004-07-15 14:21:30 pixel Exp $ */ - -#ifndef __GLSPRITE_H__ -#define __GLSPRITE_H__ - -#include <vector> -#include <Exceptions.h> -#include <Handle.h> -#include <mcolor.h> -#include <texture.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, float = 1.0, float = 1.0); - void bindcorner(float, float); - virtual void drawrotate(int, int, double, ColorP = WHITE); - }; -}; - -#endif +/*
+ * mogltk
+ * Copyright (C) 1999-2004 Nicolas "Pixel" Noble
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* $Id: glsprite.h,v 1.6 2004-11-27 21:44:50 pixel Exp $ */
+
+#ifndef __GLSPRITE_H__
+#define __GLSPRITE_H__
+
+#include <vector>
+#include <Exceptions.h>
+#include <Handle.h>
+#include <mcolor.h>
+#include <texture.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, float = 1.0, float = 1.0);
+ void bindcorner(float, float);
+ virtual void drawrotate(int, int, double, ColorP = WHITE);
+ };
+};
+
+#endif
diff --git a/include/glwidgets.h b/include/glwidgets.h index 7b4eea8..f4c6c39 100644 --- a/include/glwidgets.h +++ b/include/glwidgets.h @@ -1,38 +1,38 @@ -/* - * mogltk - * Copyright (C) 1999-2004 Nicolas "Pixel" Noble - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* $Id: glwidgets.h,v 1.7 2004-07-15 14:21:30 pixel Exp $ */ - -#ifndef __GLWIDGETS_H__ -#define __GLWIDGETS_H__ - -#include <widgets.h> - -namespace mogltk { - namespace widgets { - class glRoot : public Root { - public: - glRoot(shape *); - protected: - virtual void draw(); - }; - }; -}; - -#endif +/*
+ * mogltk
+ * Copyright (C) 1999-2004 Nicolas "Pixel" Noble
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* $Id: glwidgets.h,v 1.8 2004-11-27 21:44:50 pixel Exp $ */
+
+#ifndef __GLWIDGETS_H__
+#define __GLWIDGETS_H__
+
+#include <widgets.h>
+
+namespace mogltk {
+ namespace widgets {
+ class glRoot : public Root {
+ public:
+ glRoot(shape *);
+ protected:
+ virtual void draw();
+ };
+ };
+};
+
+#endif
diff --git a/include/mcolor.h b/include/mcolor.h index abb1e10..e718af4 100644 --- a/include/mcolor.h +++ b/include/mcolor.h @@ -1,46 +1,46 @@ -/* - * mogltk - * Copyright (C) 1999-2004 Nicolas "Pixel" Noble - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* $Id: mcolor.h,v 1.7 2004-07-15 14:21:30 pixel Exp $ */ - -#ifndef __MCOLOR_H__ -#define __MCOLOR_H__ - -#include <SDL.h> -#include <Exceptions.h> -#include <Color.h> - -namespace mogltk { - class ColorP : public Base { - public: - ColorP(const Color & = WHITE); - ColorP(Uint8, Uint8, Uint8, Uint8); - bool operator==(const ColorP &); - Color * operator->(); - void Bind(); - void Norm(); - Uint32 toSDL(SDL_PixelFormat * = 0); - void fromSDL(Uint32, SDL_PixelFormat * = 0); - static Color Min; - static Color Max; - Color c; - }; -}; - -#endif +/*
+ * mogltk
+ * Copyright (C) 1999-2004 Nicolas "Pixel" Noble
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* $Id: mcolor.h,v 1.8 2004-11-27 21:44:50 pixel Exp $ */
+
+#ifndef __MCOLOR_H__
+#define __MCOLOR_H__
+
+#include <SDL.h>
+#include <Exceptions.h>
+#include <Color.h>
+
+namespace mogltk {
+ class ColorP : public Base {
+ public:
+ ColorP(const Color & = WHITE);
+ ColorP(Uint8, Uint8, Uint8, Uint8);
+ bool operator==(const ColorP &);
+ Color * operator->();
+ void Bind();
+ void Norm();
+ Uint32 toSDL(SDL_PixelFormat * = 0);
+ void fromSDL(Uint32, SDL_PixelFormat * = 0);
+ static Color Min;
+ static Color Max;
+ Color c;
+ };
+};
+
+#endif
diff --git a/include/shape.h b/include/shape.h index a3d3bcb..d5932cd 100644 --- a/include/shape.h +++ b/include/shape.h @@ -1,197 +1,197 @@ -/* - * mogltk - * Copyright (C) 1999-2004 Nicolas "Pixel" Noble - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* $Id: shape.h,v 1.14 2004-07-15 14:21:30 pixel Exp $ */ - -#ifndef __SHAPE_H__ -#define __SHAPE_H__ - -#include <vector> -#include <Exceptions.h> -#include <BString.h> -#include <mcolor.h> -#include <texture.h> - -namespace mogltk { - typedef enum { - LEFT, - CENTER, - RIGHT - } align_t; - class fillwalker : public Base { - public: - fillwalker(); - virtual ~fillwalker(); - virtual void step(int x, int y); - }; - class segwalker : public Base { - public: - segwalker(); - virtual ~segwalker(); - virtual void step(int x1, int y1, int x2, int y2); - }; - class fill : public Base { - public: - fill(); - virtual ~fill(); - void walk(fillwalker *); - void swalk(segwalker *); - void insert(int, int, int, int); - void insertfix(int, int); - int GetMinX() const; - int GetMinY() const; - int GetMaxX() const; - int GetMaxY() const; - texture * GetTexture(); - texture * Talloc(); - texture * GetSTexture(); - texture * STalloc(); - Color last; - private: - void insert(int, int); - struct segment { - int x1, y1, x2, y2; - }; - class sline : public Base { - public: - sline(int, fill *); - virtual ~sline(); - int GetY() const; - void insert(int, int); - void insertfix(int, int); - void walk(fillwalker *); - private: - class point : public Base { - public: - point(int, sline *); - virtual ~point(); - int GetX() const; - int GetY() const; - void walk(fillwalker *); - point * look(int); - private: - int x; - point * next; - sline * header; - }; - int y; - sline * next; - fill * header; - sline * look(int); - protected: - point * pheader; - friend class point; - private: - int count() const; - }; - int minX, minY, maxX, maxY; - texture * cached; - texture * scached; - std::vector<segment> segments; - protected: - sline * header; - friend class sline; - }; - class shape : public Base { - public: - shape(SDL_Surface * = 0); - virtual void pixel(int x, int y, ColorP = WHITE); - virtual void circle(int x, int y, int r, ColorP = WHITE); - virtual void pcircle(int x, int y, int r, ColorP = WHITE); - virtual fill * fcircle(int x, int y, int r); - virtual void fdraw(fill *, ColorP = WHITE, int sx = 0, int sy = 0); - virtual void sdraw(fill *, ColorP = WHITE, int sx = 0, int sy = 0); - virtual void box(int x1, int y1, int x2, int y2, ColorP = DOS_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 = DOS_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 hline(int x1, int x2, int y, ColorP = DOS_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 = DOS_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 line(int x1, int y1, int x2, int y2, ColorP = WHITE); - 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 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); - SDL_Surface * GetSurf(); - private: - void bsubline_1(int x1, int y1, int x2, int y2, ColorP = WHITE); - void bsubline_2(int x1, int y1, int x2, int y2, ColorP = WHITE); - void bsubline_3(int x1, int y1, int x2, int y2, ColorP = WHITE); - void bsubline_4(int x1, int y1, int x2, int y2, ColorP = WHITE); - virtual bool Enter(); - virtual void Leave(bool); - SDL_Surface * surf; - }; - - class filldrawer : public fillwalker { - public: - filldrawer(fill *, texture *, ColorP = DOS_WHITE); - virtual ~filldrawer(); - virtual void step(int x, int y); - private: - fill * f; - texture * t; - ColorP c; - int oldx, oldy; - }; - class segdrawer : public segwalker { - public: - segdrawer(fill *, texture *, ColorP = DOS_WHITE); - virtual ~segdrawer(); - virtual void step(int x1, int y1, int x2, int y2); - private: - fill * f; - texture * t; - ColorP c; - shape * sh; - }; -}; - -#endif +/*
+ * mogltk
+ * Copyright (C) 1999-2004 Nicolas "Pixel" Noble
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* $Id: shape.h,v 1.15 2004-11-27 21:44:50 pixel Exp $ */
+
+#ifndef __SHAPE_H__
+#define __SHAPE_H__
+
+#include <vector>
+#include <Exceptions.h>
+#include <BString.h>
+#include <mcolor.h>
+#include <texture.h>
+
+namespace mogltk {
+ typedef enum {
+ LEFT,
+ CENTER,
+ RIGHT
+ } align_t;
+ class fillwalker : public Base {
+ public:
+ fillwalker();
+ virtual ~fillwalker();
+ virtual void step(int x, int y);
+ };
+ class segwalker : public Base {
+ public:
+ segwalker();
+ virtual ~segwalker();
+ virtual void step(int x1, int y1, int x2, int y2);
+ };
+ class fill : public Base {
+ public:
+ fill();
+ virtual ~fill();
+ void walk(fillwalker *);
+ void swalk(segwalker *);
+ void insert(int, int, int, int);
+ void insertfix(int, int);
+ int GetMinX() const;
+ int GetMinY() const;
+ int GetMaxX() const;
+ int GetMaxY() const;
+ texture * GetTexture();
+ texture * Talloc();
+ texture * GetSTexture();
+ texture * STalloc();
+ Color last;
+ private:
+ void insert(int, int);
+ struct segment {
+ int x1, y1, x2, y2;
+ };
+ class sline : public Base {
+ public:
+ sline(int, fill *);
+ virtual ~sline();
+ int GetY() const;
+ void insert(int, int);
+ void insertfix(int, int);
+ void walk(fillwalker *);
+ private:
+ class point : public Base {
+ public:
+ point(int, sline *);
+ virtual ~point();
+ int GetX() const;
+ int GetY() const;
+ void walk(fillwalker *);
+ point * look(int);
+ private:
+ int x;
+ point * next;
+ sline * header;
+ };
+ int y;
+ sline * next;
+ fill * header;
+ sline * look(int);
+ protected:
+ point * pheader;
+ friend class point;
+ private:
+ int count() const;
+ };
+ int minX, minY, maxX, maxY;
+ texture * cached;
+ texture * scached;
+ std::vector<segment> segments;
+ protected:
+ sline * header;
+ friend class sline;
+ };
+ class shape : public Base {
+ public:
+ shape(SDL_Surface * = 0);
+ virtual void pixel(int x, int y, ColorP = WHITE);
+ virtual void circle(int x, int y, int r, ColorP = WHITE);
+ virtual void pcircle(int x, int y, int r, ColorP = WHITE);
+ virtual fill * fcircle(int x, int y, int r);
+ virtual void fdraw(fill *, ColorP = WHITE, int sx = 0, int sy = 0);
+ virtual void sdraw(fill *, ColorP = WHITE, int sx = 0, int sy = 0);
+ virtual void box(int x1, int y1, int x2, int y2, ColorP = DOS_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 = DOS_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 hline(int x1, int x2, int y, ColorP = DOS_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 = DOS_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 line(int x1, int y1, int x2, int y2, ColorP = WHITE);
+ 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 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);
+ SDL_Surface * GetSurf();
+ private:
+ void bsubline_1(int x1, int y1, int x2, int y2, ColorP = WHITE);
+ void bsubline_2(int x1, int y1, int x2, int y2, ColorP = WHITE);
+ void bsubline_3(int x1, int y1, int x2, int y2, ColorP = WHITE);
+ void bsubline_4(int x1, int y1, int x2, int y2, ColorP = WHITE);
+ virtual bool Enter();
+ virtual void Leave(bool);
+ SDL_Surface * surf;
+ };
+
+ class filldrawer : public fillwalker {
+ public:
+ filldrawer(fill *, texture *, ColorP = DOS_WHITE);
+ virtual ~filldrawer();
+ virtual void step(int x, int y);
+ private:
+ fill * f;
+ texture * t;
+ ColorP c;
+ int oldx, oldy;
+ };
+ class segdrawer : public segwalker {
+ public:
+ segdrawer(fill *, texture *, ColorP = DOS_WHITE);
+ virtual ~segdrawer();
+ virtual void step(int x1, int y1, int x2, int y2);
+ private:
+ fill * f;
+ texture * t;
+ ColorP c;
+ shape * sh;
+ };
+};
+
+#endif
diff --git a/include/sprite.h b/include/sprite.h index 5c7f041..dd701f5 100644 --- a/include/sprite.h +++ b/include/sprite.h @@ -1,73 +1,73 @@ -/* - * mogltk - * Copyright (C) 1999-2004 Nicolas "Pixel" Noble - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* $Id: sprite.h,v 1.11 2004-07-15 14:21:30 pixel Exp $ */ - -#ifndef __SPRITE_H__ -#define __SPRITE_H__ - -#include <vector> -#include <Exceptions.h> -#include <Handle.h> -#include <mcolor.h> -#include <texture.h> - -namespace mogltk { - class Sprite : public Base { - public: - Sprite(Handle *, int, int) throw (GeneralException); - Sprite(Uint8 *, int, int); - virtual ~Sprite(); - virtual void draw(int, int, ColorP = WHITE, float = 1.0, float = 1.0); - int GetSX(); - int GetSY(); - static Sprite * Cursor; - protected: - void Bind(); - int GetPX(); - int GetPY(); - private: - class TexList : public Base { - public: - TexList(int); - virtual ~TexList(); - Sprite * sprheader; - const texture * GetTex() const; - texture * GetTex(); - static const TexList * GetHead(); - const TexList * GetNext() const; - TexList * GetNext(); - void Bind() const; - SDL_Surface * GetSurface(); - private: - texture * tex; - static TexList * header; - TexList * next, * prev; - }; - Sprite * 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 +/*
+ * mogltk
+ * Copyright (C) 1999-2004 Nicolas "Pixel" Noble
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* $Id: sprite.h,v 1.12 2004-11-27 21:44:50 pixel Exp $ */
+
+#ifndef __SPRITE_H__
+#define __SPRITE_H__
+
+#include <vector>
+#include <Exceptions.h>
+#include <Handle.h>
+#include <mcolor.h>
+#include <texture.h>
+
+namespace mogltk {
+ class Sprite : public Base {
+ public:
+ Sprite(Handle *, int, int) throw (GeneralException);
+ Sprite(Uint8 *, int, int);
+ virtual ~Sprite();
+ virtual void draw(int, int, ColorP = WHITE, float = 1.0, float = 1.0);
+ int GetSX();
+ int GetSY();
+ static Sprite * Cursor;
+ protected:
+ void Bind();
+ int GetPX();
+ int GetPY();
+ private:
+ class TexList : public Base {
+ public:
+ TexList(int);
+ virtual ~TexList();
+ Sprite * sprheader;
+ const texture * GetTex() const;
+ texture * GetTex();
+ static const TexList * GetHead();
+ const TexList * GetNext() const;
+ TexList * GetNext();
+ void Bind() const;
+ SDL_Surface * GetSurface();
+ private:
+ texture * tex;
+ static TexList * header;
+ TexList * next, * prev;
+ };
+ Sprite * 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/texture.h b/include/texture.h index 8bff668..ceaacd1 100644 --- a/include/texture.h +++ b/include/texture.h @@ -1,63 +1,63 @@ -/* - * mogltk - * Copyright (C) 1999-2004 Nicolas "Pixel" Noble - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* $Id: texture.h,v 1.7 2004-07-15 14:21:30 pixel Exp $ */ - -#ifndef __TEXTURE_H__ -#define __TEXTURE_H__ - -#include <SDL.h> -#include <SDL_opengl.h> -#include <Handle.h> -#include <Exceptions.h> -#include <generic.h> - -namespace mogltk { - class texture : public Base { - public: - texture(int, int, bool = false) throw (GeneralException); - texture(Handle *, bool = false) throw (GeneralException); - texture(int, int, int, int); - virtual ~texture(); - SDL_Surface * GetSurface(); - Uint32 * GetPixels(); - SDL_PixelFormat * GetFormat(); - 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); - static void Taintall(void); - void DumpBMP(const String &); - private: - GLuint width, height, tex; - bool texture_allocated; - SDL_Surface * surface; - bool planar, tainted, taintable; - static texture * header; - static texture * footer; - texture * next, * prev; - static texture * active; - void recTaint(void); - }; -}; - -#endif +/*
+ * mogltk
+ * Copyright (C) 1999-2004 Nicolas "Pixel" Noble
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* $Id: texture.h,v 1.8 2004-11-27 21:44:50 pixel Exp $ */
+
+#ifndef __TEXTURE_H__
+#define __TEXTURE_H__
+
+#include <SDL.h>
+#include <SDL_opengl.h>
+#include <Handle.h>
+#include <Exceptions.h>
+#include <generic.h>
+
+namespace mogltk {
+ class texture : public Base {
+ public:
+ texture(int, int, bool = false) throw (GeneralException);
+ texture(Handle *, bool = false) throw (GeneralException);
+ texture(int, int, int, int);
+ virtual ~texture();
+ SDL_Surface * GetSurface();
+ Uint32 * GetPixels();
+ SDL_PixelFormat * GetFormat();
+ 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);
+ static void Taintall(void);
+ void DumpBMP(const String &);
+ private:
+ GLuint width, height, tex;
+ bool texture_allocated;
+ SDL_Surface * surface;
+ bool planar, tainted, taintable;
+ static texture * header;
+ static texture * footer;
+ texture * next, * prev;
+ static texture * active;
+ void recTaint(void);
+ };
+};
+
+#endif
|