00001 00002 00003 00004 #ifndef GOSU_GRAPHICS_HPP 00005 #define GOSU_GRAPHICS_HPP 00006 00007 #include <Gosu/Fwd.hpp> 00008 #include <Gosu/Color.hpp> 00009 #include <Gosu/GraphicsBase.hpp> 00010 #include <boost/array.hpp> 00011 #include <boost/function.hpp> 00012 #include <boost/scoped_ptr.hpp> 00013 #include <memory> 00014 00015 namespace Gosu 00016 { 00018 unsigned screenWidth(); 00019 00021 unsigned screenHeight(); 00022 00026 unsigned const MAX_TEXTURE_SIZE = 1024; 00027 00028 typedef boost::array<double, 16> Transform; 00029 Transform translate(double x, double y); 00030 Transform rotate(double angle, double aroundX = 0, double aroundY = 0); 00031 Transform scale(double factor); 00032 Transform scale(double factorX, double factorY, double fromX = 0, double fromY = 0); 00033 00037 class Graphics 00038 { 00039 struct Impl; 00040 boost::scoped_ptr<Impl> pimpl; 00041 00042 public: 00043 Graphics(unsigned physicalWidth, unsigned physicalHeight, bool fullscreen); 00044 ~Graphics(); 00045 00046 // Undocumented until I have thought about this... 00047 void setResolution(unsigned virtualWidth, unsigned virtualHeight); 00048 // End of Undocumented 00049 00050 unsigned width() const; 00051 unsigned height() const; 00052 bool fullscreen() const; 00053 00056 bool begin(Color clearWithColor = Color::BLACK); 00058 void end(); 00061 void flush(); 00062 00065 void beginGL(); 00067 void endGL(); 00076 void scheduleGL(const boost::function<void()>& functor, ZPos z); 00077 00079 void beginClipping(double x, double y, double width, double height); 00081 void endClipping(); 00082 00084 void beginRecording(); 00087 std::auto_ptr<Gosu::ImageData> endRecording(); 00088 00090 void pushTransform(const Transform& transform); 00092 void popTransform(); 00093 00095 void drawLine(double x1, double y1, Color c1, 00096 double x2, double y2, Color c2, 00097 ZPos z, AlphaMode mode = amDefault); 00098 00099 void drawTriangle(double x1, double y1, Color c1, 00100 double x2, double y2, Color c2, 00101 double x3, double y3, Color c3, 00102 ZPos z, AlphaMode mode = amDefault); 00103 00104 void drawQuad(double x1, double y1, Color c1, 00105 double x2, double y2, Color c2, 00106 double x3, double y3, Color c3, 00107 double x4, double y4, Color c4, 00108 ZPos z, AlphaMode mode = amDefault); 00109 00112 std::auto_ptr<ImageData> createImage(const Bitmap& src, 00113 unsigned srcX, unsigned srcY, unsigned srcWidth, unsigned srcHeight, 00114 unsigned borderFlags); 00115 }; 00116 } 00117 00118 #endif
Documentation not clear enough? Please go to one of the places listed on http://www.libgosu.org/ and leave feedback. Thanks!