-
Notifications
You must be signed in to change notification settings - Fork 1
/
ball.hpp
38 lines (26 loc) · 936 Bytes
/
ball.hpp
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
#ifndef BALL_HPP
#define BALL_HPP
#include <irrlicht.h>
using namespace irr;
using namespace core;
class Racket;
class Ball
{
private:
double m_radius;
vector3df m_position;
vector3df m_velocity;
vector3df m_hmap_size;
bool handleRacketCollision(Racket* racket);
bool handleCollision (Racket* back_racket, Racket* front_racket);
public:
Ball(vector3df pos, double radius, vector3df hmap_size);
void setPosition(const vector3df& pos) { m_position = pos; }
void setVelocity(const vector3df& vel) { m_velocity = vel; }
const vector3df& getPosition() const { return m_position; }
vector2df calculatePath(Racket* back_racket,
Racket* front_racket,
int dir = 1);
bool animate(int dt, Racket* back_racket, Racket* front_racket);
};
#endif