summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpixel <pixel>2006-10-28 16:50:46 +0000
committerpixel <pixel>2006-10-28 16:50:46 +0000
commit45e08ccde95c84932557701235558e72cdc95f1b (patch)
tree0c318c6f589002a8d486c107519b4cf4fd4be1cb
parenta13cd83fb51c2e744b8b80dc26696190ec9bff6d (diff)
Fixing caps in class names.
-rw-r--r--include/base.h6
-rw-r--r--include/engine.h8
-rw-r--r--include/font.h38
-rw-r--r--include/glbase.h4
-rw-r--r--include/glfont.h6
-rw-r--r--include/glshape.h20
-rw-r--r--include/glsprite.h4
-rw-r--r--include/glwidgets.h8
-rw-r--r--include/mcolor.h3
-rw-r--r--include/shape.h64
-rw-r--r--include/sprite.h10
-rw-r--r--include/texture.h22
-rw-r--r--include/widgets.h142
-rw-r--r--lib/LuaGL.cc4
-rw-r--r--lib/base.cc10
-rw-r--r--lib/contextmenu.cc98
-rw-r--r--lib/engine.cc8
-rw-r--r--lib/font.cc100
-rw-r--r--lib/glbase.cc6
-rw-r--r--lib/glfont.cc4
-rw-r--r--lib/glshape.cc52
-rw-r--r--lib/glwidgets.cc4
-rw-r--r--lib/inputtext.cc34
-rw-r--r--lib/mcolor.cc37
-rw-r--r--lib/shape.cc154
-rw-r--r--lib/sprite.cc12
-rw-r--r--lib/texture.cc66
-rw-r--r--lib/widgets.cc249
28 files changed, 613 insertions, 560 deletions
diff --git a/include/base.h b/include/base.h
index c08c055..96763e5 100644
--- a/include/base.h
+++ b/include/base.h
@@ -17,14 +17,14 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: base.h,v 1.10 2004-11-27 21:48:01 pixel Exp $ */
+/* $Id: base.h,v 1.11 2006-10-28 16:50:46 pixel Exp $ */
#ifndef __BASE_H__
#define __BASE_H__
#include <SDL.h>
#include <Exceptions.h>
-#include <texture.h>
+#include <Texture.h>
namespace mogltk {
struct rect {
@@ -43,7 +43,7 @@ namespace mogltk {
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 Texture * GrabTexture();
virtual SDL_Surface * GrabSurface();
protected:
base(int, int, int, int);
diff --git a/include/engine.h b/include/engine.h
index 0d4afbc..77846ac 100644
--- a/include/engine.h
+++ b/include/engine.h
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: engine.h,v 1.22 2006-02-09 17:04:57 pixel Exp $ */
+/* $Id: engine.h,v 1.23 2006-10-28 16:50:46 pixel Exp $ */
#ifndef __ENGINE_H__
#define __ENGINE_H__
@@ -29,7 +29,7 @@
#include <glbase.h>
namespace mogltk {
- class widget;
+ class Widget;
class engine : public Base {
public:
class keyevent : public Base {
@@ -77,7 +77,7 @@ namespace mogltk {
static mouseevent * getmouseevent();
static glbase * glbase_o;
static base * base_o;
- static widget * root;
+ static Widget * root;
private:
static bool inited;
static bool postsetuped;
@@ -98,6 +98,6 @@ namespace mogltk {
};
};
-#include <widgets.h>
+#include <Widgets.h>
#endif
diff --git a/include/font.h b/include/font.h
index 6cf0e93..32d02dd 100644
--- a/include/font.h
+++ b/include/font.h
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: font.h,v 1.11 2005-12-01 13:48:12 pixel Exp $ */
+/* $Id: font.h,v 1.12 2006-10-28 16:50:46 pixel Exp $ */
#ifndef __FONT_H__
#define __FONT_H__
@@ -26,22 +26,22 @@
#include <stdarg.h>
#include <BString.h>
#include <Handle.h>
-#include <texture.h>
+#include <Texture.h>
#include <mcolor.h>
#include <base.h>
namespace mogltk {
- class font : public Base {
+ class Font : public Base {
public:
- font(Handle *);
- virtual ~font();
+ Font(Handle *);
+ virtual ~Font();
virtual void drawentry(Uint16, int, int, ColorP = WHITE);
- void drawtotex(texture *, 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 putentryontex(Texture *, Uint16, ColorP = WHITE);
void drawchar(unsigned char, ColorP = WHITE);
- void drawcharontex(texture *, unsigned char, ColorP = WHITE);
+ void drawcharontex(Texture *, unsigned char, ColorP = WHITE);
void newline(void);
int printf(const ugly_string &, ...);
int printf(const char *, ...);
@@ -49,12 +49,12 @@ namespace mogltk {
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);
+ 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);
@@ -68,16 +68,16 @@ namespace mogltk {
int cx, cy, ox;
ColorP textcolor;
int shadow, wspace;
- texture * alloctexture();
+ Texture * alloctexture();
void Bind(int);
private:
void checknbind(int, ColorP);
- texture ** fonttex;
- texture ** fontcache[16];
+ Texture ** fonttex;
+ Texture ** fontcache[16];
Uint16 * corresp;
};
- extern font * SystemFont;
- extern font * FixedFont;
+ extern Font * SystemFont;
+ extern Font * FixedFont;
};
#endif
diff --git a/include/glbase.h b/include/glbase.h
index 2936549..ab5422a 100644
--- a/include/glbase.h
+++ b/include/glbase.h
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: glbase.h,v 1.12 2004-11-27 21:48:01 pixel Exp $ */
+/* $Id: glbase.h,v 1.13 2006-10-28 16:50:46 pixel Exp $ */
#ifndef __GLBASE_H__
#define __GLBASE_H__
@@ -42,7 +42,7 @@ namespace mogltk {
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 Texture * GrabTexture();
virtual SDL_Surface * GrabSurface();
private:
int twoD;
diff --git a/include/glfont.h b/include/glfont.h
index b0ab2f6..4c2a880 100644
--- a/include/glfont.h
+++ b/include/glfont.h
@@ -17,17 +17,17 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: glfont.h,v 1.16 2004-11-27 21:48:01 pixel Exp $ */
+/* $Id: glfont.h,v 1.17 2006-10-28 16:50:46 pixel Exp $ */
#ifndef __GLFONT_H__
#define __GLFONT_H__
#include <SDL.h>
-#include <font.h>
+#include <Font.h>
#include <mcolor.h>
namespace mogltk {
- class glfont : public font {
+ class glfont : public Font {
public:
glfont(Handle *);
virtual ~glfont();
diff --git a/include/glshape.h b/include/glshape.h
index 0647633..77eea0f 100644
--- a/include/glshape.h
+++ b/include/glshape.h
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: glshape.h,v 1.15 2004-11-27 21:48:01 pixel Exp $ */
+/* $Id: glshape.h,v 1.16 2006-10-28 16:50:46 pixel Exp $ */
#ifndef __GLSHAPE_H__
#define __GLSHAPE_H__
@@ -25,11 +25,11 @@
#include <Exceptions.h>
#include <BString.h>
#include <mcolor.h>
-#include <texture.h>
-#include <shape.h>
+#include <Texture.h>
+#include <Shape.h>
namespace mogltk {
- class glshape : public shape {
+ 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);
@@ -41,12 +41,12 @@ namespace mogltk {
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);
+ 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();
diff --git a/include/glsprite.h b/include/glsprite.h
index 91c3f76..d523e4d 100644
--- a/include/glsprite.h
+++ b/include/glsprite.h
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: glsprite.h,v 1.7 2004-11-27 21:48:01 pixel Exp $ */
+/* $Id: glsprite.h,v 1.8 2006-10-28 16:50:46 pixel Exp $ */
#ifndef __GLSPRITE_H__
#define __GLSPRITE_H__
@@ -26,7 +26,7 @@
#include <Exceptions.h>
#include <Handle.h>
#include <mcolor.h>
-#include <texture.h>
+#include <Texture.h>
#include <sprite.h>
namespace mogltk {
diff --git a/include/glwidgets.h b/include/glwidgets.h
index cd87a5f..2c32f0a 100644
--- a/include/glwidgets.h
+++ b/include/glwidgets.h
@@ -17,18 +17,18 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: glwidgets.h,v 1.9 2004-11-27 21:48:01 pixel Exp $ */
+/* $Id: glwidgets.h,v 1.10 2006-10-28 16:50:46 pixel Exp $ */
#ifndef __GLWIDGETS_H__
#define __GLWIDGETS_H__
-#include <widgets.h>
+#include <Widgets.h>
namespace mogltk {
- namespace widgets {
+ namespace Widgets {
class glRoot : public Root {
public:
- glRoot(shape *);
+ glRoot(Shape *);
protected:
virtual void draw();
};
diff --git a/include/mcolor.h b/include/mcolor.h
index 9592bbe..30184c4 100644
--- a/include/mcolor.h
+++ b/include/mcolor.h
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: mcolor.h,v 1.10 2006-01-31 17:02:39 pixel Exp $ */
+/* $Id: mcolor.h,v 1.11 2006-10-28 16:50:46 pixel Exp $ */
#ifndef __MCOLOR_H__
#define __MCOLOR_H__
@@ -38,6 +38,7 @@ namespace mogltk {
Uint32 toSDL(SDL_PixelFormat * = 0);
void fromSDL(Uint32, SDL_PixelFormat * = 0);
void fromHSV(double H, double S, double V); // H in degrees
+ void toHSV(double * H, double * S, double * V);
static Color Min;
static Color Max;
Color c;
diff --git a/include/shape.h b/include/shape.h
index b5c3d91..74422a1 100644
--- a/include/shape.h
+++ b/include/shape.h
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: shape.h,v 1.17 2005-12-01 13:48:12 pixel Exp $ */
+/* $Id: shape.h,v 1.18 2006-10-28 16:50:46 pixel Exp $ */
#ifndef __SHAPE_H__
#define __SHAPE_H__
@@ -26,8 +26,8 @@
#include <Exceptions.h>
#include <BString.h>
#include <mcolor.h>
-#include <texture.h>
-#include <font.h>
+#include <Texture.h>
+#include <Font.h>
namespace mogltk {
typedef enum {
@@ -47,10 +47,10 @@ namespace mogltk {
virtual ~segwalker();
virtual void step(int x1, int y1, int x2, int y2);
};
- class fill : public Base {
+ class Fill : public Base {
public:
- fill();
- virtual ~fill();
+ Fill();
+ virtual ~Fill();
void walk(fillwalker *);
void swalk(segwalker *);
void insert(int, int, int, int);
@@ -59,10 +59,10 @@ namespace mogltk {
int GetMinY() const;
int GetMaxX() const;
int GetMaxY() const;
- texture * GetTexture();
- texture * Talloc();
- texture * GetSTexture();
- texture * STalloc();
+ Texture * GetTexture();
+ Texture * Talloc();
+ Texture * GetSTexture();
+ Texture * STalloc();
Color last;
private:
void insert(int, int);
@@ -71,7 +71,7 @@ namespace mogltk {
};
class sline : public Base {
public:
- sline(int, fill *);
+ sline(int, Fill *);
virtual ~sline();
int GetY() const;
void insert(int, int);
@@ -93,7 +93,7 @@ namespace mogltk {
};
int y;
sline * next;
- fill * header;
+ Fill * header;
sline * look(int);
protected:
point * pheader;
@@ -102,22 +102,22 @@ namespace mogltk {
int count() const;
};
int minX, minY, maxX, maxY;
- texture * cached;
- texture * scached;
+ Texture * cached;
+ Texture * scached;
std::vector<segment> segments;
protected:
sline * header;
friend class sline;
};
- class shape : public Base {
+ class Shape : public Base {
public:
- shape(SDL_Surface * = 0);
+ 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 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);
@@ -131,10 +131,10 @@ namespace mogltk {
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 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,
@@ -144,13 +144,13 @@ namespace mogltk {
ColorP shade2 = DOS_GRAY);
virtual void text(int x, int y, const String &,
ColorP textcolor = DOS_HIGH_WHITE,
- align_t align = LEFT, mogltk::font * = mogltk::SystemFont);
+ align_t align = LEFT, mogltk::Font * = mogltk::SystemFont);
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, mogltk::font * = mogltk::SystemFont);
+ bool bevel = false, mogltk::Font * = mogltk::SystemFont);
virtual void button(int x1, int y1, int x2, int y2, const String &,
bool bevel = false,
ColorP front = DOS_WHITE,
@@ -173,25 +173,25 @@ namespace mogltk {
class filldrawer : public fillwalker {
public:
- filldrawer(fill *, texture *, ColorP = DOS_WHITE);
+ filldrawer(Fill *, Texture *, ColorP = DOS_WHITE);
virtual ~filldrawer();
virtual void step(int x, int y);
private:
- fill * f;
- texture * t;
+ Fill * f;
+ Texture * t;
ColorP c;
int oldx, oldy;
};
class segdrawer : public segwalker {
public:
- segdrawer(fill *, texture *, ColorP = DOS_WHITE);
+ segdrawer(Fill *, Texture *, ColorP = DOS_WHITE);
virtual ~segdrawer();
virtual void step(int x1, int y1, int x2, int y2);
private:
- fill * f;
- texture * t;
+ Fill * f;
+ Texture * t;
ColorP c;
- shape * sh;
+ Shape * sh;
};
};
diff --git a/include/sprite.h b/include/sprite.h
index 176f793..6263ada 100644
--- a/include/sprite.h
+++ b/include/sprite.h
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: sprite.h,v 1.13 2004-11-27 21:48:01 pixel Exp $ */
+/* $Id: sprite.h,v 1.14 2006-10-28 16:50:46 pixel Exp $ */
#ifndef __SPRITE_H__
#define __SPRITE_H__
@@ -26,7 +26,7 @@
#include <Exceptions.h>
#include <Handle.h>
#include <mcolor.h>
-#include <texture.h>
+#include <Texture.h>
namespace mogltk {
class Sprite : public Base {
@@ -48,15 +48,15 @@ namespace mogltk {
TexList(int);
virtual ~TexList();
Sprite * sprheader;
- const texture * GetTex() const;
- texture * GetTex();
+ 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;
+ Texture * tex;
static TexList * header;
TexList * next, * prev;
};
diff --git a/include/texture.h b/include/texture.h
index 228f016..e49e48f 100644
--- a/include/texture.h
+++ b/include/texture.h
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: texture.h,v 1.11 2006-02-02 17:29:04 pixel Exp $ */
+/* $Id: texture.h,v 1.12 2006-10-28 16:50:46 pixel Exp $ */
#ifndef __TEXTURE_H__
#define __TEXTURE_H__
@@ -29,13 +29,13 @@
#include <generic.h>
namespace mogltk {
- class texture : public Base {
+ class Texture : public Base {
public:
- texture(int, int, bool = false) throw (GeneralException);
- texture(Handle *, bool = false) throw (GeneralException);
- texture(int, int, int, int);
- texture(SDL_Surface *, bool = false) throw (GeneralException);
- virtual ~texture();
+ Texture(int, int, bool = false) throw (GeneralException);
+ Texture(Handle *, bool = false) throw (GeneralException);
+ Texture(int, int, int, int);
+ Texture(SDL_Surface *, bool = false) throw (GeneralException);
+ virtual ~Texture();
SDL_Surface * GetSurface();
Uint32 * GetPixels();
SDL_PixelFormat * GetFormat();
@@ -56,10 +56,10 @@ namespace mogltk {
bool texture_allocated;
SDL_Surface * surface;
bool planar, tainted, taintable;
- static texture * header;
- static texture * footer;
- texture * next, * prev;
- static texture * active;
+ static Texture * header;
+ static Texture * footer;
+ Texture * next, * prev;
+ static Texture * active;
void recTaint(void);
};
};
diff --git a/include/widgets.h b/include/widgets.h
index eb51051..f808981 100644
--- a/include/widgets.h
+++ b/include/widgets.h
@@ -17,13 +17,13 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: widgets.h,v 1.16 2006-02-02 11:01:13 pixel Exp $ */
+/* $Id: widgets.h,v 1.17 2006-10-28 16:50:46 pixel Exp $ */
#ifndef __WIDGETS_H__
#define __WIDGETS_H__
#include <Exceptions.h>
-#include <shape.h>
+#include <Shape.h>
#include <base.h>
#include <engine.h>
@@ -47,9 +47,9 @@ namespace mogltk {
E_MOUSE_OUT_CLICK,
E_MOUSE_DBL_CLICK,
};
- class widget : public Base {
+ class Widget : public Base {
public:
- virtual ~widget() throw (GeneralException);
+ virtual ~Widget() throw (GeneralException);
virtual void move(int x, int y);
virtual void resize(int sx, int sy);
int GetX();
@@ -61,15 +61,15 @@ namespace mogltk {
int GetAX2();
int GetAY2();
virtual mogltk::rect GetDrawRect();
- widget * Father();
- widget * Child();
- widget * Next();
- widget * Prev();
- widget * InnerPanel();
- virtual widget * find_widget(int x, int y);
+ Widget * Father();
+ Widget * Child();
+ Widget * Next();
+ Widget * Prev();
+ Widget * InnerPanel();
+ virtual Widget * find_widget(int x, int y);
void fulldraw();
- shape * Shaper();
- void mainloop();
+ Shape * Shaper();
+ void mainloop() throw (GeneralException);
void m_event(int x, int y, event_t event);
bool inside(int x, int y);
bool GetVisible();
@@ -82,13 +82,13 @@ namespace mogltk {
void set_viewport();
void delete_me();
protected:
- widget(widget * father, int x, int y, int sx, int sy, int type, String name, shape *);
+ Widget(Widget * father, int x, int y, int sx, int sy, int type, String name, Shape *);
virtual void draw();
virtual bool process_event(int x, int y, event_t event);
virtual void resize_notify();
- virtual widget * create_panel();
- void set_exclusive(widget *);
- void unset_exclusive(widget *);
+ virtual Widget * create_panel();
+ void set_exclusive(Widget *);
+ void unset_exclusive(Widget *);
void add_out_move();
void remove_out_move();
void add_out_click();
@@ -98,23 +98,23 @@ namespace mogltk {
String caption;
private:
int x, y, sx, sy, ax, ay, ax2, ay2;
- widget * father, * next, * prev, * child, * last, * root, * panel;
- static widget * focused;
+ Widget * father, * next, * prev, * child, * last, * root, * panel;
+ static Widget * focused;
int type;
String name;
- shape * sh;
- widget * exclusive;
+ Shape * sh;
+ Widget * exclusive;
bool visible;
bool enabled;
class timed_event {
public:
- timed_event(widget * _w, Uint32 _t) : w(_w), t(_t) { }
- widget * w;
+ timed_event(Widget * _w, Uint32 _t) : w(_w), t(_t) { }
+ Widget * w;
Uint32 t;
};
static std::vector<timed_event> timed_events;
- static std::vector<widget *> add_list;
- static std::vector<widget *> del_list;
+ static std::vector<Widget *> add_list;
+ static std::vector<Widget *> del_list;
static bool in_delete_loop;
void computeabs();
@@ -126,54 +126,58 @@ namespace mogltk {
void linkme();
};
- namespace widgets {
+ namespace Widgets {
/*!
- The drawer is mostly used inside the Root widget, to implement the
+ The drawer is mostly used inside the Root Widget, to implement the
function to draw the background.
*/
class drawer : public Base {
public:
- virtual void draw(widget *) = 0;
+ virtual void draw(Widget *) = 0;
};
/*!
- The action class defines "what happens" when you activate a widget,
+ The action class defines "what happens" when you activate a Widget,
mostly used in buttons and co.
*/
class action : public Base {
public:
- virtual void do_action(widget *) = 0;
+ virtual void do_action(Widget *) = 0;
};
/*!
- The Root widget is the father of all the widgets. It'll define the
- background, as well as the whole tree of the visible widgets onscreen.
+ The Root Widget is the father of all the Widgets. It'll define the
+ background, as well as the whole tree of the visible Widgets onscreen.
*/
- class Root : public widget {
+ class Root : public Widget {
public:
- Root(shape *, drawer * = 0);
+ Root(Shape *, drawer * = 0, drawer * = 0);
void setdrawer(drawer *);
+ void setbgdrawer(drawer *);
+ virtual void drawbg();
protected:
virtual void draw();
+ private:
drawer * dr;
+ drawer * bg;
};
/*!
- The Panel widget is not visible. Its only usage is to hold several
- other widgets at a relative position.
+ The Panel Widget is not visible. Its only usage is to hold several
+ other Widgets at a relative position.
*/
- class Panel : public widget {
+ class Panel : public Widget {
public:
- Panel(shape *, widget * father, int x, int y, int w, int h);
+ Panel(Shape *, Widget * father, int x, int y, int w, int h);
};
/*!
- The Button widget will draw a very simple button onscreen, and
+ The Button Widget will draw a very simple button onscreen, and
react to all the necessary mouse events.
*/
- class Button : public widget {
+ class Button : public Widget {
public:
- Button(action *, shape *, widget * father, int x, int y, int w, int h, const String & caption);
+ Button(action *, Shape *, Widget * father, int x, int y, int w, int h, const String & caption);
virtual ~Button() throw (GeneralException);
void simulate_press();
action * cascade_action();
@@ -187,25 +191,25 @@ namespace mogltk {
};
/*!
- The Label widget is only a pure inactive chunk of text.
+ The Label Widget is only a pure inactive chunk of text.
*/
- class Label : public widget {
+ class Label : public Widget {
public:
- Label(shape *, widget * father, int x, int y, int w, int h, const String & caption, const ColorP & color = BLACK, mogltk::font * = mogltk::SystemFont);
+ Label(Shape *, Widget * father, int x, int y, int w, int h, const String & caption, const ColorP & color = BLACK, mogltk::Font * = mogltk::SystemFont);
virtual ~Label() throw (GeneralException) {}
protected:
virtual void draw();
private:
ColorP color;
- mogltk::font * label_font;
+ mogltk::Font * label_font;
};
/*!
The SmartBox is a simple window with a title line.
*/
- class SmartBox : public widget {
+ class SmartBox : public Widget {
public:
- SmartBox(shape *, widget * father, int x, int y, int w, int h, const String & caption);
+ SmartBox(Shape *, Widget * father, int x, int y, int w, int h, const String & caption);
virtual rect GetDrawRect();
protected:
virtual void draw();
@@ -219,7 +223,7 @@ namespace mogltk {
*/
class SmartBoxClose : public SmartBox {
public:
- SmartBoxClose(shape *, widget * father, int x, int y, int w, int h, const String & caption);
+ SmartBoxClose(Shape *, Widget * father, int x, int y, int w, int h, const String & caption);
};
/*!
@@ -228,31 +232,31 @@ namespace mogltk {
*/
class MsgBox : public SmartBox {
public:
- MsgBox(action *, shape *, widget * father, const String & caption, const String & text, mogltk::font * = mogltk::SystemFont);
+ MsgBox(action *, Shape *, Widget * father, const String & caption, const String & text, mogltk::Font * = mogltk::SystemFont);
virtual ~MsgBox() throw (GeneralException);
private:
- mogltk::font * msgbox_font;
+ mogltk::Font * msgbox_font;
};
/*!
- The Frame widget will act as a visible panel. It'll hold widgets
+ The Frame Widget will act as a visible panel. It'll hold Widgets
within a visible frame or fence.
*/
- class Frame : public widget {
+ class Frame : public Widget {
public:
- Frame(shape *, widget * father, int x, int y, int w, int h);
+ Frame(Shape *, Widget * father, int x, int y, int w, int h);
virtual rect GetDrawRect();
protected:
virtual void draw();
};
/*!
- The ContextMenu is a quite heavy widget which will display a kind of
+ The ContextMenu is a quite heavy Widget which will display a kind of
popup menu, holding several buttons or submenus in nodes.
*/
- class ContextMenu : public widget {
+ class ContextMenu : public Widget {
public:
- ContextMenu(shape *, widget * father, int x, int y);
+ ContextMenu(Shape *, Widget * father, int x, int y);
virtual ~ContextMenu() throw (GeneralException);
void addnode(const String &, action *);
void addline();
@@ -298,12 +302,12 @@ namespace mogltk {
};
/*!
- The Menu widget will be display ontop of the father widget, and its
+ The Menu Widget will be display ontop of the father Widget, and its
submenus are simply sont ContextMenus.
*/
- class Menu : public widget {
+ class Menu : public Widget {
public:
- Menu(shape *, widget * father);
+ Menu(Shape *, Widget * father);
virtual ~Menu() throw (GeneralException) {}
void addnode(const String &, action *);
void addsub(const String &, ContextMenu * sub);
@@ -339,11 +343,11 @@ namespace mogltk {
};
/*!
- The InputText widget is used to do a simple input box on the screen.
+ The InputText Widget is used to do a simple input box on the screen.
*/
- class InputText : public widget {
+ class InputText : public Widget {
public:
- InputText(action *, shape *, widget * father, int x, int y);
+ InputText(action *, Shape *, Widget * father, int x, int y);
virtual ~InputText() throw (GeneralException);
virtual void draw();
const String & GetText() const;
@@ -374,30 +378,30 @@ namespace mogltk {
*/
class InputDialog : public SmartBox {
public:
- InputDialog(action *, shape *, widget * father, const String & caption, const String & text, mogltk::font * = mogltk::SystemFont);
+ InputDialog(action *, Shape *, Widget * father, const String & caption, const String & text, mogltk::Font * = mogltk::SystemFont);
virtual ~InputDialog() throw (GeneralException);
String GetText();
private:
InputText * it;
- mogltk::font * InputDialog_font;
+ mogltk::Font * InputDialog_font;
};
/*!
- The ActionAndDelete provides a mechanism for a widget to run an action then self-destruct.
+ The ActionAndDelete provides a mechanism for a Widget to run an action then self-destruct.
Used for example by the MsgBox and InputDialog.
*/
- class ActionAndDelete : public mogltk::widgets::action {
+ class ActionAndDelete : public mogltk::Widgets::action {
public:
- ActionAndDelete(mogltk::widget * _parent, mogltk::widgets::action * _a) : parent(_parent), a(_a) { }
- virtual void do_action(mogltk::widget *) {
+ ActionAndDelete(mogltk::Widget * _parent, mogltk::Widgets::action * _a) : parent(_parent), a(_a) { }
+ virtual void do_action(mogltk::Widget *) {
if (a)
a->do_action(parent);
parent->delete_me();
delete this;
}
private:
- mogltk::widget * parent;
- mogltk::widgets::action * a;
+ mogltk::Widget * parent;
+ mogltk::Widgets::action * a;
};
};
};
diff --git a/lib/LuaGL.cc b/lib/LuaGL.cc
index facd6ec..9631abc 100644
--- a/lib/LuaGL.cc
+++ b/lib/LuaGL.cc
@@ -1017,7 +1017,7 @@ static int gl_begin(lua_State *L)
return 0;
}
-/*BindTexture (target, texture) -> none*/
+/*BindTexture (target, Texture) -> none*/
static int gl_bind_texture(lua_State *L)
{
GLenum e;
@@ -2998,7 +2998,7 @@ static int gl_is_list(lua_State *L)
return 1;
}
-/*IsTexture (texture) -> true/false*/
+/*IsTexture (Texture) -> true/false*/
static int gl_is_texture(lua_State *L)
{
/* test argument type */
diff --git a/lib/base.cc b/lib/base.cc
index db0e77f..a9d31a5 100644
--- a/lib/base.cc
+++ b/lib/base.cc
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: base.cc,v 1.16 2006-02-02 17:29:05 pixel Exp $ */
+/* $Id: base.cc,v 1.17 2006-10-28 16:50:46 pixel Exp $ */
#include <stdio.h>
#include <SDL.h>
@@ -125,7 +125,7 @@ void mogltk::base::ToggleFullscreen() {
else
newflags |= SDL_FULLSCREEN;
- texture::Taintall();
+ Texture::Taintall();
surface = SDL_SetVideoMode(surface->w, surface->h, surface->format->BitsPerPixel,
SDL_HWSURFACE | newflags);
@@ -147,11 +147,11 @@ inline static unsigned int nextpower(unsigned int n) {
}
}
-mogltk::texture * mogltk::base::GrabTexture() {
+mogltk::Texture * mogltk::base::GrabTexture() {
int w = nextpower(GetWidth());
int h = nextpower(GetHeight());
- texture * r = new texture(w, h);
- r->name = "texture grabbed";
+ Texture * r = new Texture(w, h);
+ r->name = "Texture grabbed";
SDL_BlitSurface(getsurface(), NULL, r->GetSurface(), NULL);
diff --git a/lib/contextmenu.cc b/lib/contextmenu.cc
index 1c513cf..97cec1e 100644
--- a/lib/contextmenu.cc
+++ b/lib/contextmenu.cc
@@ -17,71 +17,71 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: contextmenu.cc,v 1.2 2006-02-02 11:01:13 pixel Exp $ */
+/* $Id: contextmenu.cc,v 1.3 2006-10-28 16:50:46 pixel Exp $ */
#include <SDL.h>
#include <vector>
#include <Input.h>
-#include "font.h"
+#include "Font.h"
#include "engine.h"
-#include "widgets.h"
+#include "Widgets.h"
#include "sprite.h"
/***********************************
* The huge and bloated ContextMenu *
***********************************/
-mogltk::widgets::ContextMenu::node::node(const String & _caption, int _x, int _y, int _w, int _h, mogltk::widgets::action * _a, mogltk::widgets::ContextMenu * _sub, mogltk::widgets::ContextMenu * _father, bool _line) : caption(_caption), x(_x), y(_y), w(_w), h(_h), a(_a), sub(_sub), father(_father), line(_line), enabled(true) {
+mogltk::Widgets::ContextMenu::node::node(const String & _caption, int _x, int _y, int _w, int _h, mogltk::Widgets::action * _a, mogltk::Widgets::ContextMenu * _sub, mogltk::Widgets::ContextMenu * _father, bool _line) : caption(_caption), x(_x), y(_y), w(_w), h(_h), a(_a), sub(_sub), father(_father), line(_line), enabled(true) {
}
-String mogltk::widgets::ContextMenu::node::GetCaption() {
+String mogltk::Widgets::ContextMenu::node::GetCaption() {
return caption;
}
-mogltk::widgets::action * mogltk::widgets::ContextMenu::node::GetAction() {
+mogltk::Widgets::action * mogltk::Widgets::ContextMenu::node::GetAction() {
return a;
}
-mogltk::widgets::ContextMenu * mogltk::widgets::ContextMenu::node::GetFather() {
+mogltk::Widgets::ContextMenu * mogltk::Widgets::ContextMenu::node::GetFather() {
return father;
}
-mogltk::widgets::ContextMenu * mogltk::widgets::ContextMenu::node::GetSub() {
+mogltk::Widgets::ContextMenu * mogltk::Widgets::ContextMenu::node::GetSub() {
return sub;
}
-bool mogltk::widgets::ContextMenu::node::GetLine() {
+bool mogltk::Widgets::ContextMenu::node::GetLine() {
return line;
}
-bool mogltk::widgets::ContextMenu::node::GetEnabled() {
+bool mogltk::Widgets::ContextMenu::node::GetEnabled() {
return enabled;
}
-void mogltk::widgets::ContextMenu::node::SetEnabled(bool _enabled) {
+void mogltk::Widgets::ContextMenu::node::SetEnabled(bool _enabled) {
enabled = _enabled;
}
-int mogltk::widgets::ContextMenu::node::GetX() {
+int mogltk::Widgets::ContextMenu::node::GetX() {
return x;
}
-int mogltk::widgets::ContextMenu::node::GetY() {
+int mogltk::Widgets::ContextMenu::node::GetY() {
return y;
}
-int mogltk::widgets::ContextMenu::node::GetW() {
+int mogltk::Widgets::ContextMenu::node::GetW() {
return w;
}
-int mogltk::widgets::ContextMenu::node::GetH() {
+int mogltk::Widgets::ContextMenu::node::GetH() {
return h;
}
-mogltk::widgets::ContextMenu::ContextMenu(shape * sh, mogltk::widget * father, int x, int y) : widget(father, x, y, 8, 4, 1, "ContextMenu", sh), selected(-1), subselected(0), in_click(false), sticky(false) {
+mogltk::Widgets::ContextMenu::ContextMenu(Shape * sh, mogltk::Widget * father, int x, int y) : Widget(father, x, y, 8, 4, 1, "ContextMenu", sh), selected(-1), subselected(0), in_click(false), sticky(false) {
}
-mogltk::widgets::ContextMenu::~ContextMenu() throw (GeneralException) {
+mogltk::Widgets::ContextMenu::~ContextMenu() throw (GeneralException) {
std::vector<node>::iterator i;
ContextMenu * sub;
@@ -91,7 +91,7 @@ mogltk::widgets::ContextMenu::~ContextMenu() throw (GeneralException) {
}
}
-void mogltk::widgets::ContextMenu::addnode(const String & caption, mogltk::widgets::action * a) {
+void mogltk::Widgets::ContextMenu::addnode(const String & caption, mogltk::Widgets::action * a) {
rect size;
size = SystemFont->size(caption);
@@ -102,7 +102,7 @@ void mogltk::widgets::ContextMenu::addnode(const String & caption, mogltk::widge
resize(size.w, GetH() + size.h);
}
-void mogltk::widgets::ContextMenu::addsub(const String & caption, mogltk::widgets::ContextMenu * sub) {
+void mogltk::Widgets::ContextMenu::addsub(const String & caption, mogltk::Widgets::ContextMenu * sub) {
rect size;
size = SystemFont->size(caption + " >");
@@ -113,12 +113,12 @@ void mogltk::widgets::ContextMenu::addsub(const String & caption, mogltk::widget
resize(size.w, GetH() + size.h);
}
-void mogltk::widgets::ContextMenu::addline() {
+void mogltk::Widgets::ContextMenu::addline() {
nodes.push_back(node("", 2, GetH() - 1, 0, 0, 0, 0, this, true));
resize(GetW(), GetH() + 4);
}
-mogltk::widgets::ContextMenu * mogltk::widgets::ContextMenu::createsub(const String & caption) {
+mogltk::Widgets::ContextMenu * mogltk::Widgets::ContextMenu::createsub(const String & caption) {
ContextMenu * r;
r = new ContextMenu(Shaper(), Father(), GetX() + GetW(), GetY() + GetH());
@@ -129,14 +129,14 @@ mogltk::widgets::ContextMenu * mogltk::widgets::ContextMenu::createsub(const Str
return r;
}
-void mogltk::widgets::ContextMenu::move(int x, int y) {
+void mogltk::Widgets::ContextMenu::move(int x, int y) {
int dx, dy;
std::vector<node>::iterator i;
ContextMenu * sub;
dx = x - GetX();
dy = y - GetY();
- widget::move(x, y);
+ Widget::move(x, y);
for (i = nodes.begin(); i != nodes.end(); i++) {
if ((sub = i->GetSub()))
@@ -144,13 +144,13 @@ void mogltk::widgets::ContextMenu::move(int x, int y) {
}
}
-void mogltk::widgets::ContextMenu::resize(int w, int h) {
+void mogltk::Widgets::ContextMenu::resize(int w, int h) {
int dw;
std::vector<node>::iterator i;
ContextMenu * sub;
dw = w - GetW();
- widget::resize(w, h);
+ Widget::resize(w, h);
for (i = nodes.begin(); i != nodes.end(); i++) {
if ((sub = i->GetSub()))
@@ -158,10 +158,10 @@ void mogltk::widgets::ContextMenu::resize(int w, int h) {
}
}
-void mogltk::widgets::ContextMenu::SetVisible(bool visible) {
+void mogltk::Widgets::ContextMenu::SetVisible(bool visible) {
if (!visible && sticky)
return;
- widget::SetVisible(visible);
+ Widget::SetVisible(visible);
if (!visible && subselected) {
subselected->SetVisible(false);
}
@@ -172,16 +172,16 @@ void mogltk::widgets::ContextMenu::SetVisible(bool visible) {
}
}
-void mogltk::widgets::ContextMenu::SetEnabled(int i, bool e) {
+void mogltk::Widgets::ContextMenu::SetEnabled(int i, bool e) {
nodes[i].SetEnabled(e);
}
-void mogltk::widgets::ContextMenu::StickyDisplay() {
+void mogltk::Widgets::ContextMenu::StickyDisplay() {
sticky = true;
SetVisible(true);
}
-void mogltk::widgets::ContextMenu::draw() {
+void mogltk::Widgets::ContextMenu::draw() {
std::vector<node>::iterator i;
int n;
rect size;
@@ -201,7 +201,7 @@ void mogltk::widgets::ContextMenu::draw() {
}
}
-bool mogltk::widgets::ContextMenu::process_event(int xe, int ye, mogltk::event_t event) {
+bool mogltk::Widgets::ContextMenu::process_event(int xe, int ye, mogltk::event_t event) {
std::vector<node>::iterator i;
action * a;
int n;
@@ -268,7 +268,7 @@ bool mogltk::widgets::ContextMenu::process_event(int xe, int ye, mogltk::event_t
return false;
}
-bool mogltk::widgets::ContextMenu::iin_click() {
+bool mogltk::Widgets::ContextMenu::iin_click() {
if (in_click)
return true;
@@ -283,74 +283,74 @@ bool mogltk::widgets::ContextMenu::iin_click() {
* The Menu topframe *
********************/
-mogltk::widgets::Menu::node::node(const String & _caption, mogltk::widgets::ContextMenu * _sub, mogltk::widgets::action * _a, int _x) : caption(_caption), sub(_sub), a(_a), x(_x) {
+mogltk::Widgets::Menu::node::node(const String & _caption, mogltk::Widgets::ContextMenu * _sub, mogltk::Widgets::action * _a, int _x) : caption(_caption), sub(_sub), a(_a), x(_x) {
}
-String mogltk::widgets::Menu::node::GetCaption() {
+String mogltk::Widgets::Menu::node::GetCaption() {
return caption;
}
-void mogltk::widgets::Menu::node::SetCaption(const String & s) {
+void mogltk::Widgets::Menu::node::SetCaption(const String & s) {
caption = s;
}
-mogltk::widgets::ContextMenu * mogltk::widgets::Menu::node::GetSub() {
+mogltk::Widgets::ContextMenu * mogltk::Widgets::Menu::node::GetSub() {
return sub;
}
-mogltk::widgets::action * mogltk::widgets::Menu::node::GetAction() {
+mogltk::Widgets::action * mogltk::Widgets::Menu::node::GetAction() {
return a;
}
-int mogltk::widgets::Menu::node::GetX() {
+int mogltk::Widgets::Menu::node::GetX() {
return x;
}
-bool mogltk::widgets::Menu::node::GetEnabled() {
+bool mogltk::Widgets::Menu::node::GetEnabled() {
return enabled;
}
-void mogltk::widgets::Menu::node::SetEnabled(bool _enabled) {
+void mogltk::Widgets::Menu::node::SetEnabled(bool _enabled) {
enabled = _enabled;
}
-mogltk::widgets::Menu::Menu(shape * sh, mogltk::widget * father) : widget(father, 0, 0, 0, 0, 0, "Menu", sh), cur_x(0), selected(-1), subselected(0) {
+mogltk::Widgets::Menu::Menu(Shape * sh, mogltk::Widget * father) : Widget(father, 0, 0, 0, 0, 0, "Menu", sh), cur_x(0), selected(-1), subselected(0) {
rect r = father->GetDrawRect();
move(r.x, r.y);
resize(r.w, 16);
}
-void mogltk::widgets::Menu::resize_notify() {
+void mogltk::Widgets::Menu::resize_notify() {
rect r = Father()->GetDrawRect();
resize(r.w, 16);
}
-void mogltk::widgets::Menu::addnode(const String & caption, mogltk::widgets::action * a) {
+void mogltk::Widgets::Menu::addnode(const String & caption, mogltk::Widgets::action * a) {
nodes.push_back(node(caption, 0, a, cur_x));
cur_x += SystemFont->singletextsize(caption) + 6;
}
-void mogltk::widgets::Menu::addsub(const String & caption, mogltk::widgets::ContextMenu * sub) {
+void mogltk::Widgets::Menu::addsub(const String & caption, mogltk::Widgets::ContextMenu * sub) {
nodes.push_back(node(caption, sub, 0, cur_x));
cur_x += SystemFont->singletextsize(caption) + 6;
}
-mogltk::widgets::ContextMenu * mogltk::widgets::Menu::createsub(const String & caption) {
+mogltk::Widgets::ContextMenu * mogltk::Widgets::Menu::createsub(const String & caption) {
ContextMenu * r = new ContextMenu(Shaper(), Father(), GetX() + cur_x, GetY() + 16);
addsub(caption, r);
r->SetVisible(false);
return r;
}
-void mogltk::widgets::Menu::SetEnabled(int i, bool e) {
+void mogltk::Widgets::Menu::SetEnabled(int i, bool e) {
nodes[i].SetEnabled(e);
}
-void mogltk::widgets::Menu::SetCaption(int i, const String & s) {
+void mogltk::Widgets::Menu::SetCaption(int i, const String & s) {
nodes[i].SetCaption(s);
}
-void mogltk::widgets::Menu::draw(void) {
+void mogltk::Widgets::Menu::draw(void) {
std::vector<node>::iterator i;
int n;
@@ -368,7 +368,7 @@ void mogltk::widgets::Menu::draw(void) {
}
}
-bool mogltk::widgets::Menu::process_event(int mx, int my, mogltk::event_t event) {
+bool mogltk::Widgets::Menu::process_event(int mx, int my, mogltk::event_t event) {
std::vector<node>::iterator i;
action * a;
ContextMenu * sub;
diff --git a/lib/engine.cc b/lib/engine.cc
index c372f0b..d49574c 100644
--- a/lib/engine.cc
+++ b/lib/engine.cc
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: engine.cc,v 1.30 2006-02-09 17:04:58 pixel Exp $ */
+/* $Id: engine.cc,v 1.31 2006-10-28 16:50:46 pixel Exp $ */
#include <SDL.h>
#include <Input.h>
@@ -36,7 +36,7 @@ int mogltk::engine::mx, mogltk::engine::my, mogltk::engine::mz = 0, mogltk::engi
int mogltk::engine::frames, mogltk::engine::locked = 0;
double mogltk::engine::curfps = -1;
Uint32 mogltk::engine::curticks;
-mogltk::widget * mogltk::engine::root = 0;
+mogltk::Widget * mogltk::engine::root = 0;
mogltk::glbase * mogltk::engine::glbase_o = 0;
mogltk::base * mogltk::engine::base_o = 0;
@@ -142,8 +142,8 @@ int mogltk::engine::postsetup() throw(GeneralException) {
mogltk::FixedFont = new mogltk::glfont(&Input("fixed-font.bin"));
Sprite::Cursor = new mogltk::glSprite(&Input("cursor.rgba"), 25, 25);
} else {
- mogltk::SystemFont = new mogltk::font(&Input("font.bin"));
- mogltk::FixedFont = new mogltk::font(&Input("fixed-font.bin"));
+ mogltk::SystemFont = new mogltk::Font(&Input("font.bin"));
+ mogltk::FixedFont = new mogltk::Font(&Input("fixed-font.bin"));
Sprite::Cursor = new mogltk::Sprite(&Input("cursor.rgba"), 25, 25);
}
diff --git a/lib/font.cc b/lib/font.cc
index fab51e4..fbd871d 100644
--- a/lib/font.cc
+++ b/lib/font.cc
@@ -17,13 +17,13 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: font.cc,v 1.18 2006-02-02 17:29:05 pixel Exp $ */
+/* $Id: font.cc,v 1.19 2006-10-28 16:50:46 pixel Exp $ */
#include <stdarg.h>
#include <SDL.h>
#include <Input.h>
#include "base.h"
-#include "font.h"
+#include "Font.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -35,7 +35,7 @@ Uint8 prescale2[4] = { 0, 85, 170, 255 }, prescale3[8] = { 0, 36, 72, 109, 145,
/*
-font file format
+Font file format
================
off|siz|description
@@ -93,9 +93,9 @@ match only one byte in the string. Otherwise, it should match two bytes.
Variables comments
==================
-nbcU = number of chars on X by texture
-nbcV = number of chars on Y by texture
-nbcT = number of char by texture
+nbcU = number of chars on X by Texture
+nbcV = number of chars on Y by Texture
+nbcT = number of char by Texture
nbT = number of textures
*/
@@ -119,7 +119,7 @@ mogltk::ColorP colorcached[16] = {
DOS_HIGH_WHITE
};
-mogltk::font::font(Handle * ffont) : textcolor(255, 255, 255, 255), shadow(0), wspace(0) {
+mogltk::Font::Font(Handle * ffont) : textcolor(255, 255, 255, 255), shadow(0), wspace(0) {
int i, j;
nbentries = ffont->readU16();
@@ -140,17 +140,17 @@ mogltk::font::font(Handle * ffont) : textcolor(255, 255, 255, 255), shadow(0), w
nbT++;
}
- printm(M_INFO, "Creating font texture: %i entries, flags = 0x%02x, maxX = %i, maxY = %i\n", nbentries, flags, maxX, maxY);
- printm(M_INFO, "Which makes %i texture(s), with %i char by texture, %i on X, and %i on Y\n", nbT, nbcT, nbcU, nbcV);
+ printm(M_INFO, "Creating Font Texture: %i entries, flags = 0x%02x, maxX = %i, maxY = %i\n", nbentries, flags, maxX, maxY);
+ printm(M_INFO, "Which makes %i Texture(s), with %i char by Texture, %i on X, and %i on Y\n", nbT, nbcT, nbcU, nbcV);
- fonttex = (texture **) malloc(nbT * sizeof(texture *));
+ fonttex = (Texture **) malloc(nbT * sizeof(Texture *));
for (i = 0; i < 16; i++) {
- fontcache[i] = (texture **) malloc(nbT * sizeof(texture *));
+ fontcache[i] = (Texture **) malloc(nbT * sizeof(Texture *));
}
for (i = 0; i < nbT; i++) {
fonttex[i] = alloctexture();
- fonttex[i]->name = "Main font texture number " + String(i);
+ fonttex[i]->name = "Main Font Texture number " + String(i);
for (j = 0; j < 15; j++) {
fontcache[j][i] = 0;
}
@@ -202,7 +202,7 @@ mogltk::font::font(Handle * ffont) : textcolor(255, 255, 255, 255), shadow(0), w
}
}
-mogltk::font::~font() {
+mogltk::Font::~Font() {
int i, j;
for (i = 0; i < nbT; i++)
for (j = 0; j < 16; j++)
@@ -216,7 +216,7 @@ mogltk::font::~font() {
free(sizes);
}
-void mogltk::font::drawentry(Uint16 entry, int x, int y, ColorP c) {
+void mogltk::Font::drawentry(Uint16 entry, int x, int y, ColorP c) {
bool locked = false;
int trueentry, cx, cy, px, py;
SDL_Rect src, dst;
@@ -254,7 +254,7 @@ void mogltk::font::drawentry(Uint16 entry, int x, int y, ColorP c) {
SDL_UnlockSurface(mogltk::engine::base_o->getsurface());
}
-void mogltk::font::drawtotex(texture * t, Uint16 entry, int x, int y, ColorP c) {
+void mogltk::Font::drawtotex(Texture * t, Uint16 entry, int x, int y, ColorP c) {
bool locked = false;
int trueentry, cx, cy, px, py;
SDL_Rect src, dst;
@@ -292,22 +292,22 @@ void mogltk::font::drawtotex(texture * t, Uint16 entry, int x, int y, ColorP c)
SDL_UnlockSurface(t->GetSurface());
}
-void mogltk::font::putcursor(int x, int y) {
+void mogltk::Font::putcursor(int x, int y) {
cx = ox = x;
cy = y;
}
-void mogltk::font::putentry(Uint16 entry, ColorP c) {
+void mogltk::Font::putentry(Uint16 entry, ColorP c) {
drawentry(entry, cx, cy, c);
cx += sizes[entry] + wspace;
}
-void mogltk::font::putentryontex(texture * t, Uint16 entry, ColorP c) {
+void mogltk::Font::putentryontex(Texture * t, Uint16 entry, ColorP c) {
drawtotex(t, entry, cx, cy, c);
cx += sizes[entry] + wspace;
}
-void mogltk::font::drawchar(unsigned char ch, ColorP c) {
+void mogltk::Font::drawchar(unsigned char ch, ColorP c) {
Uint16 * p;
int i;
@@ -319,7 +319,7 @@ void mogltk::font::drawchar(unsigned char ch, ColorP c) {
}
}
-void mogltk::font::drawcharontex(texture * t, unsigned char ch, ColorP c) {
+void mogltk::Font::drawcharontex(Texture * t, unsigned char ch, ColorP c) {
Uint16 * p;
int i;
@@ -331,7 +331,7 @@ void mogltk::font::drawcharontex(texture * t, unsigned char ch, ColorP c) {
}
}
-int mogltk::font::findchar(unsigned char ch) const {
+int mogltk::Font::findchar(unsigned char ch) const {
Uint16 * p;
int i;
@@ -344,12 +344,12 @@ int mogltk::font::findchar(unsigned char ch) const {
return -1;
}
-void mogltk::font::newline(void) {
+void mogltk::Font::newline(void) {
cx = ox;
cy += inter;
}
-int mogltk::font::printf(const ugly_string & m, va_list ap) {
+int mogltk::Font::printf(const ugly_string & m, va_list ap) {
char * p;
static char buffer[STRBUFSIZ + 1];
int r;
@@ -371,7 +371,7 @@ int mogltk::font::printf(const ugly_string & m, va_list ap) {
return r;
}
-int mogltk::font::printf(const ugly_string & m, ...) {
+int mogltk::Font::printf(const ugly_string & m, ...) {
va_list ap;
int r;
@@ -382,7 +382,7 @@ int mogltk::font::printf(const ugly_string & m, ...) {
return r;
}
-int mogltk::font::printf(const char * p, ...) {
+int mogltk::Font::printf(const char * p, ...) {
ugly_string m;
va_list ap;
int r;
@@ -396,7 +396,7 @@ int mogltk::font::printf(const char * p, ...) {
return r;
}
-mogltk::rect mogltk::font::size(const ugly_string & m, va_list ap) {
+mogltk::rect mogltk::Font::size(const ugly_string & m, va_list ap) {
char * p;
static char buffer[STRBUFSIZ + 1];
rect r;
@@ -438,7 +438,7 @@ mogltk::rect mogltk::font::size(const ugly_string & m, va_list ap) {
return r;
}
-mogltk::rect mogltk::font::size(const ugly_string & m, ...) {
+mogltk::rect mogltk::Font::size(const ugly_string & m, ...) {
va_list ap;
rect r;
@@ -449,7 +449,7 @@ mogltk::rect mogltk::font::size(const ugly_string & m, ...) {
return r;
}
-mogltk::rect mogltk::font::size(const char * p, ...) {
+mogltk::rect mogltk::Font::size(const char * p, ...) {
ugly_string m;
va_list ap;
rect r;
@@ -463,7 +463,7 @@ mogltk::rect mogltk::font::size(const char * p, ...) {
return r;
}
-mogltk::rect mogltk::font::printtotex(texture * t, const ugly_string & m, va_list ap) {
+mogltk::rect mogltk::Font::printtotex(Texture * t, const ugly_string & m, va_list ap) {
char * p;
static char buffer[STRBUFSIZ + 1];
rect r;
@@ -513,7 +513,7 @@ mogltk::rect mogltk::font::printtotex(texture * t, const ugly_string & m, va_lis
return r;
}
-mogltk::rect mogltk::font::printtotex(texture * t, const ugly_string & m, ...) {
+mogltk::rect mogltk::Font::printtotex(Texture * t, const ugly_string & m, ...) {
va_list ap;
rect r;
@@ -524,7 +524,7 @@ mogltk::rect mogltk::font::printtotex(texture * t, const ugly_string & m, ...) {
return r;
}
-mogltk::rect mogltk::font::printtotex(texture * t, const char * p, ...) {
+mogltk::rect mogltk::Font::printtotex(Texture * t, const char * p, ...) {
ugly_string m;
va_list ap;
rect r;
@@ -554,12 +554,12 @@ inline static unsigned int nextpower(unsigned int n) {
}
}
-mogltk::texture * mogltk::font::printtex(rect * _r, const ugly_string & m, va_list ap) {
+mogltk::Texture * mogltk::Font::printtex(rect * _r, const ugly_string & m, va_list ap) {
rect r;
char * p;
static char buffer[STRBUFSIZ + 1];
int mw, w, pw, ph;
- texture * t;
+ Texture * t;
int ocx, ocy, oox;
ocx = cx;
@@ -605,8 +605,8 @@ mogltk::texture * mogltk::font::printtex(rect * _r, const ugly_string & m, va_li
pw = nextpower(r.w);
ph = nextpower(r.h);
- t = new texture(pw, ph);
- t->name = String("Text-on-texture: '") + m.p + "'";
+ t = new Texture(pw, ph);
+ t->name = String("Text-on-Texture: '") + m.p + "'";
for (p = buffer; *p; p++) {
if (*p == '\n') {
@@ -622,9 +622,9 @@ mogltk::texture * mogltk::font::printtex(rect * _r, const ugly_string & m, va_li
return t;
}
-mogltk::texture * mogltk::font::printtex(rect * r, const ugly_string & m, ...) {
+mogltk::Texture * mogltk::Font::printtex(rect * r, const ugly_string & m, ...) {
va_list ap;
- texture * t;
+ Texture * t;
va_start(ap, m);
t = printtex(r, m, ap);
@@ -633,10 +633,10 @@ mogltk::texture * mogltk::font::printtex(rect * r, const ugly_string & m, ...) {
return t;
}
-mogltk::texture * mogltk::font::printtex(rect * r, const char * p, ...) {
+mogltk::Texture * mogltk::Font::printtex(rect * r, const char * p, ...) {
ugly_string m;
va_list ap;
- texture * t;
+ Texture * t;
m.p = p;
@@ -647,19 +647,19 @@ mogltk::texture * mogltk::font::printtex(rect * r, const char * p, ...) {
return t;
}
-void mogltk::font::setcolor(ColorP c) {
+void mogltk::Font::setcolor(ColorP c) {
textcolor = c;
}
-void mogltk::font::setshadow(int s) {
+void mogltk::Font::setshadow(int s) {
shadow = s;
}
-void mogltk::font::setwspace(int w) {
+void mogltk::Font::setwspace(int w) {
wspace = w;
}
-int mogltk::font::singletextsize(const String & s) const {
+int mogltk::Font::singletextsize(const String & s) const {
unsigned int i;
int r = 0;
@@ -670,18 +670,18 @@ int mogltk::font::singletextsize(const String & s) const {
return r;
}
-mogltk::font * mogltk::SystemFont;
-mogltk::font * mogltk::FixedFont;
+mogltk::Font * mogltk::SystemFont;
+mogltk::Font * mogltk::FixedFont;
-mogltk::texture * mogltk::font::alloctexture() {
- return new texture(256, 256);
+mogltk::Texture * mogltk::Font::alloctexture() {
+ return new Texture(256, 256);
}
-void mogltk::font::Bind(int f) {
+void mogltk::Font::Bind(int f) {
fonttex[f]->Bind();
}
-void mogltk::font::checknbind(int index, ColorP c) {
+void mogltk::Font::checknbind(int index, ColorP c) {
int i, x, y;
ColorP oldmax = ColorP::Max, t;
ColorP::Max = c.c;
@@ -693,7 +693,7 @@ void mogltk::font::checknbind(int index, ColorP c) {
if (!fontcache[i][index]) {
fontcache[i][index] = alloctexture();
- fontcache[i][index]->name = "Color font texture number " + String(index);
+ fontcache[i][index]->name = "Color Font Texture number " + String(index);
for (y = 0; y < 256; y++) {
for (x = 0; x < 256; x++) {
t.fromSDL(fontcache[15][index]->GetPixels()[(y << 8) + x], f);
diff --git a/lib/glbase.cc b/lib/glbase.cc
index 89b849a..922a263 100644
--- a/lib/glbase.cc
+++ b/lib/glbase.cc
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: glbase.cc,v 1.23 2006-02-02 17:29:05 pixel Exp $ */
+/* $Id: glbase.cc,v 1.24 2006-10-28 16:50:46 pixel Exp $ */
#include <stdio.h>
#include <SDL.h>
@@ -220,10 +220,10 @@ inline static unsigned int nextpower(unsigned int n) {
}
}
-mogltk::texture * mogltk::glbase::GrabTexture() {
+mogltk::Texture * mogltk::glbase::GrabTexture() {
int w = nextpower(GetWidth());
int h = nextpower(GetHeight());
- texture * r = new texture(w, h);
+ Texture * r = new Texture(w, h);
r->name = "Texture grabbed.";
SDL_Surface * t;
diff --git a/lib/glfont.cc b/lib/glfont.cc
index 5b28591..4bc9a0e 100644
--- a/lib/glfont.cc
+++ b/lib/glfont.cc
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: glfont.cc,v 1.25 2004-11-27 21:48:03 pixel Exp $ */
+/* $Id: glfont.cc,v 1.26 2006-10-28 16:50:46 pixel Exp $ */
#include "engine.h"
#include "glbase.h"
@@ -26,7 +26,7 @@
#include "config.h"
#endif
-mogltk::glfont::glfont(Handle * ffont) : font(ffont) {
+mogltk::glfont::glfont(Handle * ffont) : Font(ffont) {
}
mogltk::glfont::~glfont() {
diff --git a/lib/glshape.cc b/lib/glshape.cc
index 8fa718e..6c0b2d9 100644
--- a/lib/glshape.cc
+++ b/lib/glshape.cc
@@ -17,12 +17,12 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: glshape.cc,v 1.16 2004-11-27 21:48:03 pixel Exp $ */
+/* $Id: glshape.cc,v 1.17 2006-10-28 16:50:46 pixel Exp $ */
#include <SDL_opengl.h>
#include "glbase.h"
-#include "glshape.h"
-#include "texture.h"
+#include "glShape.h"
+#include "Texture.h"
#include "glfont.h"
#include "engine.h"
@@ -30,7 +30,7 @@
#define ENTERT bool was2d = Enter(false)
#define LEAVE Leave(was2d)
-void mogltk::glshape::box(int x1, int y1, int x2, int y2, ColorP c) {
+void mogltk::glShape::box(int x1, int y1, int x2, int y2, ColorP c) {
ENTER;
c.Bind();
@@ -44,7 +44,7 @@ void mogltk::glshape::box(int x1, int y1, int x2, int y2, ColorP c) {
LEAVE;
}
-void mogltk::glshape::box(int x1, int y1, int x2, int y2, ColorP c1, ColorP c2, ColorP c3, ColorP c4) {
+void mogltk::glShape::box(int x1, int y1, int x2, int y2, ColorP c1, ColorP c2, ColorP c3, ColorP c4) {
ENTER;
glBegin(GL_TRIANGLE_STRIP);
@@ -57,33 +57,33 @@ void mogltk::glshape::box(int x1, int y1, int x2, int y2, ColorP c1, ColorP c2,
LEAVE;
}
-void mogltk::glshape::hline(int x1, int x2, int y, ColorP c1, ColorP c2) {
+void mogltk::glShape::hline(int x1, int x2, int y, ColorP c1, ColorP c2) {
box(x1, y, x2, y, c1, c2, c1, c2);
}
-void mogltk::glshape::hline(int x1, int x2, int y, ColorP c) {
+void mogltk::glShape::hline(int x1, int x2, int y, ColorP c) {
box(x1, y, x2, y, c, c, c, c);
}
-void mogltk::glshape::vline(int x, int y1, int y2, ColorP c1, ColorP c2) {
+void mogltk::glShape::vline(int x, int y1, int y2, ColorP c1, ColorP c2) {
box(x, y1, x, y2, c1, c1, c2, c2);
}
-void mogltk::glshape::vline(int x, int y1, int y2, ColorP c) {
+void mogltk::glShape::vline(int x, int y1, int y2, ColorP c) {
box(x, y1, x, y2, c, c, c, c);
}
-void mogltk::glshape::pixel(int x, int y, ColorP c) {
+void mogltk::glShape::pixel(int x, int y, ColorP c) {
box(x, y, x, y, c);
}
-void mogltk::glshape::obox(int x1, int y1, int x2, int y2, ColorP c) {
+void mogltk::glShape::obox(int x1, int y1, int x2, int y2, ColorP c) {
ENTER;
- shape::obox(x1, y1, x2, y2, c);
+ Shape::obox(x1, y1, x2, y2, c);
LEAVE;
}
-void mogltk::glshape::obox(int x1, int y1, int x2, int y2, ColorP c1, ColorP c2, ColorP c3, ColorP c4) {
+void mogltk::glShape::obox(int x1, int y1, int x2, int y2, ColorP c1, ColorP c2, ColorP c3, ColorP c4) {
ENTER;
hline(x1, x2, y1, c1, c2);
@@ -94,10 +94,10 @@ void mogltk::glshape::obox(int x1, int y1, int x2, int y2, ColorP c1, ColorP c2,
LEAVE;
}
-void mogltk::glshape::tbox(mogltk::texture * t, int x1, int y1, int x2, int y2, int tx, int ty, double f, ColorP c) {
+void mogltk::glShape::tbox(mogltk::Texture * t, int x1, int y1, int x2, int y2, int tx, int ty, double f, ColorP c) {
tbox(t, x1, y1, x2, y2, tx, ty, tx + (int) ((x2 - x1) * f), ty + (int) ((y2 - y1) * f), c);
}
-void mogltk::glshape::tbox(mogltk::texture * t, int x1, int y1, int x2, int y2, int tx1, int ty1, int tx2, int ty2, ColorP c) {
+void mogltk::glShape::tbox(mogltk::Texture * t, int x1, int y1, int x2, int y2, int tx1, int ty1, int tx2, int ty2, ColorP c) {
ENTERT;
c.Bind();
@@ -112,11 +112,11 @@ void mogltk::glshape::tbox(mogltk::texture * t, int x1, int y1, int x2, int y2,
LEAVE;
}
-void mogltk::glshape::tbox(mogltk::texture * t, int x1, int y1, int x2, int y2, ColorP c1, ColorP c2, ColorP c3, ColorP c4, int tx, int ty, double f) {
+void mogltk::glShape::tbox(mogltk::Texture * t, int x1, int y1, int x2, int y2, ColorP c1, ColorP c2, ColorP c3, ColorP c4, int tx, int ty, double f) {
tbox(t, x1, y1, x2, y2, c1, c2, c3, c4, tx, ty, tx + (int) ((x2 - x1) * f), ty + (int) ((y2 - y1) * f));
}
-void mogltk::glshape::tbox(mogltk::texture * t, int x1, int y1, int x2, int y2, ColorP c1, ColorP c2, ColorP c3, ColorP c4, int tx1, int ty1, int tx2, int ty2) {
+void mogltk::glShape::tbox(mogltk::Texture * t, int x1, int y1, int x2, int y2, ColorP c1, ColorP c2, ColorP c3, ColorP c4, int tx1, int ty1, int tx2, int ty2) {
ENTERT;
t->Bind();
@@ -130,7 +130,7 @@ void mogltk::glshape::tbox(mogltk::texture * t, int x1, int y1, int x2, int y2,
LEAVE;
}
-void mogltk::glshape::box3d(int x1, int y1, int x2, int y2, ColorP face, ColorP shade1, ColorP shade2, int depth, bool bevel) {
+void mogltk::glShape::box3d(int x1, int y1, int x2, int y2, ColorP face, ColorP shade1, ColorP shade2, int depth, bool bevel) {
ENTER;
if (!bevel) {
@@ -170,33 +170,33 @@ void mogltk::glshape::box3d(int x1, int y1, int x2, int y2, ColorP face, ColorP
LEAVE;
}
-bool mogltk::glshape::Enter(bool unbind) {
+bool mogltk::glShape::Enter(bool unbind) {
bool was2D = mogltk::engine::glbase_o->is2D();
if (!was2D)
mogltk::engine::glbase_o->Enter2DMode();
- if (unbind) mogltk::texture::Unbind();
+ if (unbind) mogltk::Texture::Unbind();
return was2D;
}
-bool mogltk::glshape::Enter() {
+bool mogltk::glShape::Enter() {
return Enter(true);
}
-void mogltk::glshape::Leave(bool was2D) {
+void mogltk::glShape::Leave(bool was2D) {
if (!was2D)
mogltk::engine::glbase_o->Leave2DMode();
}
-void mogltk::glshape::fdraw(fill * f, ColorP c, int sx, int sy) {
+void mogltk::glShape::fdraw(Fill * f, ColorP c, int sx, int sy) {
ENTERT;
if (!f)
return;
- texture * t = f->GetTexture();
+ Texture * t = f->GetTexture();
if (!t) {
filldrawer * w = new filldrawer(f, t = f->Talloc(), WHITE);
@@ -221,13 +221,13 @@ void mogltk::glshape::fdraw(fill * f, ColorP c, int sx, int sy) {
LEAVE;
}
-void mogltk::glshape::sdraw(fill * f, ColorP c, int sx, int sy) {
+void mogltk::glShape::sdraw(Fill * f, ColorP c, int sx, int sy) {
ENTERT;
if (!f)
return;
- texture * t = f->GetSTexture();
+ Texture * t = f->GetSTexture();
if (!t) {
segdrawer * w = new segdrawer(f, t = f->STalloc(), WHITE);
diff --git a/lib/glwidgets.cc b/lib/glwidgets.cc
index 5ff8c23..c306b73 100644
--- a/lib/glwidgets.cc
+++ b/lib/glwidgets.cc
@@ -17,13 +17,13 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: glwidgets.cc,v 1.9 2004-11-27 21:48:03 pixel Exp $ */
+/* $Id: glwidgets.cc,v 1.10 2006-10-28 16:50:46 pixel Exp $ */
#include <SDL.h>
#include <SDL_opengl.h>
#include "mcolor.h"
#include "glwidgets.h"
-void mogltk::widgets::glRoot::draw() {
+void mogltk::Widgets::glRoot::draw() {
Shaper()->box(GetAX(), GetAY(), GetAX2(), GetAY2());
}
diff --git a/lib/inputtext.cc b/lib/inputtext.cc
index 094f04b..9a63c07 100644
--- a/lib/inputtext.cc
+++ b/lib/inputtext.cc
@@ -17,41 +17,41 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: inputtext.cc,v 1.3 2006-02-02 11:01:13 pixel Exp $ */
+/* $Id: inputtext.cc,v 1.4 2006-10-28 16:50:46 pixel Exp $ */
#include <SDL.h>
#include <vector>
#include <Input.h>
-#include "font.h"
+#include "Font.h"
#include "engine.h"
-#include "widgets.h"
+#include "Widgets.h"
#include "sprite.h"
/**********************
* The InputText entry *
**********************/
-mogltk::widgets::InputText::InputText(mogltk::widgets::action * _a, shape * sh, mogltk::widget * father, int _x, int _y) : widget(father, _x, _y, 80, 20, 0, "InputText", sh), it_keyevent(0), a(_a), cursor_visible(false), cursor_pos(0) {
- it_keyevent = new mogltk::widgets::InputText::inputtext_keyevent(this);
+mogltk::Widgets::InputText::InputText(mogltk::Widgets::action * _a, Shape * sh, mogltk::Widget * father, int _x, int _y) : Widget(father, _x, _y, 80, 20, 0, "InputText", sh), it_keyevent(0), a(_a), cursor_visible(false), cursor_pos(0) {
+ it_keyevent = new mogltk::Widgets::InputText::inputtext_keyevent(this);
set_timed_event(500);
}
-mogltk::widgets::InputText::~InputText() throw (GeneralException) {
+mogltk::Widgets::InputText::~InputText() throw (GeneralException) {
delete it_keyevent;
}
-void mogltk::widgets::InputText::activate() {
+void mogltk::Widgets::InputText::activate() {
if (a)
a->do_action(this);
}
-mogltk::widgets::InputText::inputtext_keyevent::inputtext_keyevent(mogltk::widgets::InputText * _father) : father(_father) {
+mogltk::Widgets::InputText::inputtext_keyevent::inputtext_keyevent(mogltk::Widgets::InputText * _father) : father(_father) {
}
-void mogltk::widgets::InputText::inputtext_keyevent::up(SDL_keysym k) {
+void mogltk::Widgets::InputText::inputtext_keyevent::up(SDL_keysym k) {
}
-void mogltk::widgets::InputText::inputtext_keyevent::down(SDL_keysym k) {
+void mogltk::Widgets::InputText::inputtext_keyevent::down(SDL_keysym k) {
if (father->GetVisible()) {
switch (k.sym) {
case SDLK_BACKSPACE:
@@ -78,15 +78,15 @@ void mogltk::widgets::InputText::inputtext_keyevent::down(SDL_keysym k) {
}
}
-const String & mogltk::widgets::InputText::GetText() const{
+const String & mogltk::Widgets::InputText::GetText() const{
return text;
}
-void mogltk::widgets::InputText::SetText(const String & _text) {
+void mogltk::Widgets::InputText::SetText(const String & _text) {
text = _text;
}
-bool mogltk::widgets::InputText::process_event(int x, int y, mogltk::event_t event) {
+bool mogltk::Widgets::InputText::process_event(int x, int y, mogltk::event_t event) {
switch (event) {
case E_TIMER:
set_timed_event(500);
@@ -96,7 +96,7 @@ bool mogltk::widgets::InputText::process_event(int x, int y, mogltk::event_t eve
return false;
}
-void mogltk::widgets::InputText::draw() {
+void mogltk::Widgets::InputText::draw() {
int x = MIN(SystemFont->singletextsize(text) + GetAX() + 2, GetAX2() - 2);
Shaper()->box3d(GetAX(), GetAY(), GetAX2(), GetAY2(), DOS_WHITE, DOS_HIGH_WHITE, DOS_GRAY, 2, true);
@@ -111,7 +111,7 @@ void mogltk::widgets::InputText::draw() {
* The InputDialog child *
************************/
-mogltk::widgets::InputDialog::InputDialog(mogltk::widgets::action * a, shape * sh, mogltk::widget * father, const String & caption, const String & text, mogltk::font * _font) : SmartBox(sh, father, 0, 0, 0, 0, caption), InputDialog_font(_font) {
+mogltk::Widgets::InputDialog::InputDialog(mogltk::Widgets::action * a, Shape * sh, mogltk::Widget * father, const String & caption, const String & text, mogltk::Font * _font) : SmartBox(sh, father, 0, 0, 0, 0, caption), InputDialog_font(_font) {
rect size = InputDialog_font->size(text);
rect lsize = size;
@@ -130,10 +130,10 @@ mogltk::widgets::InputDialog::InputDialog(mogltk::widgets::action * a, shape * s
set_exclusive(father);
}
-mogltk::widgets::InputDialog::~InputDialog() throw (GeneralException) {
+mogltk::Widgets::InputDialog::~InputDialog() throw (GeneralException) {
unset_exclusive(Father());
}
-String mogltk::widgets::InputDialog::GetText() {
+String mogltk::Widgets::InputDialog::GetText() {
return it->GetText();
}
diff --git a/lib/mcolor.cc b/lib/mcolor.cc
index 618ae4f..a8c6d16 100644
--- a/lib/mcolor.cc
+++ b/lib/mcolor.cc
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: mcolor.cc,v 1.9 2006-01-31 17:02:39 pixel Exp $ */
+/* $Id: mcolor.cc,v 1.10 2006-10-28 16:50:46 pixel Exp $ */
#include <SDL.h>
#include <SDL_opengl.h>
@@ -71,6 +71,41 @@ void mogltk::ColorP::fromHSV(double H, double S, double V) {
c.R = R * 255; c.G = G * 255; c.B = B * 255;
}
+void mogltk::ColorP::toHSV(double * H, double * S, double * V) {
+ double R, G, B, cMAX, cMIN;
+
+ R = ((double) c.R) / 255;
+ G = ((double) c.G) / 255;
+ B = ((double) c.B) / 255;
+
+ cMAX = MAX(MAX(R, G), B);
+ cMIN = MIN(MIN(R, G), B);
+
+ if (cMAX == cMIN) {
+ *H = 0;
+ *S = 0;
+ *V = cMAX;
+ return;
+ }
+
+ if ((cMAX == R) && (G >= B)) {
+ *H = 60 * ((G - B) / (cMAX - cMIN));
+ } else if ((cMAX == R) && (G < B)) {
+ *H = 60 * ((G - B) / (cMAX - cMIN)) + 360;
+ } else if (cMAX == G) {
+ *H = 60 * ((B - R) / (cMAX - cMIN)) + 120;
+ } else {
+ *H = 60 * ((R - G) / (cMAX - cMIN)) + 240;
+ }
+
+ if (cMAX == 0) {
+ *S = 0;
+ } else {
+ *S = (cMAX - cMIN) / cMAX;
+ }
+ *V = cMAX;
+}
+
void mogltk::ColorP::Norm() {
c.R = MIN(MAX(c.R, Min.R), Max.R);
c.G = MIN(MAX(c.R, Min.G), Max.G);
diff --git a/lib/shape.cc b/lib/shape.cc
index 63b0920..d817895 100644
--- a/lib/shape.cc
+++ b/lib/shape.cc
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: shape.cc,v 1.21 2006-02-02 17:29:05 pixel Exp $ */
+/* $Id: shape.cc,v 1.22 2006-10-28 16:50:46 pixel Exp $ */
#include <math.h>
#include <limits.h>
@@ -26,9 +26,9 @@
#include <generic.h>
#include "engine.h"
#include "base.h"
-#include "shape.h"
-#include "texture.h"
-#include "font.h"
+#include "Shape.h"
+#include "Texture.h"
+#include "Font.h"
#define ENTER bool flag = Enter()
#define LEAVE Leave(flag)
@@ -51,10 +51,10 @@ mogltk::segwalker::~segwalker() {
void mogltk::segwalker::step(int x1, int y1, int x2, int y2) {
}
-mogltk::fill::fill() : minX(INT_MAX), minY(INT_MAX), maxX(INT_MIN), maxY(INT_MIN), cached(0), scached(0), header(0) {
+mogltk::Fill::Fill() : minX(INT_MAX), minY(INT_MAX), maxX(INT_MIN), maxY(INT_MIN), cached(0), scached(0), header(0) {
}
-mogltk::fill::~fill() {
+mogltk::Fill::~Fill() {
if (header)
delete header;
@@ -65,12 +65,12 @@ mogltk::fill::~fill() {
delete scached;
}
-void mogltk::fill::walk(fillwalker * w) {
+void mogltk::Fill::walk(fillwalker * w) {
if (header)
header->walk(w);
}
-void mogltk::fill::swalk(segwalker * s) {
+void mogltk::Fill::swalk(segwalker * s) {
std::vector<struct segment>::iterator i;
for (i = segments.begin(); i != segments.end(); i++) {
@@ -78,7 +78,7 @@ void mogltk::fill::swalk(segwalker * s) {
}
}
-void mogltk::fill::insert(int x, int y) {
+void mogltk::Fill::insert(int x, int y) {
if (cached) {
delete cached;
cached = 0;
@@ -107,7 +107,7 @@ void mogltk::fill::insert(int x, int y) {
minY = y;
}
-void mogltk::fill::insert(int x1, int y1, int x2, int y2) {
+void mogltk::Fill::insert(int x1, int y1, int x2, int y2) {
int dx, dy, y;
double x, i, i2;
@@ -136,38 +136,38 @@ void mogltk::fill::insert(int x1, int y1, int x2, int y2) {
insert(x + i2, y);
}
-void mogltk::fill::insertfix(int x, int y) {
+void mogltk::Fill::insertfix(int x, int y) {
if (!header)
return;
header->insertfix(x, y);
}
-int mogltk::fill::GetMaxX() const {
+int mogltk::Fill::GetMaxX() const {
return maxX;
}
-int mogltk::fill::GetMaxY() const {
+int mogltk::Fill::GetMaxY() const {
return maxY;
}
-int mogltk::fill::GetMinX() const {
+int mogltk::Fill::GetMinX() const {
return minX;
}
-int mogltk::fill::GetMinY() const {
+int mogltk::Fill::GetMinY() const {
return minY;
}
-mogltk::texture * mogltk::fill::GetTexture() {
+mogltk::Texture * mogltk::Fill::GetTexture() {
return cached;
}
-mogltk::texture * mogltk::fill::GetSTexture() {
+mogltk::Texture * mogltk::Fill::GetSTexture() {
return scached;
}
-mogltk::texture * mogltk::fill::Talloc() {
+mogltk::Texture * mogltk::Fill::Talloc() {
if (cached)
return cached;
@@ -176,12 +176,12 @@ mogltk::texture * mogltk::fill::Talloc() {
for (x = 1; x <= (maxX - minX); x <<= 1);
for (y = 1; y <= (maxY - minY); y <<= 1);
- cached = new texture(x, y, true);
- cached->name = "Fill-texture - cached";
+ cached = new Texture(x, y, true);
+ cached->name = "Fill-Texture - cached";
return cached;
}
-mogltk::texture * mogltk::fill::STalloc() {
+mogltk::Texture * mogltk::Fill::STalloc() {
if (scached)
return scached;
@@ -190,12 +190,12 @@ mogltk::texture * mogltk::fill::STalloc() {
for (x = 1; x <= (maxX - minX); x <<= 1);
for (y = 1; y <= (maxY - minY); y <<= 1);
- scached = new texture(x, y, true);
- cached->name = "Fill-texture - scached";
+ scached = new Texture(x, y, true);
+ cached->name = "Fill-Texture - scached";
return scached;
}
-mogltk::fill::sline::sline(int _y, fill * _header) : y(_y), header(_header), pheader(0) {
+mogltk::Fill::sline::sline(int _y, Fill * _header) : y(_y), header(_header), pheader(0) {
if (!header->header) {
header->header = this;
} else {
@@ -217,18 +217,18 @@ mogltk::fill::sline::sline(int _y, fill * _header) : y(_y), header(_header), phe
}
}
-mogltk::fill::sline::~sline() {
+mogltk::Fill::sline::~sline() {
if (pheader)
delete pheader;
if (next)
delete next;
}
-int mogltk::fill::sline::GetY() const {
+int mogltk::Fill::sline::GetY() const {
return y;
}
-void mogltk::fill::sline::insert(int ax, int ay) {
+void mogltk::Fill::sline::insert(int ax, int ay) {
sline * f;
if (ay == y) {
@@ -247,7 +247,7 @@ void mogltk::fill::sline::insert(int ax, int ay) {
}
}
-void mogltk::fill::sline::insertfix(int ax, int ay) {
+void mogltk::Fill::sline::insertfix(int ax, int ay) {
sline * f;
if (ay == y) {
@@ -263,7 +263,7 @@ void mogltk::fill::sline::insertfix(int ax, int ay) {
}
}
-int mogltk::fill::sline::count() const {
+int mogltk::Fill::sline::count() const {
int r = 0;
if (next)
@@ -272,14 +272,14 @@ int mogltk::fill::sline::count() const {
return r + 1;
}
-void mogltk::fill::sline::walk(fillwalker * w) {
+void mogltk::Fill::sline::walk(fillwalker * w) {
if (pheader)
pheader->walk(w);
if (next)
next->walk(w);
}
-mogltk::fill::sline::point::point(int _x, sline * _header) : x(_x), header(_header) {
+mogltk::Fill::sline::point::point(int _x, sline * _header) : x(_x), header(_header) {
if (!header->pheader) {
header->pheader = this;
} else {
@@ -301,26 +301,26 @@ mogltk::fill::sline::point::point(int _x, sline * _header) : x(_x), header(_head
}
}
-mogltk::fill::sline::point::~point() {
+mogltk::Fill::sline::point::~point() {
if (next)
delete next;
}
-int mogltk::fill::sline::point::GetX() const {
+int mogltk::Fill::sline::point::GetX() const {
return x;
}
-int mogltk::fill::sline::point::GetY() const {
+int mogltk::Fill::sline::point::GetY() const {
return header->GetY();
}
-void mogltk::fill::sline::point::walk(fillwalker * w) {
+void mogltk::Fill::sline::point::walk(fillwalker * w) {
w->step(GetX(), GetY());
if (next)
next->walk(w);
}
-mogltk::fill::sline::point * mogltk::fill::sline::point::look(int _x) {
+mogltk::Fill::sline::point * mogltk::Fill::sline::point::look(int _x) {
if (x > _x)
return 0;
@@ -333,7 +333,7 @@ mogltk::fill::sline::point * mogltk::fill::sline::point::look(int _x) {
return next->look(_x);
}
-mogltk::fill::sline * mogltk::fill::sline::look(int _y) {
+mogltk::Fill::sline * mogltk::Fill::sline::look(int _y) {
if (y > _y)
return 0;
@@ -346,16 +346,16 @@ mogltk::fill::sline * mogltk::fill::sline::look(int _y) {
return next->look(_y);
}
-mogltk::shape::shape(SDL_Surface * _surf) : surf(_surf) {
+mogltk::Shape::Shape(SDL_Surface * _surf) : surf(_surf) {
if (!surf)
surf = mogltk::engine::base_o->getsurface();
}
-SDL_Surface * mogltk::shape::GetSurf() {
+SDL_Surface * mogltk::Shape::GetSurf() {
return surf;
}
-void mogltk::shape::box(int x1, int y1, int x2, int y2, ColorP c) {
+void mogltk::Shape::box(int x1, int y1, int x2, int y2, ColorP c) {
ENTER;
SDL_Rect rect;
@@ -366,13 +366,13 @@ void mogltk::shape::box(int x1, int y1, int x2, int y2, ColorP c) {
LEAVE;
}
-void mogltk::shape::hline(int x1, int x2, int y, ColorP c) {
+void mogltk::Shape::hline(int x1, int x2, int y, ColorP c) {
for (; x1 <= x2; x1++) {
pixel(x1, y, c);
}
}
-void mogltk::shape::hline3d(int x1, int x2, int y, ColorP shade1, ColorP shade2, bool bevel) {
+void mogltk::Shape::hline3d(int x1, int x2, int y, ColorP shade1, ColorP shade2, bool bevel) {
ENTER;
if (!bevel) {
@@ -386,13 +386,13 @@ void mogltk::shape::hline3d(int x1, int x2, int y, ColorP shade1, ColorP shade2,
LEAVE;
}
-void mogltk::shape::vline(int x, int y1, int y2, ColorP c) {
+void mogltk::Shape::vline(int x, int y1, int y2, ColorP c) {
for (; y1 <= y2; y1++) {
pixel(x, y1, c);
}
}
-void mogltk::shape::vline3d(int x, int y1, int y2, ColorP shade1, ColorP shade2, bool bevel) {
+void mogltk::Shape::vline3d(int x, int y1, int y2, ColorP shade1, ColorP shade2, bool bevel) {
ENTER;
if (!bevel) {
@@ -406,7 +406,7 @@ void mogltk::shape::vline3d(int x, int y1, int y2, ColorP shade1, ColorP shade2,
LEAVE;
}
-void mogltk::shape::bsubline_1(int x1, int y1, int x2, int y2, ColorP c) {
+void mogltk::Shape::bsubline_1(int x1, int y1, int x2, int y2, ColorP c) {
int x, y, ddx, ddy, e;
ddx = abs(x2 - x1);
ddy = abs(y2 - y1) << 1;
@@ -433,7 +433,7 @@ void mogltk::shape::bsubline_1(int x1, int y1, int x2, int y2, ColorP c) {
LEAVE;
}
-void mogltk::shape::bsubline_2(int x1, int y1, int x2, int y2, ColorP c) {
+void mogltk::Shape::bsubline_2(int x1, int y1, int x2, int y2, ColorP c) {
int x, y, ddx, ddy, e;
ddx = abs(x2 - x1) << 1;
ddy = abs(y2 - y1);
@@ -460,7 +460,7 @@ void mogltk::shape::bsubline_2(int x1, int y1, int x2, int y2, ColorP c) {
LEAVE;
}
-void mogltk::shape::bsubline_3(int x1, int y1, int x2, int y2, ColorP c) {
+void mogltk::Shape::bsubline_3(int x1, int y1, int x2, int y2, ColorP c) {
int x, y, ddx, ddy, e;
ddx = abs(x1 - x2) << 1;
ddy = abs(y2 - y1);
@@ -487,7 +487,7 @@ void mogltk::shape::bsubline_3(int x1, int y1, int x2, int y2, ColorP c) {
LEAVE;
}
-void mogltk::shape::bsubline_4(int x1, int y1, int x2, int y2, ColorP c) {
+void mogltk::Shape::bsubline_4(int x1, int y1, int x2, int y2, ColorP c) {
int x, y, ddx, ddy, e;
ddy = abs(y2 - y1) << 1;
ddx = abs(x1 - x2);
@@ -510,7 +510,7 @@ void mogltk::shape::bsubline_4(int x1, int y1, int x2, int y2, ColorP c) {
}
}
-void mogltk::shape::line(int x1, int y1, int x2, int y2, ColorP c) {
+void mogltk::Shape::line(int x1, int y1, int x2, int y2, ColorP c) {
if ((x1 == x2) && (y1 == y2)) {
printm(M_INFO, "Line is a pixel...\n");
pixel(x1, y1, c);
@@ -540,7 +540,7 @@ void mogltk::shape::line(int x1, int y1, int x2, int y2, ColorP c) {
}
}
-void mogltk::shape::pixel(int x, int y, ColorP c) {
+void mogltk::Shape::pixel(int x, int y, ColorP c) {
ENTER;
int bpp = surf->format->BytesPerPixel;
@@ -581,7 +581,7 @@ void mogltk::shape::pixel(int x, int y, ColorP c) {
LEAVE;
}
-void mogltk::shape::circle(int x0, int y0, int r, ColorP c) {
+void mogltk::Shape::circle(int x0, int y0, int r, ColorP c) {
ENTER;
int x = 0;
@@ -614,13 +614,13 @@ void mogltk::shape::circle(int x0, int y0, int r, ColorP c) {
LEAVE;
}
-mogltk::fill * mogltk::shape::fcircle(int x0, int y0, int r) {
+mogltk::Fill * mogltk::Shape::fcircle(int x0, int y0, int r) {
int x = 0;
int y = r - 1;
int d = 3 - 2 * r;
int dI = 10 - 4 * r;
int rI = 6;
- mogltk::fill * f = new fill();
+ mogltk::Fill * f = new Fill();
bool t = false;
int ox = 0, oy = 0;
@@ -664,13 +664,13 @@ mogltk::fill * mogltk::shape::fcircle(int x0, int y0, int r) {
return f;
}
-void mogltk::shape::pcircle(int x, int y, int r, ColorP c) {
- fill * f = fcircle(x, y, r);
+void mogltk::Shape::pcircle(int x, int y, int r, ColorP c) {
+ Fill * f = fcircle(x, y, r);
fdraw(f, c);
delete f;
}
-mogltk::filldrawer::filldrawer(fill * _f, texture * _t, ColorP _c) : f(_f), t(_t), c(_c), oldx(-1), oldy(-1) {
+mogltk::filldrawer::filldrawer(Fill * _f, Texture * _t, ColorP _c) : f(_f), t(_t), c(_c), oldx(-1), oldy(-1) {
}
mogltk::filldrawer::~filldrawer() {
@@ -706,7 +706,7 @@ void mogltk::filldrawer::step(int x, int y) {
oldy = y;
}
-void mogltk::shape::fdraw(fill * f, ColorP c, int sx, int sy) {
+void mogltk::Shape::fdraw(Fill * f, ColorP c, int sx, int sy) {
ENTER;
if (!f)
return;
@@ -734,7 +734,7 @@ void mogltk::shape::fdraw(fill * f, ColorP c, int sx, int sy) {
LEAVE;
}
-mogltk::segdrawer::segdrawer(fill * _f, texture * _t, ColorP _c) : f(_f), t(_t), c(_c), sh(new shape(_t->GetSurface())) {
+mogltk::segdrawer::segdrawer(Fill * _f, Texture * _t, ColorP _c) : f(_f), t(_t), c(_c), sh(new Shape(_t->GetSurface())) {
}
mogltk::segdrawer::~segdrawer() {
@@ -745,7 +745,7 @@ void mogltk::segdrawer::step(int x1, int y1, int x2, int y2) {
sh->line(x1 - f->GetMinX(), y1 - f->GetMinY(), x2 - f->GetMinX(), y2 - f->GetMinY(), c);
}
-void mogltk::shape::sdraw(fill * f, ColorP c, int sx, int sy) {
+void mogltk::Shape::sdraw(Fill * f, ColorP c, int sx, int sy) {
ENTER;
if (!f)
@@ -775,7 +775,7 @@ void mogltk::shape::sdraw(fill * f, ColorP c, int sx, int sy) {
LEAVE;
}
-void mogltk::shape::obox(int x1, int y1, int x2, int y2, ColorP c) {
+void mogltk::Shape::obox(int x1, int y1, int x2, int y2, ColorP c) {
ENTER;
hline(x1, x2, y1, c);
@@ -786,7 +786,7 @@ void mogltk::shape::obox(int x1, int y1, int x2, int y2, ColorP c) {
LEAVE;
}
-void mogltk::shape::box3d(int x1, int y1, int x2, int y2, ColorP face, ColorP shade1, ColorP shade2, int depth, bool bevel) {
+void mogltk::Shape::box3d(int x1, int y1, int x2, int y2, ColorP face, ColorP shade1, ColorP shade2, int depth, bool bevel) {
ENTER;
int i;
@@ -806,7 +806,7 @@ void mogltk::shape::box3d(int x1, int y1, int x2, int y2, ColorP face, ColorP sh
LEAVE;
}
-void mogltk::shape::obox3d(int x1, int y1, int x2, int y2, ColorP shade1, ColorP shade2, bool bevel) {
+void mogltk::Shape::obox3d(int x1, int y1, int x2, int y2, ColorP shade1, ColorP shade2, bool bevel) {
ENTER;
if (!bevel) {
@@ -820,7 +820,7 @@ void mogltk::shape::obox3d(int x1, int y1, int x2, int y2, ColorP shade1, ColorP
LEAVE;
}
-void mogltk::shape::window(int x1, int y1, int x2, int y2, const String & title,
+void mogltk::Shape::window(int x1, int y1, int x2, int y2, const String & title,
ColorP titlecolor, ColorP titlebackcolor,
ColorP front, ColorP shade1, ColorP shade2) {
ENTER;
@@ -833,7 +833,7 @@ void mogltk::shape::window(int x1, int y1, int x2, int y2, const String & title,
LEAVE;
}
-void mogltk::shape::text(int x, int y, const String & text, ColorP textcolor, align_t align, mogltk::font * _font) {
+void mogltk::Shape::text(int x, int y, const String & text, ColorP textcolor, align_t align, mogltk::Font * _font) {
int tsize = _font->singletextsize(text);
switch (align) {
case LEFT:
@@ -851,9 +851,9 @@ void mogltk::shape::text(int x, int y, const String & text, ColorP textcolor, al
_font->printf("%s", text.to_charp());
}
-void mogltk::shape::text3d(int x, int y, const String & atext, ColorP textcolor,
+void mogltk::Shape::text3d(int x, int y, const String & atext, ColorP textcolor,
ColorP shade1, ColorP shade2,
- align_t align, bool bevel, mogltk::font * _font) {
+ align_t align, bool bevel, mogltk::Font * _font) {
ENTER;
_font->setwspace(1);
@@ -870,7 +870,7 @@ void mogltk::shape::text3d(int x, int y, const String & atext, ColorP textcolor,
LEAVE;
}
-void mogltk::shape::button(int x1, int y1, int x2, int y2,
+void mogltk::Shape::button(int x1, int y1, int x2, int y2,
const String & atext, bool bevel,
ColorP front, ColorP shade1, ColorP shade2,
ColorP round, ColorP textcolor,
@@ -891,7 +891,7 @@ void mogltk::shape::button(int x1, int y1, int x2, int y2,
LEAVE;
}
-bool mogltk::shape::Enter() {
+bool mogltk::Shape::Enter() {
if (SDL_MUSTLOCK(surf)) {
SDL_LockSurface(surf);
return true;
@@ -900,31 +900,31 @@ bool mogltk::shape::Enter() {
}
}
-void mogltk::shape::Leave(bool locked) {
+void mogltk::Shape::Leave(bool locked) {
if (locked)
SDL_UnlockSurface(surf);
}
-void mogltk::shape::tbox(texture *, int x1, int y1, int x2, int y2, int tx, int ty, double f, ColorP c) {
+void mogltk::Shape::tbox(Texture *, int x1, int y1, int x2, int y2, int tx, int ty, double f, ColorP c) {
}
-void mogltk::shape::tbox(texture *, int x1, int y1, int x2, int y2, int tx1, int ty1, int tx2, int ty2, ColorP c) {
+void mogltk::Shape::tbox(Texture *, int x1, int y1, int x2, int y2, int tx1, int ty1, int tx2, int ty2, ColorP c) {
}
-void mogltk::shape::tbox(texture *, int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP, int tx, int ty, double f) {
+void mogltk::Shape::tbox(Texture *, int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP, int tx, int ty, double f) {
}
-void mogltk::shape::tbox(texture *, int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP, int tx1, int ty1, int tx2, int ty2) {
+void mogltk::Shape::tbox(Texture *, int x1, int y1, int x2, int y2, ColorP, ColorP, ColorP, ColorP, int tx1, int ty1, int tx2, int ty2) {
}
-void mogltk::shape::vline(int x, int y1, int y2, ColorP c1, ColorP c2) {
+void mogltk::Shape::vline(int x, int y1, int y2, ColorP c1, ColorP c2) {
}
-void mogltk::shape::hline(int x1, int x2, int y, ColorP c1, ColorP c2) {
+void mogltk::Shape::hline(int x1, int x2, int y, ColorP c1, ColorP c2) {
}
-void mogltk::shape::box(int x1, int y1, int x2, int y2, ColorP c1, ColorP c2, ColorP c3, ColorP c4) {
+void mogltk::Shape::box(int x1, int y1, int x2, int y2, ColorP c1, ColorP c2, ColorP c3, ColorP c4) {
}
-void mogltk::shape::obox(int x1, int y1, int x2, int y2, ColorP c1, ColorP c2, ColorP c3, ColorP c4) {
+void mogltk::Shape::obox(int x1, int y1, int x2, int y2, ColorP c1, ColorP c2, ColorP c3, ColorP c4) {
}
diff --git a/lib/sprite.cc b/lib/sprite.cc
index bce6bf2..8b93a0f 100644
--- a/lib/sprite.cc
+++ b/lib/sprite.cc
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: sprite.cc,v 1.16 2006-02-02 17:29:05 pixel Exp $ */
+/* $Id: sprite.cc,v 1.17 2006-10-28 16:50:47 pixel Exp $ */
#include <SDL.h>
#include "engine.h"
@@ -75,7 +75,7 @@ void mogltk::Sprite::alloc() {
}
if (!found) {
- printm(M_INFO, "Allocating a new texture for sprites\n");
+ printm(M_INFO, "Allocating a new Texture for sprites\n");
posx = posy = 0;
p = new TexList(TEXSIZE);
}
@@ -84,8 +84,8 @@ void mogltk::Sprite::alloc() {
}
mogltk::Sprite::TexList::TexList(int size) {
- tex = new texture(size, size, true);
- tex->name = "Sprite texture.";
+ tex = new Texture(size, size, true);
+ tex->name = "Sprite Texture.";
if (header)
header->prev = this;
@@ -106,11 +106,11 @@ mogltk::Sprite::TexList::~TexList() {
next->prev = prev;
}
-const mogltk::texture * mogltk::Sprite::TexList::GetTex() const {
+const mogltk::Texture * mogltk::Sprite::TexList::GetTex() const {
return tex;
}
-mogltk::texture * mogltk::Sprite::TexList::GetTex() {
+mogltk::Texture * mogltk::Sprite::TexList::GetTex() {
return tex;
}
diff --git a/lib/texture.cc b/lib/texture.cc
index aa927c8..4ba5572 100644
--- a/lib/texture.cc
+++ b/lib/texture.cc
@@ -17,28 +17,28 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: texture.cc,v 1.14 2006-02-02 17:29:05 pixel Exp $ */
+/* $Id: texture.cc,v 1.15 2006-10-28 16:50:47 pixel Exp $ */
#include <sys/types.h>
#include <SDL.h>
#include <SDL_opengl.h>
#include <generic.h>
-#include "texture.h"
+#include "Texture.h"
#include "engine.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "gettext.h"
-mogltk::texture * mogltk::texture::header = 0;
-mogltk::texture * mogltk::texture::footer = 0;
+mogltk::Texture * mogltk::Texture::header = 0;
+mogltk::Texture * mogltk::Texture::footer = 0;
-mogltk::texture * mogltk::texture::active = 0;
+mogltk::Texture * mogltk::Texture::active = 0;
-mogltk::texture::texture(int w, int h, bool plane) throw (GeneralException) : width(w), height(h),
+mogltk::Texture::Texture(int w, int h, bool plane) throw (GeneralException) : width(w), height(h),
texture_allocated(false), planar(plane), tainted(true), taintable(true) {
if ((!ISPOT(w)) || (!ISPOT(h)))
- throw GeneralException(_("Size of the texture not a power of 2!"));
+ throw GeneralException(_("Size of the Texture not a power of 2!"));
if (!(surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 32,
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
@@ -69,7 +69,7 @@ mogltk::texture::texture(int w, int h, bool plane) throw (GeneralException) : wi
}
}
-mogltk::texture::texture(Handle * h, bool plane) throw (GeneralException) :
+mogltk::Texture::Texture(Handle * h, bool plane) throw (GeneralException) :
texture_allocated(false), planar(plane), tainted(true), taintable(true) {
SDL_Surface * temp;
@@ -78,11 +78,11 @@ mogltk::texture::texture(Handle * h, bool plane) throw (GeneralException) :
width = temp->w;
height = temp->h;
- printm(M_INFO, "Creating texture from file: size %ix%i\n", height, width);
+ printm(M_INFO, "Creating Texture from file: size %ix%i\n", height, width);
if ((!ISPOT(width)) || (!ISPOT(height))) {
SDL_FreeSurface(temp);
- throw GeneralException(_("Size of the texture not a power of 2!"));
+ throw GeneralException(_("Size of the Texture not a power of 2!"));
}
SDL_PixelFormat f;
@@ -115,7 +115,7 @@ mogltk::texture::texture(Handle * h, bool plane) throw (GeneralException) :
f.Aloss = 0;
if (!(surface = SDL_ConvertSurface(temp, &f, 0))) {
- throw GeneralException("Could not convert texture to OpenGL format");
+ throw GeneralException("Could not convert Texture to OpenGL format");
}
SDL_FreeSurface(temp);
@@ -131,16 +131,16 @@ mogltk::texture::texture(Handle * h, bool plane) throw (GeneralException) :
}
}
-mogltk::texture::texture(SDL_Surface * temp, bool plane) throw (GeneralException) :
+mogltk::Texture::Texture(SDL_Surface * temp, bool plane) throw (GeneralException) :
texture_allocated(false), planar(plane), tainted(true), taintable(true) {
width = temp->w;
height = temp->h;
- printm(M_INFO, "Creating texture from file: size %ix%i\n", height, width);
+ printm(M_INFO, "Creating Texture from file: size %ix%i\n", height, width);
if ((!ISPOT(width)) || (!ISPOT(height))) {
- throw GeneralException(_("Size of the texture not a power of 2!"));
+ throw GeneralException(_("Size of the Texture not a power of 2!"));
}
SDL_PixelFormat f;
@@ -173,7 +173,7 @@ mogltk::texture::texture(SDL_Surface * temp, bool plane) throw (GeneralException
f.Aloss = 0;
if (!(surface = SDL_ConvertSurface(temp, &f, 0))) {
- throw GeneralException("Could not convert texture to OpenGL format");
+ throw GeneralException("Could not convert Texture to OpenGL format");
}
next = 0;
@@ -203,7 +203,7 @@ inline static unsigned int nextpower(unsigned int n) {
}
}
-mogltk::texture::texture(int x, int y, int w, int h) : width(nextpower(w)), height(nextpower(h)),
+mogltk::Texture::Texture(int x, int y, int w, int h) : width(nextpower(w)), height(nextpower(h)),
texture_allocated(true), planar(false), tainted(false), taintable(false) {
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
@@ -215,7 +215,7 @@ mogltk::texture::texture(int x, int y, int w, int h) : width(nextpower(w)), heig
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, x, y, w, h);
}
-mogltk::texture::~texture() {
+mogltk::Texture::~Texture() {
if (surface) {
SDL_FreeSurface(surface);
}
@@ -241,39 +241,39 @@ mogltk::texture::~texture() {
}
}
-Uint32 * mogltk::texture::GetPixels() {
+Uint32 * mogltk::Texture::GetPixels() {
if (surface)
return (Uint32 *) surface->pixels;
else
return 0;
}
-SDL_Surface * mogltk::texture::GetSurface() {
+SDL_Surface * mogltk::Texture::GetSurface() {
return surface;
}
-SDL_PixelFormat * mogltk::texture::GetFormat() {
+SDL_PixelFormat * mogltk::Texture::GetFormat() {
if (surface)
return surface->format;
else
return 0;
}
-void mogltk::texture::Generate() {
+void mogltk::Texture::Generate() {
if (texture_allocated) {
glDeleteTextures(1, &tex);
}
glGenTextures(1, &tex);
- printm(M_INFO, "Generated texture " + name + " with index " + tex + "\n");
+ printm(M_INFO, "Generated Texture " + name + " with index " + tex + "\n");
glBindTexture(GL_TEXTURE_2D, tex);
#if 0
if (planar) {
#ifdef DEBUG
- printm(M_INFO, _("Generating planar texture: %i\n"), tex);
+ printm(M_INFO, _("Generating planar Texture: %i\n"), tex);
#endif
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@@ -294,7 +294,7 @@ void mogltk::texture::Generate() {
tainted = false;
}
-void mogltk::texture::Bind(bool expand) {
+void mogltk::Texture::Bind(bool expand) {
if ((!texture_allocated) || tainted)
Generate();
glEnable(GL_TEXTURE_2D);
@@ -331,15 +331,15 @@ void mogltk::texture::Bind(bool expand) {
header = this;
}
-GLuint mogltk::texture::GetWidth() {
+GLuint mogltk::Texture::GetWidth() {
return width;
}
-GLuint mogltk::texture::GetHeight() {
+GLuint mogltk::Texture::GetHeight() {
return height;
}
-void mogltk::texture::Unbind(void) {
+void mogltk::Texture::Unbind(void) {
if (active) {
glBindTexture(GL_TEXTURE_2D, 0);
glDisable(GL_TEXTURE_2D);
@@ -347,9 +347,9 @@ void mogltk::texture::Unbind(void) {
}
}
-void mogltk::texture::Taint(void) {
+void mogltk::Texture::Taint(void) {
if (taintable) {
- printm(M_INFO, "Tainting texture " + name + "\n");
+ printm(M_INFO, "Tainting Texture " + name + "\n");
tainted = true;
if (active == this)
Unbind();
@@ -360,13 +360,13 @@ void mogltk::texture::Taint(void) {
}
}
-void mogltk::texture::Taintall(void) {
+void mogltk::Texture::Taintall(void) {
Unbind();
if (header)
header->recTaint();
}
-void mogltk::texture::recTaint(void) {
+void mogltk::Texture::recTaint(void) {
Taint();
if (next)
next->recTaint();
@@ -378,7 +378,7 @@ void mogltk::texture::recTaint(void) {
#define NTEX_SIGNATURE 0x5845544e
#endif
-SDL_Surface * mogltk::texture::LoadNTEX(Handle * h) throw (GeneralException) {
+SDL_Surface * mogltk::Texture::LoadNTEX(Handle * h) throw (GeneralException) {
SDL_Surface * r;
char buffer[5];
Uint16 height, width;
@@ -412,7 +412,7 @@ SDL_Surface * mogltk::texture::LoadNTEX(Handle * h) throw (GeneralException) {
return r;
}
-void mogltk::texture::DumpBMP(const String & n) {
+void mogltk::Texture::DumpBMP(const String & n) {
if (surface)
SDL_SaveBMP(surface, n.to_charp());
}
diff --git a/lib/widgets.cc b/lib/widgets.cc
index 5d565d6..5fd76e2 100644
--- a/lib/widgets.cc
+++ b/lib/widgets.cc
@@ -17,14 +17,14 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: widgets.cc,v 1.20 2006-02-02 14:09:49 pixel Exp $ */
+/* $Id: widgets.cc,v 1.21 2006-10-28 16:50:47 pixel Exp $ */
#include <SDL.h>
#include <vector>
#include <Input.h>
-#include "font.h"
+#include "Font.h"
#include "engine.h"
-#include "widgets.h"
+#include "Widgets.h"
#include "sprite.h"
#ifdef HAVE_CONFIG_H
@@ -35,35 +35,35 @@
// Why so much ugly globals... ?
-mogltk::widget * dragged_widget = 0;
+mogltk::Widget * dragged_widget = 0;
-std::vector<mogltk::widget *> out_move, out_click;
-std::vector<mogltk::widget::timed_event> mogltk::widget::timed_events;
-std::vector<mogltk::widget *> mogltk::widget::add_list;
-std::vector<mogltk::widget *> mogltk::widget::del_list;
-bool mogltk::widget::in_delete_loop = false;
+std::vector<mogltk::Widget *> out_move, out_click;
+std::vector<mogltk::Widget::timed_event> mogltk::Widget::timed_events;
+std::vector<mogltk::Widget *> mogltk::Widget::add_list;
+std::vector<mogltk::Widget *> mogltk::Widget::del_list;
+bool mogltk::Widget::in_delete_loop = false;
class widget_mouse_event : public mogltk::engine::mouseevent {
public:
- widget_mouse_event(mogltk::widget *);
+ widget_mouse_event(mogltk::Widget *);
virtual void move(SDL_MouseMotionEvent);
virtual void action(SDL_MouseButtonEvent);
private:
- mogltk::widget * root;
+ mogltk::Widget * root;
int mouse_x_down, mouse_y_down;
bool mouse_down, mouse_drag;
Uint32 old_click;
};
-widget_mouse_event::widget_mouse_event(mogltk::widget * _root) :
+widget_mouse_event::widget_mouse_event(mogltk::Widget * _root) :
root(_root), mouse_down(false), mouse_drag(false) {
}
void widget_mouse_event::move(SDL_MouseMotionEvent m) {
int mx, my;
bool out_threshold;
- std::vector<mogltk::widget *>::iterator i;
- std::vector<mogltk::widget *> out_move_stack;
+ std::vector<mogltk::Widget *>::iterator i;
+ std::vector<mogltk::Widget *> out_move_stack;
mx = mogltk::engine::mouseX();
my = mogltk::engine::mouseY();
@@ -115,8 +115,8 @@ void widget_mouse_event::move(SDL_MouseMotionEvent m) {
void widget_mouse_event::action(SDL_MouseButtonEvent b) {
int mx, my;
- std::vector<mogltk::widget *>::iterator i;
- std::vector<mogltk::widget *> out_click_stack;
+ std::vector<mogltk::Widget *>::iterator i;
+ std::vector<mogltk::Widget *> out_click_stack;
mx = mogltk::engine::mouseX();
my = mogltk::engine::mouseY();
@@ -208,9 +208,9 @@ void widget_mouse_event::action(SDL_MouseButtonEvent b) {
}
}
-mogltk::widget * mogltk::widget::focused = 0;
+mogltk::Widget * mogltk::Widget::focused = 0;
-mogltk::widget::widget(widget * _father, int _x, int _y, int _sx, int _sy, int _type, String _name, mogltk::shape * _sh) :
+mogltk::Widget::Widget(Widget * _father, int _x, int _y, int _sx, int _sy, int _type, String _name, mogltk::Shape * _sh) :
x(_x), y(_y), sx(_sx), sy(_sy), father(_father), prev(0), child(0), last(0), panel(0), type(_type), name(_name), sh(_sh), exclusive(0), visible(true), enabled(true) {
LOCK;
@@ -224,7 +224,7 @@ mogltk::widget::widget(widget * _father, int _x, int _y, int _sx, int _sy, int _
}
}
-void mogltk::widget::linkme() {
+void mogltk::Widget::linkme() {
LOCK;
if (!father) {
root = this;
@@ -244,7 +244,7 @@ void mogltk::widget::linkme() {
computeabs();
}
-mogltk::widget::~widget() throw (GeneralException) {
+mogltk::Widget::~Widget() throw (GeneralException) {
while(child)
delete child;
@@ -262,8 +262,8 @@ mogltk::widget::~widget() throw (GeneralException) {
else
father->last = prev;
- std::vector<mogltk::widget *>::iterator iw;
- std::vector<mogltk::widget::timed_event>::iterator it;
+ std::vector<mogltk::Widget *>::iterator iw;
+ std::vector<mogltk::Widget::timed_event>::iterator it;
for (iw = out_move.begin(); iw != out_move.end(); iw++) {
if (*iw == this) {
@@ -302,7 +302,7 @@ mogltk::widget::~widget() throw (GeneralException) {
UNLOCK;
}
-void mogltk::widget::computeabs() {
+void mogltk::Widget::computeabs() {
if (father != this) {
ax = father->ax + x;
ay = father->ay + y;
@@ -314,7 +314,7 @@ void mogltk::widget::computeabs() {
ay2 = ay + sy;
}
-void mogltk::widget::move(int nx, int ny) {
+void mogltk::Widget::move(int nx, int ny) {
x = nx;
y = ny;
@@ -324,7 +324,7 @@ void mogltk::widget::move(int nx, int ny) {
child->icomputeabs();
}
-void mogltk::widget::resize(int nsx, int nsy) {
+void mogltk::Widget::resize(int nsx, int nsy) {
sx = nsx;
sy = nsy;
@@ -335,39 +335,39 @@ void mogltk::widget::resize(int nsx, int nsy) {
child->iresize_notify();
}
-int mogltk::widget::GetX() {
+int mogltk::Widget::GetX() {
return x;
}
-int mogltk::widget::GetY() {
+int mogltk::Widget::GetY() {
return y;
}
-int mogltk::widget::GetH() {
+int mogltk::Widget::GetH() {
return sy;
}
-int mogltk::widget::GetW() {
+int mogltk::Widget::GetW() {
return sx;
}
-int mogltk::widget::GetAX() {
+int mogltk::Widget::GetAX() {
return ax;
}
-int mogltk::widget::GetAY() {
+int mogltk::Widget::GetAY() {
return ay;
}
-int mogltk::widget::GetAX2() {
+int mogltk::Widget::GetAX2() {
return ax2;
}
-int mogltk::widget::GetAY2() {
+int mogltk::Widget::GetAY2() {
return ay2;
}
-mogltk::rect mogltk::widget::GetDrawRect() {
+mogltk::rect mogltk::Widget::GetDrawRect() {
rect r;
r.x = 0;
r.y = 0;
@@ -377,30 +377,30 @@ mogltk::rect mogltk::widget::GetDrawRect() {
return r;
}
-mogltk::widget * mogltk::widget::Father() {
+mogltk::Widget * mogltk::Widget::Father() {
return father;
}
-mogltk::widget * mogltk::widget::Child() {
+mogltk::Widget * mogltk::Widget::Child() {
return child;
}
-mogltk::widget * mogltk::widget::Next() {
+mogltk::Widget * mogltk::Widget::Next() {
return next;
}
-mogltk::widget * mogltk::widget::Prev() {
+mogltk::Widget * mogltk::Widget::Prev() {
return prev;
}
-mogltk::widget * mogltk::widget::InnerPanel() {
+mogltk::Widget * mogltk::Widget::InnerPanel() {
if (!panel)
panel = create_panel();
return panel;
}
-mogltk::widget * mogltk::widget::find_widget(int _x, int _y) {
- widget * r = 0;
+mogltk::Widget * mogltk::Widget::find_widget(int _x, int _y) {
+ Widget * r = 0;
if (visible && enabled && (_x >= ax) && (_y >= ay) && (_x <= ax2) && (_y <= ay2)) {
if (child)
@@ -416,18 +416,18 @@ mogltk::widget * mogltk::widget::find_widget(int _x, int _y) {
return r;
}
-mogltk::shape * mogltk::widget::Shaper() {
+mogltk::Shape * mogltk::Widget::Shaper() {
return sh;
}
-void mogltk::widget::fulldraw() {
+void mogltk::Widget::fulldraw() {
bool was2D = true;
if (mogltk::engine::glbase_o)
if (!(was2D = mogltk::engine::glbase_o->is2D()))
mogltk::engine::glbase_o->Enter2DMode();
- texture::Unbind();
+ Texture::Unbind();
mogltk::ColorP::Max = WHITE;
mogltk::ColorP::Min = BLACK;
mogltk::ColorP::Min.A = 0;
@@ -439,7 +439,7 @@ void mogltk::widget::fulldraw() {
mogltk::engine::glbase_o->Leave2DMode();
}
-void mogltk::widget::idraw() {
+void mogltk::Widget::idraw() {
if (next)
next->idraw();
@@ -453,7 +453,7 @@ void mogltk::widget::idraw() {
child->idraw();
}
-void mogltk::widget::set_viewport() {
+void mogltk::Widget::set_viewport() {
int x1, y1, x2, y2;
x1 = MAX(GetAX(), father->GetAX());
y1 = MAX(GetAY(), father->GetAY());
@@ -464,13 +464,13 @@ void mogltk::widget::set_viewport() {
engine::base_o->changeviewport(x1, y1, x2 - x1, y2 - y1);
}
-bool mogltk::widget::inside(int xe, int ye) {
+bool mogltk::Widget::inside(int xe, int ye) {
if (!visible)
return false;
return !((xe < ax) || (xe > ax2) || (ye < ay) || (ye > ay2));
}
-void mogltk::widget::m_event(int x, int y, mogltk::event_t event) {
+void mogltk::Widget::m_event(int x, int y, mogltk::event_t event) {
switch (event) {
case E_MOUSE_DRAG_OVER:
case E_MOUSE_END_DRAG_OVER:
@@ -483,7 +483,7 @@ void mogltk::widget::m_event(int x, int y, mogltk::event_t event) {
}
}
-bool mogltk::widget::ievent(int xe, int ye, mogltk::event_t event) {
+bool mogltk::Widget::ievent(int xe, int ye, mogltk::event_t event) {
if (prev)
if (prev->ievent(xe, ye, event))
return true;
@@ -504,22 +504,22 @@ bool mogltk::widget::ievent(int xe, int ye, mogltk::event_t event) {
return process_event(xe, ye, event);
}
-void mogltk::widget::draw() {
+void mogltk::Widget::draw() {
}
-bool mogltk::widget::process_event(int, int, mogltk::event_t) {
+bool mogltk::Widget::process_event(int, int, mogltk::event_t) {
return false;
}
-void mogltk::widget::resize_notify() {
+void mogltk::Widget::resize_notify() {
}
-mogltk::widget * mogltk::widget::create_panel() {
+mogltk::Widget * mogltk::Widget::create_panel() {
mogltk::rect r = GetDrawRect();
- return new widgets::Panel(Shaper(), this, r.x, r.y, r.w, r.h);
+ return new Widgets::Panel(Shaper(), this, r.x, r.y, r.w, r.h);
}
-void mogltk::widget::icomputeabs() {
+void mogltk::Widget::icomputeabs() {
computeabs();
if (next)
@@ -529,7 +529,7 @@ void mogltk::widget::icomputeabs() {
child->icomputeabs();
}
-void mogltk::widget::iresize_notify() {
+void mogltk::Widget::iresize_notify() {
if (next)
next->iresize_notify();
if (child)
@@ -537,31 +537,31 @@ void mogltk::widget::iresize_notify() {
resize_notify();
}
-void mogltk::widget::set_exclusive(mogltk::widget * w) {
+void mogltk::Widget::set_exclusive(mogltk::Widget * w) {
w->exclusive = this;
}
-void mogltk::widget::unset_exclusive(mogltk::widget * w) {
+void mogltk::Widget::unset_exclusive(mogltk::Widget * w) {
w->exclusive = 0;
}
-bool mogltk::widget::GetVisible() {
+bool mogltk::Widget::GetVisible() {
return visible;
}
-void mogltk::widget::SetVisible(bool _visible) {
+void mogltk::Widget::SetVisible(bool _visible) {
visible = _visible;
}
-bool mogltk::widget::GetEnabled() {
+bool mogltk::Widget::GetEnabled() {
return enabled;
}
-void mogltk::widget::SetEnabled(bool _enabled) {
+void mogltk::Widget::SetEnabled(bool _enabled) {
enabled = _enabled;
}
-void mogltk::widget::MoveOnTop() {
+void mogltk::Widget::MoveOnTop() {
if (!prev)
return;
@@ -578,10 +578,10 @@ void mogltk::widget::MoveOnTop() {
father->child = this;
}
-void mogltk::widget::check_timed_events() {
+void mogltk::Widget::check_timed_events() {
std::vector<timed_event>::iterator i;
Uint32 t = SDL_GetTicks();
- widget * w;
+ Widget * w;
for (i = timed_events.begin(); i != timed_events.end(); i++) {
if (i->t <= t) {
@@ -595,8 +595,8 @@ void mogltk::widget::check_timed_events() {
}
}
-void mogltk::widget::add_out_move() {
- std::vector<widget *>::iterator i;
+void mogltk::Widget::add_out_move() {
+ std::vector<Widget *>::iterator i;
for (i = out_move.begin(); i != out_move.end(); i++) {
if (*i == this)
@@ -606,8 +606,8 @@ void mogltk::widget::add_out_move() {
out_move.push_back(this);
}
-void mogltk::widget::remove_out_move() {
- std::vector<widget *>::iterator i;
+void mogltk::Widget::remove_out_move() {
+ std::vector<Widget *>::iterator i;
for (i = out_move.begin(); i != out_move.end(); i++) {
if (*i == this) {
@@ -617,8 +617,8 @@ void mogltk::widget::remove_out_move() {
}
}
-void mogltk::widget::add_out_click() {
- std::vector<widget *>::iterator i;
+void mogltk::Widget::add_out_click() {
+ std::vector<Widget *>::iterator i;
for (i = out_click.begin(); i != out_click.end(); i++) {
if (*i == this)
@@ -628,8 +628,8 @@ void mogltk::widget::add_out_click() {
out_click.push_back(this);
}
-void mogltk::widget::remove_out_click() {
- std::vector<widget *>::iterator i;
+void mogltk::Widget::remove_out_click() {
+ std::vector<Widget *>::iterator i;
for (i = out_click.begin(); i != out_click.end(); i++) {
if (*i == this) {
@@ -639,15 +639,15 @@ void mogltk::widget::remove_out_click() {
}
}
-void mogltk::widget::set_timed_event(Uint32 t) {
+void mogltk::Widget::set_timed_event(Uint32 t) {
timed_events.push_back(timed_event(this, SDL_GetTicks() + t));
}
-void mogltk::widget::set_absolute_timed_event(Uint32 t) {
+void mogltk::Widget::set_absolute_timed_event(Uint32 t) {
timed_events.push_back(timed_event(this, t));
}
-void mogltk::widget::center(bool cx, bool cy) {
+void mogltk::Widget::center(bool cx, bool cy) {
rect tr, fr;
tr.x = GetX();
tr.y = GetY();
@@ -665,7 +665,7 @@ void mogltk::widget::center(bool cx, bool cy) {
move(tr.x, tr.y);
}
-void mogltk::widget::delete_me() {
+void mogltk::Widget::delete_me() {
LOCK;
del_list.push_back(this);
UNLOCK;
@@ -673,36 +673,45 @@ void mogltk::widget::delete_me() {
/*
- * Predefined widgets.
+ * Predefined Widgets.
*/
/***************
* Here is Root *
***************/
-mogltk::widgets::Root::Root(mogltk::shape * sh, mogltk::widgets::drawer * _dr) : widget(0, 0, 0, 0, 0, 0, "Root", sh), dr(_dr) {
+mogltk::Widgets::Root::Root(mogltk::Shape * sh, mogltk::Widgets::drawer * _dr, mogltk::Widgets::drawer * _bg) : Widget(0, 0, 0, 0, 0, 0, "Root", sh), dr(_dr), bg(_bg) {
if (engine::root)
engine::root->delete_me();
engine::root = this;
}
-void mogltk::widgets::Root::draw() {
+void mogltk::Widgets::Root::draw() {
if (dr)
dr->draw(this);
else
Shaper()->box(GetAX(), GetAY(), GetAX2(), GetAY2());
}
-void mogltk::widgets::Root::setdrawer(drawer * _dr) {
+void mogltk::Widgets::Root::drawbg() {
+ if (bg)
+ bg->draw(this);
+}
+
+void mogltk::Widgets::Root::setdrawer(drawer * _dr) {
dr = _dr;
}
+void mogltk::Widgets::Root::setbgdrawer(drawer * _bg) {
+ bg = _bg;
+}
+
/**************************
* A simple clipping Panel *
**************************/
-mogltk::widgets::Panel::Panel(shape * sh, widget * father, int x, int y, int w, int h) : widget(father, x, y, w, h, 0, "Panel", sh) {
+mogltk::Widgets::Panel::Panel(Shape * sh, Widget * father, int x, int y, int w, int h) : Widget(father, x, y, w, h, 0, "Panel", sh) {
}
@@ -710,42 +719,42 @@ mogltk::widgets::Panel::Panel(shape * sh, widget * father, int x, int y, int w,
* The classical Button *
***********************/
-class ButtonCascadeAction : public mogltk::widgets::action {
+class ButtonCascadeAction : public mogltk::Widgets::action {
public:
- ButtonCascadeAction(mogltk::widgets::Button * _parent) : parent(_parent) { }
- virtual void do_action(mogltk::widget *) {
+ ButtonCascadeAction(mogltk::Widgets::Button * _parent) : parent(_parent) { }
+ virtual void do_action(mogltk::Widget *) {
parent->simulate_press();
}
private:
- mogltk::widgets::Button * parent;
+ mogltk::Widgets::Button * parent;
};
-mogltk::widgets::Button::Button(action * _a, shape * sh, widget * father, int x, int y, int w, int h, const String & _caption) : widget(father, x, y, w, h, 0, "Button", sh), bevel(false), dragging(false), a(_a), cascade(0) {
+mogltk::Widgets::Button::Button(action * _a, Shape * sh, Widget * father, int x, int y, int w, int h, const String & _caption) : Widget(father, x, y, w, h, 0, "Button", sh), bevel(false), dragging(false), a(_a), cascade(0) {
caption = _caption;
}
-mogltk::widgets::Button::~Button() throw (GeneralException) {
+mogltk::Widgets::Button::~Button() throw (GeneralException) {
if (cascade)
delete cascade;
}
-void mogltk::widgets::Button::draw() {
+void mogltk::Widgets::Button::draw() {
Shaper()->button(GetAX() + 1, GetAY() + 1, GetAX2() - 1, GetAY2() - 1, caption, bevel);
}
-void mogltk::widgets::Button::simulate_press() {
+void mogltk::Widgets::Button::simulate_press() {
if (a)
a->do_action(this);
}
-mogltk::widgets::action * mogltk::widgets::Button::cascade_action() {
+mogltk::Widgets::action * mogltk::Widgets::Button::cascade_action() {
if (!cascade)
cascade = new ButtonCascadeAction(this);
return cascade;
}
-bool mogltk::widgets::Button::process_event(int xe, int ye, mogltk::event_t event) {
+bool mogltk::Widgets::Button::process_event(int xe, int ye, mogltk::event_t event) {
switch (event) {
case E_MOUSE_DOWN:
bevel = true;
@@ -780,15 +789,15 @@ bool mogltk::widgets::Button::process_event(int xe, int ye, mogltk::event_t even
* The SmartBox window *
**********************/
-mogltk::widgets::SmartBox::SmartBox(shape * sh, mogltk::widget * father, int x, int y, int w, int h, const String & _caption) : widget(father, x, y, w, h, 0, "SmartBox", sh) {
+mogltk::Widgets::SmartBox::SmartBox(Shape * sh, mogltk::Widget * father, int x, int y, int w, int h, const String & _caption) : Widget(father, x, y, w, h, 0, "SmartBox", sh) {
caption = _caption;
}
-void mogltk::widgets::SmartBox::draw() {
+void mogltk::Widgets::SmartBox::draw() {
Shaper()->window(GetAX(), GetAY(), GetAX2(), GetAY2(), caption);
}
-bool mogltk::widgets::SmartBox::process_event(int x, int y, mogltk::event_t event) {
+bool mogltk::Widgets::SmartBox::process_event(int x, int y, mogltk::event_t event) {
switch (event) {
case E_MOUSE_START_DRAG:
if ((GetAY() + 20) > y) {
@@ -808,7 +817,7 @@ bool mogltk::widgets::SmartBox::process_event(int x, int y, mogltk::event_t even
return false;
}
-mogltk::rect mogltk::widgets::SmartBox::GetDrawRect() {
+mogltk::rect mogltk::Widgets::SmartBox::GetDrawRect() {
rect r;
r.x = 2;
@@ -823,19 +832,19 @@ mogltk::rect mogltk::widgets::SmartBox::GetDrawRect() {
* The SmartBox window with a close button *
******************************************/
-class SmartBoxCloseAction : public mogltk::widgets::action {
+class SmartBoxCloseAction : public mogltk::Widgets::action {
public:
- SmartBoxCloseAction(mogltk::widget * _parent) : parent(_parent) { }
- virtual void do_action(mogltk::widget *) {
+ SmartBoxCloseAction(mogltk::Widget * _parent) : parent(_parent) { }
+ virtual void do_action(mogltk::Widget *) {
parent->delete_me();
delete this;
}
private:
- mogltk::widget * parent;
+ mogltk::Widget * parent;
};
-mogltk::widgets::SmartBoxClose::SmartBoxClose(mogltk::shape * sh, mogltk::widget * father, int x, int y, int w, int h, const String & _caption) : SmartBox(sh, father, x, y, w, h, _caption) {
- new mogltk::widgets::Button(new SmartBoxCloseAction(this), sh, this, 1, 1, 16, 16, "X");
+mogltk::Widgets::SmartBoxClose::SmartBoxClose(mogltk::Shape * sh, mogltk::Widget * father, int x, int y, int w, int h, const String & _caption) : SmartBox(sh, father, x, y, w, h, _caption) {
+ new mogltk::Widgets::Button(new SmartBoxCloseAction(this), sh, this, 1, 1, 16, 16, "X");
}
@@ -843,7 +852,7 @@ mogltk::widgets::SmartBoxClose::SmartBoxClose(mogltk::shape * sh, mogltk::widget
* The MessageBox child *
***********************/
-mogltk::widgets::MsgBox::MsgBox(action * a, shape * sh, mogltk::widget * father, const String & caption, const String & text, mogltk::font * _font) : SmartBox(sh, father, 0, 0, 0, 0, caption), msgbox_font(_font) {
+mogltk::Widgets::MsgBox::MsgBox(action * a, Shape * sh, mogltk::Widget * father, const String & caption, const String & text, mogltk::Font * _font) : SmartBox(sh, father, 0, 0, 0, 0, caption), msgbox_font(_font) {
rect size = msgbox_font->size(text);
rect lsize = size;
@@ -859,7 +868,7 @@ mogltk::widgets::MsgBox::MsgBox(action * a, shape * sh, mogltk::widget * father,
set_exclusive(father);
}
-mogltk::widgets::MsgBox::~MsgBox() throw (GeneralException) {
+mogltk::Widgets::MsgBox::~MsgBox() throw (GeneralException) {
unset_exclusive(Father());
}
@@ -868,11 +877,11 @@ mogltk::widgets::MsgBox::~MsgBox() throw (GeneralException) {
* A simple Label *
*****************/
-mogltk::widgets::Label::Label(shape * sh, mogltk::widget * father, int x, int y, int w, int h, const String & _caption, const ColorP & _color, mogltk::font * _font) : widget(father, x, y, w, h, 0, "Label", sh), color(_color), label_font(_font) {
+mogltk::Widgets::Label::Label(Shape * sh, mogltk::Widget * father, int x, int y, int w, int h, const String & _caption, const ColorP & _color, mogltk::Font * _font) : Widget(father, x, y, w, h, 0, "Label", sh), color(_color), label_font(_font) {
caption = _caption;
}
-void mogltk::widgets::Label::draw() {
+void mogltk::Widgets::Label::draw() {
Shaper()->text(GetAX(), GetAY(), caption, color, LEFT, label_font);
}
@@ -881,14 +890,14 @@ void mogltk::widgets::Label::draw() {
* The classical 3D Frame *
*************************/
-mogltk::widgets::Frame::Frame(shape * sh, widget * father, int x, int y, int w, int h) : widget(father, x, y, w, h, 0, "Frame", sh) {
+mogltk::Widgets::Frame::Frame(Shape * sh, Widget * father, int x, int y, int w, int h) : Widget(father, x, y, w, h, 0, "Frame", sh) {
}
-void mogltk::widgets::Frame::draw() {
+void mogltk::Widgets::Frame::draw() {
Shaper()->obox3d(GetAX(), GetAY(), GetAX2(), GetAY2());
}
-mogltk::rect mogltk::widgets::Frame::GetDrawRect() {
+mogltk::rect mogltk::Widgets::Frame::GetDrawRect() {
rect r;
r.x = 4;
@@ -901,17 +910,21 @@ mogltk::rect mogltk::widgets::Frame::GetDrawRect() {
/*
- * The mainloop widget thing.
+ * The mainloop Widget thing.
*/
-void mogltk::widget::mainloop() {
+void mogltk::Widget::mainloop() throw (GeneralException) {
bool end_event_loop = false;
widget_mouse_event * mouse = new widget_mouse_event(this);
int mx, my;
+ if (root) {
+ throw GeneralException("Main loop can only be run on the root widget.");
+ }
+
while (!end_event_loop && !engine::quitrequested()) {
- if (root)
- root->fulldraw();
+ ((Widgets::Root *) this)->drawbg();
+ fulldraw();
mx = mogltk::engine::mouseX();
my = mogltk::engine::mouseY();
@@ -923,25 +936,25 @@ void mogltk::widget::mainloop() {
// }
engine::base_o->Flip();
- widget::check_timed_events();
+ Widget::check_timed_events();
LOCK;
- std::vector<widget *> del_list_copy = del_list;
+ std::vector<Widget *> del_list_copy = del_list;
del_list.clear();
UNLOCK;
in_delete_loop = true;
- for (std::vector<widget *>::iterator i = del_list_copy.begin(); i != del_list_copy.end(); i++) {
+ for (std::vector<Widget *>::iterator i = del_list_copy.begin(); i != del_list_copy.end(); i++) {
delete *i;
}
in_delete_loop = false;
LOCK;
- std::vector<widget *> add_list_copy = add_list;
+ std::vector<Widget *> add_list_copy = add_list;
add_list.clear();
UNLOCK;
- for (std::vector<widget *>::iterator i = add_list_copy.begin(); i != add_list_copy.end(); i++) {
+ for (std::vector<Widget *>::iterator i = add_list_copy.begin(); i != add_list_copy.end(); i++) {
(*i)->linkme();
}
}