-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCollisionSystem.h
37 lines (30 loc) · 1015 Bytes
/
CollisionSystem.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
/*************************************************************************
*
* Simulates N particles and their motion according to the laws
* of elastic collisions.
*
*************************************************************************/
#ifndef COLLISIONSYSTEM_H
#define COLLISIONSYSTEM_H
#include "SDL/SDL.h"
#include "MinPQ.h"
#include "Event.h"
#include "Particle.h"
class CollisionSystem
{
public:
CollisionSystem(vector<Particle>, SDL_Surface*);
void simulate(double);
private:
MinPQ<Event> pq; // the priority queue
double t; // simulation clock time
double hz; // number of redraw events per clock tick
vector<Particle> particles; // the array of particles
SDL_Surface* screen; // main screen used for rendering
SDL_Event ioevents; // SDL event queue
bool quit; // quit flag, program exits when tru
void predict(Particle*, double);
void redraw(double);
void handleIOEvents();
};
#endif