• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

Window.hpp

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 <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 Audio& audio() const;
00075         Audio& audio();
00076         
00077         const Input& input() const;
00078         Input& input();
00079         
00080         #ifdef GOSU_IS_WIN
00081         // Only on Windows, used for integrating with GUI toolkits.
00082         HWND handle() const;
00083         virtual LRESULT handleMessage(UINT message, WPARAM wparam,
00084             LPARAM lparam);
00085         #endif
00086         
00087         #ifdef GOSU_IS_UNIX
00088         // Context for creating shared contexts.
00089         // Only on Unices (so far).
00090         typedef boost::shared_ptr<boost::function<void()> > SharedContext;
00091         SharedContext createSharedContext();
00092         #endif
00093         
00094         #ifdef GOSU_IS_IPHONE
00095         // iPhone-only callbacks for touch events.
00096         // Note that it does not hurt to override them even if you compile
00097         // for another platform; if you don't specify "virtual" the code
00098         // should even be stripped away cleanly.
00099         virtual void touchesBegan(const Touches& touches) {}
00100         virtual void touchesMoved(const Touches& touches) {}
00101         virtual void touchesEnded(const Touches& touches) {}
00102         // Currently known touches.
00103         const Touches& currentTouches() const;
00104         #endif        
00105         
00106         #endif
00107     };
00108 }
00109 
00110 #endif

Documentation not clear enough? Please go to one of the places listed on http://www.libgosu.org/ and leave feedback. Thanks!