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 #include <windows.h> 00017 #endif 00018 00019 namespace Gosu 00020 { 00026 class Window 00027 { 00028 struct Impl; 00029 boost::scoped_ptr<Impl> pimpl; 00030 00031 public: 00035 Window(unsigned width, unsigned height, bool fullscreen, 00036 double updateInterval = 16.666666); 00037 virtual ~Window(); 00038 00039 std::wstring caption() const; 00040 void setCaption(const std::wstring& caption); 00041 00042 double updateInterval() const; 00043 00045 void show(); 00047 void close(); 00048 00051 virtual void update() {} 00054 virtual void draw() {} 00055 00060 virtual bool needsRedraw() const { return true; } 00061 00064 virtual void buttonDown(Gosu::Button) {} 00066 virtual void buttonUp(Gosu::Button) {} 00067 00068 // Ignore when SWIG is wrapping this class for Ruby/Gosu. 00069 #ifndef SWIG 00070 00071 const Graphics& graphics() const; 00072 Graphics& graphics(); 00073 00074 const Input& input() const; 00075 Input& input(); 00076 00077 #ifdef GOSU_IS_WIN 00078 // Only on Windows, used for integrating with GUI toolkits. 00079 HWND handle() const; 00080 virtual LRESULT handleMessage(UINT message, WPARAM wparam, 00081 LPARAM lparam); 00082 #endif 00083 00084 #ifdef GOSU_IS_UNIX 00085 // Context for creating shared contexts. 00086 // Only on Unices (so far). 00087 typedef boost::shared_ptr<boost::function<void()> > SharedContext; 00088 SharedContext createSharedContext(); 00089 #endif 00090 00091 #ifdef GOSU_IS_IPHONE 00092 // iPhone-only callbacks for touch events. 00093 // Note that it does not hurt to override them even if you compile 00094 // for another platform; if you don't specify "virtual" the code 00095 // should even be stripped away cleanly. 00096 virtual void touchesBegan(const Touches& touches) {} 00097 virtual void touchesMoved(const Touches& touches) {} 00098 virtual void touchesEnded(const Touches& touches) {} 00099 // Currently known touches. 00100 const Touches& currentTouches() const; 00101 #endif 00102 00103 #endif 00104 00105 // Deprecated. 00106 const Audio& audio() const; 00107 Audio& audio(); 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!