00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef __MXWND__H__
00017 #define __MXWND__H__
00018
00019 #include "mxsurface.h"
00020 #include "mx_types.h"
00021 #include"SDL_opengl.h"
00022 #include "mximage.h"
00023
00024
00025 #define STATIC_MAIN(func) int main(int argc, char **argv) { return func (argc, argv); }
00026
00027 namespace mx {
00028
00032 enum lookType{ LOOKAT, ORTHO };
00033
00034
00036 class mxWnd {
00037 public:
00045 mxWnd(int w=640, int h=480, Uint32 flags=0, SDL_Surface *ico = 0, bool opengl_init=false);
00052 mxWnd( Size window, Size canvas, Uint32 flags = 0, SDL_Surface *ico = 0 );
00060 void initWnd(int w, int h, Uint32 flags, SDL_Surface *ico, bool opengl_init);
00064 void setMode(lookType type);
00066 virtual ~mxWnd();
00070 int messageLoop();
00075 virtual void eventPassed(SDL_Event &e);
00079 virtual void renderScreen();
00083 void setTitle(string title) const;
00085 void quit();
00087 void minimizeWindow() const;
00089 void pumpEvents() const;
00094 void enableKeyRepeat(int code, int interval);
00098 SDL_Surface *renderSurface() const { return front.getSurface(); }
00102 mxSurface &mxrenderSurface() { return front; }
00106 Size &size();
00110 mxSurface &sizedSurface() { return background; }
00112 void sizedFlip();
00116 void createSizedBackground ( Size &s );
00121 virtual void resizeWindow(int w, int h);
00122 protected:
00124 mxSurface front;
00126 mxSurface background;
00128 bool active;
00130 Uint32 vid_flags;
00132 Size sizevar;
00134 static mxWnd *mxwnd;
00138 static mxWnd *get_MX() { return mxwnd; }
00140 bool opengl_;
00142 lookType d_type;
00143
00144 private:
00145 int err_Type;
00146 };
00147 }
00148
00149 #endif
00150
00151