Go to the documentation of this file.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 <Gosu/TR1.hpp>
00011 #include <memory>
00012 #include <string>
00013
00014 #ifdef GOSU_IS_WIN
00015 #ifndef NOMINMAX
00016 #define NOMINMAX
00017 #endif
00018 #include <windows.h>
00019 #endif
00020
00021 namespace Gosu
00022 {
00028 class Window
00029 {
00030 struct Impl;
00031 const std::auto_ptr<Impl> pimpl;
00032
00033 public:
00037 Window(unsigned width, unsigned height, bool fullscreen,
00038 double updateInterval = 16.666666);
00039 virtual ~Window();
00040
00041 std::wstring caption() const;
00042 void setCaption(const std::wstring& caption);
00043
00044 double updateInterval() const;
00045
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
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
00095 HWND handle() const;
00096 virtual LRESULT handleMessage(UINT message, WPARAM wparam,
00097 LPARAM lparam);
00098 #endif
00099
00100 #ifdef GOSU_IS_UNIX
00101
00102
00103 typedef std::tr1::shared_ptr<std::tr1::function<void()> > SharedContext;
00104 SharedContext createSharedContext();
00105 #endif
00106
00107 #ifdef GOSU_IS_IPHONE
00108
00109
00110
00111
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