diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/base.h | 1 | ||||
-rw-r--r-- | include/engine.h | 2 | ||||
-rw-r--r-- | include/glbase.h | 3 | ||||
-rw-r--r-- | include/glwidgets.h | 33 | ||||
-rw-r--r-- | include/mcolor.h | 1 | ||||
-rw-r--r-- | include/widgets.h | 52 |
6 files changed, 73 insertions, 19 deletions
diff --git a/include/base.h b/include/base.h index 592d8d9..2607cf5 100644 --- a/include/base.h +++ b/include/base.h @@ -16,6 +16,7 @@ namespace mogltk { virtual void Enter2DMode(); virtual void Leave2DMode(); virtual bool is2D(); + virtual void changeviewport(int x = 0, int y = 0, unsigned int w = 0, unsigned int h = 0); protected: base(int, int, int, int); void setsurface(SDL_Surface *) throw (GeneralException); diff --git a/include/engine.h b/include/engine.h index 420f576..6bd2697 100644 --- a/include/engine.h +++ b/include/engine.h @@ -6,6 +6,7 @@ #include <Exceptions.h> #include <base.h> #include <glbase.h> +#include <widgets.h> namespace mogltk { class engine : public Base { @@ -35,6 +36,7 @@ namespace mogltk { static void setkeyevent(keyevent *); static glbase * glbase_o; static base * base_o; + static widget * root; private: static bool inited; static bool postsetuped; diff --git a/include/glbase.h b/include/glbase.h index 6328d94..7e6d454 100644 --- a/include/glbase.h +++ b/include/glbase.h @@ -15,12 +15,15 @@ namespace mogltk { virtual void Leave2DMode(void); virtual void Flip(void); virtual bool is2D(void); + virtual void changeviewport(int x = 0, int y = 0, unsigned int w = 0, unsigned int h = 0); + void changefovy(GLdouble); static void glVertex(GLshort, GLshort, GLshort = 0, GLshort = 1); static void glVertex(GLint, GLint, GLint = 0, GLint = 1); static void glVertex(GLfloat, GLfloat, GLfloat = 0.0, GLfloat = 1.0); static void glVertex(GLdouble, GLdouble, GLdouble = 0.0, GLdouble = 1.0); private: int twoD; + GLdouble ratio, fovy; }; }; diff --git a/include/glwidgets.h b/include/glwidgets.h index 86688ef..b606a14 100644 --- a/include/glwidgets.h +++ b/include/glwidgets.h @@ -1,20 +1,15 @@ -#ifndef __GLWIDGETS_H__ -#define __GLWIDGETS_H__ - -#include <Exceptions.h> - -namespace mogltk { - class widget : public Base { - public: - virtual ~widget(); - bool PointerEvent(int x, int y); +#ifndef __GLWIDGETS_H__
+#define __GLWIDGETS_H__
+
+#include <widgets.h>
+
+namespace mogltk {
+ class glRoot : public Root {
+ public:
+ glRoot(shape *);
protected: - widget(widget * father, int x, int y, int sx, int sy) throw (GeneralException); - private: - int x, y, sx, sy; - widget * father, * next, * prev, * child, * root; - static widget * cur_root, * focused; - }; -}; - -#endif + virtual void draw(); + };
+};
+
+#endif
diff --git a/include/mcolor.h b/include/mcolor.h index 6be0a5a..4cf3113 100644 --- a/include/mcolor.h +++ b/include/mcolor.h @@ -1,6 +1,7 @@ #ifndef __MCOLOR_H__ #define __MCOLOR_H__ +#include <SDL.h> #include <Exceptions.h> #include <Color.h> diff --git a/include/widgets.h b/include/widgets.h new file mode 100644 index 0000000..bef2682 --- /dev/null +++ b/include/widgets.h @@ -0,0 +1,52 @@ +#ifndef __WIDGETS_H__ +#define __WIDGETS_H__ + +#include <Exceptions.h> +#include <shape.h> + +namespace mogltk { + class widget : public Base { + public: + virtual ~widget(); + void move(int x, int y); + void resize(int sx, int sy); + int GetX(); + int GetY(); + int GetH(); + int GetW(); + int GetAX(); + int GetAY(); + int GetAX2(); + int GetAY2(); + void fulldraw(); + shape * Shaper(); + protected: + widget(widget * father, int x, int y, int sx, int sy, int type, String name, shape *); + virtual void draw() = 0; + private: + void computeabs(); + int x, y, sx, sy, ax, ay, ax2, ay2; + widget * father, * next, * prev, * child, * root; + static widget * focused; + int type; + String name, caption; + shape * sh; + void idraw(); + }; + + class drawer : public Base { + public: + virtual void draw(widget *) = 0; + }; + + class Root : public widget { + public: + Root(shape *, drawer * = 0); + void setdrawer(drawer *); + protected: + virtual void draw(); + drawer * dr; + }; +}; + +#endif |