forked from vanderlin/ofxBox2d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathofxBox2dRect.h
52 lines (26 loc) · 995 Bytes
/
ofxBox2dRect.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
#pragma once
#include "ofMain.h"
#include "ofxBox2dBaseShape.h"
// It would be nice to use ofRectangle but it is top/left and
// box2d needs a center rectangle.
class ofxBox2dRect : public ofxBox2dBaseShape {
private:
float width, height;
public:
ofVboMesh mesh;
//------------------------------------------------
ofxBox2dRect();
//------------------------------------------------
void setup(b2World * b2dworld, ofRectangle rec);
void setup(b2World * b2dworld, float x, float y, float w, float h);
//------------------------------------------------
float getWidth() { return width * 2; }
float getHeight() { return height * 2; }
void updateMesh();
void draw();
//------------------------------------------------
void addAttractionPoint(float fx, float fy, float amt);
void addAttractionPoint(ofVec2f pt, float amt);
void addRepulsionForce(float fx, float fy, float amt);
void addRepulsionForce(ofVec2f pt, float amt);
};