SDL++
C++wrapperfortheSDLlibrary.
|
00001 00021 #ifndef SDL_VIDEO_WINDOW_H 00022 #define SDL_VIDEO_WINDOW_H 00023 00024 #include <stdexcept> 00025 #include <string> 00026 00027 #include <SDL.h> 00028 //Error being caused by #include <SDL_syswm.h> 00029 //#include <SDL_syswm.h> 00030 00031 #include "sdlpp/Sdl.h" 00032 #include "sdlpp/video/Surface.h" 00033 #include "sdlpp/video/Icon.h" 00034 00035 namespace sdl { 00036 namespace video { 00037 using namespace std; 00038 00043 class Window { 00044 public: 00048 Window (const string& caption, const Icon& icon) 00049 : caption_ (caption), icon_ (icon) {}; 00050 00054 ~Window () {}; 00055 00061 string caption () { return caption_; }; 00062 00070 Window& caption (const string& caption) { 00071 caption_ = caption; 00072 SDL_WM_SetCaption (caption.c_str (), icon_.name ().c_str ()); 00073 return *this; 00074 }; 00075 00081 Icon& icon () { return icon_; }; 00082 00090 Window& icon (const Icon& icon) { 00091 icon_ = icon; 00092 SDL_WM_SetCaption (caption_.c_str (), icon_.name ().c_str ()); 00093 return *this; 00094 }; 00095 00101 bool minimize () { return SDL_WM_IconifyWindow () != 0; }; 00102 00108 bool grabInput () { return SDL_WM_GrabInput (SDL_GRAB_ON) == SDL_GRAB_ON; }; 00109 00115 bool releaseInput () { return SDL_WM_GrabInput (SDL_GRAB_OFF) == SDL_GRAB_OFF; }; 00116 00122 bool inputGrabbed () { return SDL_WM_GrabInput (SDL_GRAB_QUERY) == SDL_GRAB_ON; }; 00123 00131 bool fullScreen (const Surface& surface) { return SDL_WM_ToggleFullScreen (surface.to_c ()) == 1; }; 00132 00133 //Error being caused by #include <SDL_syswm.h> 00141 /*SDL_SysWMinfo info () { 00142 SDL_SysWMinfo i; 00143 i.version = Sdl::instance ().compileVersion (); 00144 int res = SDL_GetWMInfo (&i); 00145 if (res == 0) 00146 throw runtime_error ("unimplemented"); 00147 else if (res == -1) 00148 throw runtime_error ("failed"); 00149 return i; 00150 };*/ 00151 00152 private: 00158 Window (const Window& rhs); 00159 00167 Window& operator= (const Window& rhs); 00168 00169 private: 00173 string caption_; 00174 00178 Icon icon_; 00179 }; //Window 00180 }; //video 00181 }; //sdl 00182 00183 #endif //SDL_VIDEO_WINDOW_H 00184