JUCE  v6.1.6 (6.0.8-1114)
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce::Box2DRenderer Class Reference

A simple implementation of the b2Draw class, used to draw a Box2D world. More...

#include <juce_Box2DRenderer.h>

Inheritance diagram for juce::Box2DRenderer:
Collaboration diagram for juce::Box2DRenderer:

Public Member Functions

 Box2DRenderer () noexcept
 
void DrawCircle (const b2Vec2 &center, float32 radius, const b2Color &) override
 
void DrawPolygon (const b2Vec2 *, int32, const b2Color &) override
 
void DrawSegment (const b2Vec2 &p1, const b2Vec2 &p2, const b2Color &) override
 
void DrawSolidCircle (const b2Vec2 &center, float32 radius, const b2Vec2 &axis, const b2Color &) override
 
void DrawSolidPolygon (const b2Vec2 *, int32, const b2Color &) override
 
void DrawTransform (const b2Transform &xf) override
 
virtual Colour getColour (const b2Color &) const
 Converts a b2Color to a juce Colour. More...
 
virtual float getLineThickness () const
 Returns the thickness to use for drawing outlines. More...
 
void render (Graphics &g, b2World &world, float box2DWorldLeft, float box2DWorldTop, float box2DWorldRight, float box2DWorldBottom, const Rectangle< float > &targetArea)
 Renders the world. More...
 

Protected Attributes

Graphicsgraphics
 

Detailed Description

A simple implementation of the b2Draw class, used to draw a Box2D world.

To use it, simply create an instance of this class in your paint() method, and call its render() method.

@tags{Box2D}

Constructor & Destructor Documentation

◆ Box2DRenderer()

juce::Box2DRenderer::Box2DRenderer ( )
noexcept

Member Function Documentation

◆ DrawCircle()

void juce::Box2DRenderer::DrawCircle ( const b2Vec2 &  center,
float32  radius,
const b2Color &   
)
override

◆ DrawPolygon()

void juce::Box2DRenderer::DrawPolygon ( const b2Vec2 *  ,
int32  ,
const b2Color &   
)
override

◆ DrawSegment()

void juce::Box2DRenderer::DrawSegment ( const b2Vec2 &  p1,
const b2Vec2 &  p2,
const b2Color &   
)
override

◆ DrawSolidCircle()

void juce::Box2DRenderer::DrawSolidCircle ( const b2Vec2 &  center,
float32  radius,
const b2Vec2 &  axis,
const b2Color &   
)
override

◆ DrawSolidPolygon()

void juce::Box2DRenderer::DrawSolidPolygon ( const b2Vec2 *  ,
int32  ,
const b2Color &   
)
override

◆ DrawTransform()

void juce::Box2DRenderer::DrawTransform ( const b2Transform &  xf)
override

◆ getColour()

virtual Colour juce::Box2DRenderer::getColour ( const b2Color &  ) const
virtual

Converts a b2Color to a juce Colour.

◆ getLineThickness()

virtual float juce::Box2DRenderer::getLineThickness ( ) const
virtual

Returns the thickness to use for drawing outlines.

◆ render()

void juce::Box2DRenderer::render ( Graphics g,
b2World &  world,
float  box2DWorldLeft,
float  box2DWorldTop,
float  box2DWorldRight,
float  box2DWorldBottom,
const Rectangle< float > &  targetArea 
)

Renders the world.

Parameters
gthe context to render into
worldthe world to render
box2DWorldLeftthe left coordinate of the area of the world to be drawn
box2DWorldTopthe top coordinate of the area of the world to be drawn
box2DWorldRightthe right coordinate of the area of the world to be drawn
box2DWorldBottomthe bottom coordinate of the area of the world to be drawn
targetAreathe area within the target context onto which the source world rectangle should be mapped

Member Data Documentation

◆ graphics

Graphics* juce::Box2DRenderer::graphics
protected

The documentation for this class was generated from the following file: