-
Notifications
You must be signed in to change notification settings - Fork 0
/
Environment.h
51 lines (38 loc) · 1.18 KB
/
Environment.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
45
46
47
48
49
50
51
#ifndef ENVIRONMENT_H
#define ENVIRONMENT_H
#include <memory>
#include <vector>
using namespace std;
class b2World;
class b2Body;
struct b2Vec2;
namespace sf {
class RenderTarget;
class Drawable;
class View;
}
typedef struct {
shared_ptr<sf::Drawable> graphic;
shared_ptr<b2Body> body;
} PhysicsObject;
class Environment {
public:
Environment();
~Environment() {};
void Step(float frameTime);
void Render(sf::RenderTarget &target, int renderWidth, int renderHeight);
shared_ptr<PhysicsObject> CreateBox(float width,
float height,
float x,
float y,
bool dynamic);
shared_ptr<b2World> GetWorld();
static b2Vec2 ScreenToWorldPosition(b2Vec2 vec);
static b2Vec2 WorldToScreenPosition(b2Vec2 vec);
static b2Vec2 ScreenToWorldSize(b2Vec2 vec);
static b2Vec2 WorldToScreenSize(b2Vec2 vec);
protected:
shared_ptr<b2World> world;
vector<shared_ptr<PhysicsObject>> objects;
};
#endif // ENVIRONMENT_H