-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShapeFactory.h
More file actions
42 lines (34 loc) · 952 Bytes
/
ShapeFactory.h
File metadata and controls
42 lines (34 loc) · 952 Bytes
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
#ifndef SHAPE_FACTORY_H
#define SHAPE_FACTORY_H
#include <Box2D/Box2D.h>
#include "Shape.h"
#include <random>
using namespace std;
class Game;
class Utility;
class Item;
class ShapeFactory
{
public:
ShapeFactory(Game* game);
~ShapeFactory(void);
template<class T>
b2Vec2* sfvec_to_b2vec(sf::Vector2<T> v);
//
Shape* createClientRectangle(b2Vec2* size, b2Vec2* position, bool dynamic, int id, uintptr_t collisionID);
Shape* createRectangle(b2Vec2* size, b2Vec2* position, bool dynamic,
float density = 1.0, float friction = 0.5, int groupIndex = 1);
Shape* createRandomShape(sf::Vector2i& viewoffset, bool dynamic = true, uintptr_t collisionID = 99);
Shape* createItem(b2Vec2* position, int id_ = -1);
void setGlobalID(int id_) {id = id_;};
//returns id++
int getGlobalID() {return id++;};
private:
Game* game;
mt19937 mersenneGen;
uniform_real_distribution<float> dist;
int minSize;
int id;
Utility* utility;
};
#endif