// While (re)writing this file, I have been looking at many other libraries since all the // "official" documentation was horrible, at least those parts that I was able to find. // Kudos to the Pyglet folks (http://www.pyglet.org/) who wrote code that was much easier to // understand than that! #include #include #include #include #include #include #include #include #include #include #include #include #include #include "X11vroot.h" namespace { template class scoped_resource { T* pointer; typedef boost::function Deleter; Deleter deleter; public: scoped_resource(T* pointer, const Deleter& deleter) : pointer(pointer), deleter(deleter) { } void reset(T* newPointer = 0) { if (pointer) deleter(pointer); pointer = newPointer; } T* get() const { return pointer; } T* operator->() const { return get(); } ~scoped_resource() { reset(0); } }; } struct Gosu::Window::Impl { boost::scoped_ptr graphics; boost::scoped_ptr input; boost::scoped_ptr