-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphysics.h
40 lines (30 loc) · 896 Bytes
/
physics.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
#ifndef PHYSICS_H
#define PHYSICS_H
#include <iostream>
#include <vector>
#include "entities/cell.h"
#include "entities/joint.h"
class Cell;
class Joint;
class Physics {
public:
static const int max_cell_size = 16;
int xsize = 0, ysize = 0;
Vect gravity;
vector<Cell> cells;
vector<Joint> joints;
void (*collideCallback)(Cell&, Cell&);
Physics(int xsize, int ysize);
Physics(Physics *Physics);
Physics& operator=(const Physics &physics);
void setCollideCallback(void cb(Cell&, Cell&));
Cell* addCell(double x, double y, double mass);
Joint* addJoint(Cell *cell1, Cell *cell2, double size, double force);
vector< vector<Cell*> > sorted;
void collide(Cell &cell, Cell &cell2);
void collideRows(vector<Cell*> &up, vector<Cell*> &down);
void update();
size_t countCells();
size_t countJoints();
};
#endif // PHYSICS_H