-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rope.h
44 lines (31 loc) · 786 Bytes
/
Rope.h
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
/*
* Rope.h
*
*/
#ifndef ROPE_H_
#define ROPE_H_
#include "IDrawable.h"
#include "ContactListener.h"
#include "Sprite.h"
#include <SFML/Graphics.hpp>
#include <Box2D/Box2D.h>
#include <vector>
//A non interactive game block
class Rope: public IDrawable, public UserData {
public:
Rope(b2World& aWorld, float aX, float aY);
virtual ~Rope();
void Draw(sf::RenderTarget& aTarget, float aXScale, float aYScale,
float aXTranslate, float aYTranslate);
void Update();
void MoveJoint(b2Joint* joint, float aDeltaY);
protected:
void BeginContact(b2Contact* contact);
void PreSolve(b2Contact* contact, const b2Manifold* oldManifold);
private:
std::vector<b2Body*> myParts;
std::vector<b2RevoluteJoint*> myJoints;
Sprite mySprite;
b2World& myWorld;
};
#endif ROPE_H_