-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBouncingShapeDynamics.hpp
59 lines (47 loc) · 1.28 KB
/
BouncingShapeDynamics.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef _BOUNCINGSHAPEDYNAMICS_HPP
#define _BOUNCINGSHAPEDYNAMICS_HPP
/** @file */
/**
* @addtogroup demos_iShapes
*/
/** @{*/
#include <dds/dds.hpp>
#include <ShapeDynamics.hpp>
#include <QtCore/QRect>
// -- Shaped Include
#include <topic-traits.hpp>
#include <ishape.h>
using namespace ShapeTypeDemo;
namespace demo { namespace ishapes {
class BouncingShapeDynamics : public ShapeDynamics
{
public:
BouncingShapeDynamics(int x0, int y0,
const QRect& shapeBounds,
const QRect& constraints,
float speed,
float angle,
const ShapeType& shape,
dds::pub::DataWriter<ShapeType> shapeWriter);
virtual ~BouncingShapeDynamics();
public:
virtual void simulate();
public:
typedef ::dds::core::smart_ptr_traits<BouncingShapeDynamics>::ref_type ref_type;
private:
BouncingShapeDynamics(const BouncingShapeDynamics& orig);
BouncingShapeDynamics& operator=(const BouncingShapeDynamics&);
private:
bool flip();
private:
QRect shapeBounds_;
float alpha_;
float angle_;
float speed_;
ShapeType shape_;
dds::pub::DataWriter<ShapeType> shapeWriter_;
};
}
}
/** @}*/
#endif /* _BOUNCINGSHAPEDYNAMICS_HPP */