b2Draw.h
Go to the documentation of this file.
00001 /*
00002 * Copyright (c) 2011 Erin Catto http://box2d.org
00003 *
00004 * This software is provided 'as-is', without any express or implied
00005 * warranty.  In no event will the authors be held liable for any damages
00006 * arising from the use of this software.
00007 * Permission is granted to anyone to use this software for any purpose,
00008 * including commercial applications, and to alter it and redistribute it
00009 * freely, subject to the following restrictions:
00010 * 1. The origin of this software must not be misrepresented; you must not
00011 * claim that you wrote the original software. If you use this software
00012 * in a product, an acknowledgment in the product documentation would be
00013 * appreciated but is not required.
00014 * 2. Altered source versions must be plainly marked as such, and must not be
00015 * misrepresented as being the original software.
00016 * 3. This notice may not be removed or altered from any source distribution.
00017 */
00018 
00019 #ifndef B2_DRAW_H
00020 #define B2_DRAW_H
00021 
00022 #include <Box2D/Common/b2Math.h>
00023 
00025 struct b2Color
00026 {
00027         b2Color() {}
00028         b2Color(float32 r, float32 g, float32 b, float32 a = 1.0f) : r(r), g(g), b(b), a(a) {}
00029         void Set(float32 ri, float32 gi, float32 bi, float32 ai = 1.0f) { r = ri; g = gi; b = bi; a = ai; }
00030         float32 r, g, b, a;
00031 };
00032 
00035 class b2Draw
00036 {
00037 public:
00038         b2Draw();
00039 
00040         virtual ~b2Draw() {}
00041 
00042         enum
00043         {
00044                 e_shapeBit                              = 0x0001,       
00045                 e_jointBit                              = 0x0002,       
00046                 e_aabbBit                               = 0x0004,       
00047                 e_pairBit                               = 0x0008,       
00048                 e_centerOfMassBit               = 0x0010        
00049         };
00050 
00052         void SetFlags(uint32 flags);
00053 
00055         uint32 GetFlags() const;
00056         
00058         void AppendFlags(uint32 flags);
00059 
00061         void ClearFlags(uint32 flags);
00062 
00064         virtual void DrawPolygon(const b2Vec2* vertices, int32 vertexCount, const b2Color& color) = 0;
00065 
00067         virtual void DrawSolidPolygon(const b2Vec2* vertices, int32 vertexCount, const b2Color& color) = 0;
00068 
00070         virtual void DrawCircle(const b2Vec2& center, float32 radius, const b2Color& color) = 0;
00071         
00073         virtual void DrawSolidCircle(const b2Vec2& center, float32 radius, const b2Vec2& axis, const b2Color& color) = 0;
00074         
00076         virtual void DrawSegment(const b2Vec2& p1, const b2Vec2& p2, const b2Color& color) = 0;
00077 
00080         virtual void DrawTransform(const b2Transform& xf) = 0;
00081 
00082 protected:
00083         uint32 m_drawFlags;
00084 };
00085 
00086 #endif


mvsim
Author(s):
autogenerated on Thu Sep 7 2017 09:27:47