Warning, file /education/gcompris/external/qml-box2d/Box2D/Common/b2Draw.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 * Copyright (c) 2011 Erin Catto http://box2d.org 0003 * 0004 * This software is provided 'as-is', without any express or implied 0005 * warranty. In no event will the authors be held liable for any damages 0006 * arising from the use of this software. 0007 * Permission is granted to anyone to use this software for any purpose, 0008 * including commercial applications, and to alter it and redistribute it 0009 * freely, subject to the following restrictions: 0010 * 1. The origin of this software must not be misrepresented; you must not 0011 * claim that you wrote the original software. If you use this software 0012 * in a product, an acknowledgment in the product documentation would be 0013 * appreciated but is not required. 0014 * 2. Altered source versions must be plainly marked as such, and must not be 0015 * misrepresented as being the original software. 0016 * 3. This notice may not be removed or altered from any source distribution. 0017 */ 0018 0019 #ifndef B2_DRAW_H 0020 #define B2_DRAW_H 0021 0022 #include <Box2D/Common/b2Math.h> 0023 0024 /// Color for debug drawing. Each value has the range [0,1]. 0025 struct b2Color 0026 { 0027 b2Color() {} 0028 b2Color(float32 r, float32 g, float32 b, float32 a = 1.0f) : r(r), g(g), b(b), a(a) {} 0029 void Set(float32 ri, float32 gi, float32 bi, float32 ai = 1.0f) { r = ri; g = gi; b = bi; a = ai; } 0030 float32 r, g, b, a; 0031 }; 0032 0033 /// Implement and register this class with a b2World to provide debug drawing of physics 0034 /// entities in your game. 0035 class b2Draw 0036 { 0037 public: 0038 b2Draw(); 0039 0040 virtual ~b2Draw() {} 0041 0042 enum 0043 { 0044 e_shapeBit = 0x0001, ///< draw shapes 0045 e_jointBit = 0x0002, ///< draw joint connections 0046 e_aabbBit = 0x0004, ///< draw axis aligned bounding boxes 0047 e_pairBit = 0x0008, ///< draw broad-phase pairs 0048 e_centerOfMassBit = 0x0010 ///< draw center of mass frame 0049 }; 0050 0051 /// Set the drawing flags. 0052 void SetFlags(uint32 flags); 0053 0054 /// Get the drawing flags. 0055 uint32 GetFlags() const; 0056 0057 /// Append flags to the current flags. 0058 void AppendFlags(uint32 flags); 0059 0060 /// Clear flags from the current flags. 0061 void ClearFlags(uint32 flags); 0062 0063 /// Draw a closed polygon provided in CCW order. 0064 virtual void DrawPolygon(const b2Vec2* vertices, int32 vertexCount, const b2Color& color) = 0; 0065 0066 /// Draw a solid closed polygon provided in CCW order. 0067 virtual void DrawSolidPolygon(const b2Vec2* vertices, int32 vertexCount, const b2Color& color) = 0; 0068 0069 /// Draw a circle. 0070 virtual void DrawCircle(const b2Vec2& center, float32 radius, const b2Color& color) = 0; 0071 0072 /// Draw a solid circle. 0073 virtual void DrawSolidCircle(const b2Vec2& center, float32 radius, const b2Vec2& axis, const b2Color& color) = 0; 0074 0075 /// Draw a line segment. 0076 virtual void DrawSegment(const b2Vec2& p1, const b2Vec2& p2, const b2Color& color) = 0; 0077 0078 /// Draw a transform. Choose your own length scale. 0079 /// @param xf a transform. 0080 virtual void DrawTransform(const b2Transform& xf) = 0; 0081 0082 protected: 0083 uint32 m_drawFlags; 0084 }; 0085 0086 #endif