00001 00002 00003 00004 #ifndef GOSU_WINDOW_HPP 00005 #define GOSU_WINDOW_HPP 00006 00007 #include <Gosu/Fwd.hpp> 00008 #include <Gosu/Platform.hpp> 00009 #include <Gosu/Input.hpp> 00010 #include <boost/scoped_ptr.hpp> 00011 #include <boost/shared_ptr.hpp> 00012 #include <boost/function.hpp> 00013 #include <string> 00014 00015 #ifdef GOSU_IS_WIN 00016 #define NOMINMAX 00017 #include <windows.h> 00018 #endif 00019 00020 namespace Gosu 00021 { 00027 class Window 00028 { 00029 struct Impl; 00030 boost::scoped_ptr<Impl> pimpl; 00031 00032 public: 00036 Window(unsigned width, unsigned height, bool fullscreen, 00037 double updateInterval = 16.666666); 00038 virtual ~Window(); 00039 00040 std::wstring caption() const; 00041 void setCaption(const std::wstring& caption); 00042 00043 double updateInterval() const; 00044 00046 void show(); 00048 void close(); 00049 00052 virtual void update() {} 00055 virtual void draw() {} 00056 00061 virtual bool needsRedraw() const { return true; } 00062 00065 virtual void buttonDown(Gosu::Button) {} 00067 virtual void buttonUp(Gosu::Button) {} 00068 00069 // Ignore when SWIG is wrapping this class for Ruby/Gosu. 00070 #ifndef SWIG 00071 00072 const Graphics& graphics() const; 00073 Graphics& graphics(); 00074 00075 const Input& input() const; 00076 Input& input(); 00077 00078 #ifdef GOSU_IS_WIN 00079 // Only on Windows, used for integrating with GUI toolkits. 00080 HWND handle() const; 00081 virtual LRESULT handleMessage(UINT message, WPARAM wparam, 00082 LPARAM lparam); 00083 #endif 00084 00085 #ifdef GOSU_IS_UNIX 00086 // Context for creating shared contexts. 00087 // Only on Unices (so far). 00088 typedef boost::shared_ptr<boost::function<void()> > SharedContext; 00089 SharedContext createSharedContext(); 00090 #endif 00091 00092 #ifdef GOSU_IS_IPHONE 00093 // iPhone-only callbacks for touch events. 00094 // Note that it does not hurt to override them even if you compile 00095 // for another platform; if you don't specify "virtual" the code 00096 // should even be stripped away cleanly. 00097 virtual void touchesBegan(const Touches& touches) {} 00098 virtual void touchesMoved(const Touches& touches) {} 00099 virtual void touchesEnded(const Touches& touches) {} 00100 // Currently known touches. 00101 const Touches& currentTouches() const; 00102 #endif 00103 00104 GOSU_DEPRECATED const Audio& audio() const; 00105 GOSU_DEPRECATED Audio& audio(); 00106 00107 #endif 00108 }; 00109 } 00110 00111 #endif
Documentation not clear enough? Please go to one of the places listed on http://www.libgosu.org/ and leave feedback. Thanks!