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 #ifndef NOMINMAX 00017 #define NOMINMAX 00018 #endif 00019 #include <windows.h> 00020 #endif 00021 00022 namespace Gosu 00023 { 00029 class Window 00030 { 00031 struct Impl; 00032 boost::scoped_ptr<Impl> pimpl; 00033 00034 public: 00038 Window(unsigned width, unsigned height, bool fullscreen, 00039 double updateInterval = 16.666666); 00040 virtual ~Window(); 00041 00042 std::wstring caption() const; 00043 void setCaption(const std::wstring& caption); 00044 00045 double updateInterval() const; 00046 00048 void show(); 00050 void close(); 00051 00054 virtual void update() {} 00057 virtual void draw() {} 00058 00063 virtual bool needsRedraw() const { return true; } 00064 00067 virtual bool needsCursor() const { return false; } 00068 00072 virtual void loseFocus() {} 00073 00076 virtual void releaseMemory() {} 00077 00080 virtual void buttonDown(Gosu::Button) {} 00082 virtual void buttonUp(Gosu::Button) {} 00083 00084 // Ignore when SWIG is wrapping this class for Ruby/Gosu. 00085 #ifndef SWIG 00086 00087 const Graphics& graphics() const; 00088 Graphics& graphics(); 00089 00090 const Input& input() const; 00091 Input& input(); 00092 00093 #ifdef GOSU_IS_WIN 00094 // Only on Windows, used for integrating with GUI toolkits. 00095 HWND handle() const; 00096 virtual LRESULT handleMessage(UINT message, WPARAM wparam, 00097 LPARAM lparam); 00098 #endif 00099 00100 #ifdef GOSU_IS_UNIX 00101 // Context for creating shared contexts. 00102 // Only on Unices (so far). 00103 typedef boost::shared_ptr<boost::function<void()> > SharedContext; 00104 SharedContext createSharedContext(); 00105 #endif 00106 00107 #ifdef GOSU_IS_IPHONE 00108 // iPhone-only callbacks for touch events. 00109 // Note that it does not hurt to override them even if you compile 00110 // for another platform; if you don't specify "virtual" the code 00111 // should even be stripped away cleanly. 00112 virtual void touchBegan(Touch touch) {} 00113 virtual void touchMoved(Touch touch) {} 00114 virtual void touchEnded(Touch touch) {} 00115 #endif 00116 00117 const Audio& audio() const; 00118 Audio& audio(); 00119 00120 #endif 00121 }; 00122 } 00123 00124 #endif
Documentation not clear enough? Please go to one of the places listed on http://www.libgosu.org/ and leave feedback. Thanks!