The Wall class represents a physical object that is immovable during simulation. More...
#include <wall.h>
Public Member Functions | |
Wall (b2World *world, QList< QList< QPointF > > hulls, QPointF position=QPointF(0, 0), float angle=0) | |
Constructor creating a Wall object based on a number of parameters. More... | |
~Wall () | |
QRectF | boundingRect () const |
boundingRect returns the computed bounding rectangle used for drawing and redrawing the object. From the QGraphicsItem abstract base class. More... | |
void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) |
paint Draws the wall for display. From the QGraphicsItem abstract base class. More... | |
b2Body * | body () const |
Simple getter for _body field. From the PhysicalObject interface class. More... | |
QGraphicsItem * | item () const |
Simple getter for returning QGraphicsItem connected to this object. From the PhysicalObject interface class. More... | |
![]() | |
PhysicalObject () | |
virtual | ~PhysicalObject () |
virtual void | step (float dt) |
Called by World on all PhysicalObjects in the simulation so they can implement any custom physics. More... | |
virtual void | stepGraphics () |
stepGraphics More... | |
Private Member Functions | |
void | ComputeBoundingRect () |
Private Attributes | |
b2Body * | _body |
QRectF | _boundingRect |
Friends | |
PhysicalObject * | wallFactory (World *world, const QJsonObject &obj) |
chirpFactory follows the PhysicalObject FactoryFunction, creating the Wall object from a QJsonObject. More... | |
The Wall class represents a physical object that is immovable during simulation.
The Wall class represents a physical object that is immovable during simulation. It is perfect for creating an obstacle that cannot be moved.
The immovable wall object in simulation:
|
explicit |
Constructor creating a Wall object based on a number of parameters.
world | World for the pushable object to be created in. |
hulls | List of hulls forming the shape of the object. Each hull forms a separate collision mesh, allowing simulation of a concave hull through making them a series of convex hulls. |
position | Starting position of the pushable object. |
angle | Starting angle of the pushable object. |
Creates a physical model of the wall object with Box2D and sets up the drawing of the object.
References _body, ComputeBoundingRect(), DEGTORAD, and QPointFTob2Vec2().
Wall::~Wall | ( | ) |
|
inlinevirtual |
Simple getter for _body field. From the PhysicalObject interface class.
Implements PhysicalObject.
References _body.
QRectF Wall::boundingRect | ( | ) | const |
boundingRect returns the computed bounding rectangle used for drawing and redrawing the object. From the QGraphicsItem abstract base class.
References _boundingRect.
|
private |
References _body, and _boundingRect.
Referenced by Wall().
|
inlinevirtual |
Simple getter for returning QGraphicsItem connected to this object. From the PhysicalObject interface class.
Implements PhysicalObject.
void Wall::paint | ( | QPainter * | painter, |
const QStyleOptionGraphicsItem * | option, | ||
QWidget * | widget | ||
) |
paint Draws the wall for display. From the QGraphicsItem abstract base class.
References _body, and genericPaint().
|
friend |
chirpFactory follows the PhysicalObject FactoryFunction, creating the Wall object from a QJsonObject.
world | World to put the physical object model in. |
obj | JsonObject containing the parameters for the object. |
|
private |
Referenced by body(), ComputeBoundingRect(), paint(), and Wall().
|
private |
Referenced by boundingRect(), and ComputeBoundingRect().