ChirpSim
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Friends
Macros
include
PhysicalObjects
pushableobject.h
Go to the documentation of this file.
1
#ifndef PUSHABLEOBJECT_H
2
#define PUSHABLEOBJECT_H
3
4
#include <QJsonObject>
5
#include <QGraphicsItem>
6
#include <QRectF>
7
#include <QPainter>
8
#include <Box2D/Box2D.h>
9
10
#include "
physicalobject.h
"
11
#include "
world.h
"
12
13
class
PushableObject
;
14
21
PhysicalObject
*
pushableObjectFactory
(
World
*world,
const
QJsonObject &obj);
22
32
class
PushableObject
:
public
PhysicalObject
,
public
QGraphicsItem
33
{
34
public
:
46
explicit
PushableObject
(b2World *world, QList< QList< QPointF > > hulls,
float
density, QPointF position,
float
angle);
47
~PushableObject
();
48
53
QRectF
boundingRect
()
const
;
54
58
void
paint
(QPainter *painter,
const
QStyleOptionGraphicsItem *option, QWidget *widget);
59
64
b2Body *
body
()
const
{
return
_body
; }
65
70
QGraphicsItem *
item
()
const
{
return
const_cast<
PushableObject
*
>
(
this
); }
71
76
void
step
(
float
dt);
77
81
void
stepGraphics
();
82
private
:
83
friend
PhysicalObject
*
pushableObjectFactory
(
World
*world,
const
QJsonObject &obj);
84
void
ComputeBoundingRect
();
85
86
void
applyFriction
();
87
private
:
88
b2Body*
_body
;
89
90
QRectF
_boundingRect
;
91
92
};
93
94
#endif // PUSHABLEOBJECT_H
Generated on Tue Jun 18 2013 18:44:13 for ChirpSim by
1.8.4