Gamedev Framework (gf)  0.12.0
A C++14 framework for 2D games
Public Member Functions | List of all members
gf::PolygonGeometry Class Reference

A polygon physics geometry. More...

#include <gf/PhysicsGeometry.h>

Inheritance diagram for gf::PolygonGeometry:
Inheritance graph
[legend]

Public Member Functions

 PolygonGeometry (Polygon polygon)
 Constructor. More...
 
 PolygonGeometry (Vector2f size)
 Constructor. More...
 
 PolygonGeometry (RectF rectangle)
 Constructor. More...
 
const Polygon & get () const
 Get the polygon. More...
 
virtual float getArea () const override
 Compute the area of the geometry. More...
 
virtual CircF getBoundingCircle () const override
 Get a bouding circle. More...
 
virtual void renderAt (RenderTarget &target, const RenderStates &states, Vector2f position, float angle) const override
 Render the geometry. More...
 
- Public Member Functions inherited from gf::PhysicsGeometry
 PhysicsGeometry (Type type)
 Constructor. More...
 
virtual ~PhysicsGeometry ()
 Destructor. More...
 
Type getType () const
 Get the type of the geometry. More...
 

Additional Inherited Members

- Public Types inherited from gf::PhysicsGeometry
enum  Type {
  Type::Circle,
  Type::Polygon
}
 The type of geometry. More...
 

Detailed Description

A polygon physics geometry.

This geometry includes rectangles.

Constructor & Destructor Documentation

◆ PolygonGeometry() [1/3]

gf::PolygonGeometry::PolygonGeometry ( Polygon  polygon)

Constructor.

Parameters
polygonThe base polygon

◆ PolygonGeometry() [2/3]

gf::PolygonGeometry::PolygonGeometry ( Vector2f  size)

Constructor.

The geometry is centered in \( (0,0) \)

Parameters
sizeThe size of the rectangle

◆ PolygonGeometry() [3/3]

gf::PolygonGeometry::PolygonGeometry ( RectF  rectangle)

Constructor.

Parameters
rectangleThe base rectangle

Member Function Documentation

◆ get()

const Polygon& gf::PolygonGeometry::get ( ) const

Get the polygon.

Returns
The current polygon

◆ getArea()

virtual float gf::PolygonGeometry::getArea ( ) const
overridevirtual

Compute the area of the geometry.

Returns
The area in world units

Implements gf::PhysicsGeometry.

◆ getBoundingCircle()

virtual CircF gf::PolygonGeometry::getBoundingCircle ( ) const
overridevirtual

Get a bouding circle.

The circle may not be the minimum bouding circle.

Returns
A bounding circle

Implements gf::PhysicsGeometry.

◆ renderAt()

virtual void gf::PolygonGeometry::renderAt ( RenderTarget &  target,
const RenderStates &  states,
Vector2f  position,
float  angle 
) const
overridevirtual

Render the geometry.

Parameters
targetThe render target
statesThe render states to use for drawing
positionThe position of the geometry
angleThe angle of the geometry

Implements gf::PhysicsGeometry.