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/scoped_ptr.hpp> 00012 #include <memory> 00013 00014 namespace Gosu 00015 { 00017 unsigned screenWidth(); 00018 00020 unsigned screenHeight(); 00021 00022 // Returns the maximum size of an image that can fit on a single 00023 // texture. 00024 // Only useful when extending Gosu using OpenGL. 00025 // (Held back until it will not cause a stock Ubuntu to crash. Don't ask me!) 00026 //extern unsigned const MAX_TEXTURE_SIZE; 00027 00028 typedef boost::array<double, 16> Transform; 00029 Transform rotate(double angle, double aroundX = 0, double aroundY = 0); 00030 Transform translate(double x, double y); 00031 Transform scale(double factor); 00032 Transform scale(double factorX, double factorY); 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 double factorX() const; 00048 double factorY() const; 00049 void setResolution(unsigned virtualWidth, unsigned virtualHeight); 00050 // End of Undocumented 00051 00052 unsigned width() const; 00053 unsigned height() const; 00054 bool fullscreen() const; 00055 00058 bool begin(Color clearWithColor = Color::BLACK); 00060 void end(); 00063 void beginGL(); 00065 void endGL(); 00067 void beginClipping(int x, int y, unsigned width, unsigned height); 00069 void endClipping(); 00070 00072 void beginRecording(); 00075 std::auto_ptr<Gosu::ImageData> endRecording(); 00076 00078 void pushTransform(const Transform& transform); 00080 void popTransform(); 00081 00083 void drawLine(double x1, double y1, Color c1, 00084 double x2, double y2, Color c2, 00085 ZPos z, AlphaMode mode = amDefault); 00086 00087 void drawTriangle(double x1, double y1, Color c1, 00088 double x2, double y2, Color c2, 00089 double x3, double y3, Color c3, 00090 ZPos z, AlphaMode mode = amDefault); 00091 00092 void drawQuad(double x1, double y1, Color c1, 00093 double x2, double y2, Color c2, 00094 double x3, double y3, Color c3, 00095 double x4, double y4, Color c4, 00096 ZPos z, AlphaMode mode = amDefault); 00097 00100 std::auto_ptr<ImageData> createImage(const Bitmap& src, 00101 unsigned srcX, unsigned srcY, unsigned srcWidth, unsigned srcHeight, 00102 unsigned borderFlags); 00103 }; 00104 } 00105 00106 #endif
Documentation not clear enough? Please go to one of the places listed on http://www.libgosu.org/ and leave feedback. Thanks!