-
Notifications
You must be signed in to change notification settings - Fork 0
/
Ball.h
61 lines (55 loc) · 1.41 KB
/
Ball.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
52
53
54
55
56
57
58
59
60
61
// Ball.h: interface for the Ball class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_BALL_H__22AFA235_0E27_11DA_A17D_000103DD18CD__INCLUDED_)
#define AFX_BALL_H__22AFA235_0E27_11DA_A17D_000103DD18CD__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
typedef float ball_type;
typedef NO5TL::CVector<ball_type,2> Vector;
#define PI 3.141593f
#define EPSILON 0.1
class CBall
{
public:
Vector m_p;
Vector m_v;
Vector m_a;
Vector m_cue;
static LONG m_r;
bool m_gone;
static int m_friction; // %
static int m_wall_friction; // %
int m_id;
bool m_drawcue;
bool m_ghost;
Vector m_v1_ghost, m_v2_ghost;
bool m_bDrawGhostVel;
private:
CRect m_box; // ( x1,y1,x2,y2)
CBitmap m_bmp;
CBitmap m_bmpMask;
HWND m_hWnd;
public:
CBall();
virtual ~CBall();
void SetBox(const CRect &r);
bool Bounce(void);
void Move(UINT dt);
void create(int id,COLORREF clr,HWND hWnd);
void draw(HDC hdc);
void erase(HDC hdc);
void GetRect(CRect &r) const;
bool is_shock(const CBall &b2) const;
void do_shock(CBall &b2);
void draw_arrow(HDC hdc,bool bErase);
void draw_cue(HDC hdc, int angle);
bool is_point_over(ball_type x, ball_type y) const;
void unoverllap(CBall& other);
CBall& operator=(const CBall& rhs);
bool will_hit(CBall& rhs);
void draw_ghost_vel(HDC hdc);
};
extern CBall g_ghost;
#endif // !defined(AFX_BALL_H__22AFA235_0E27_11DA_A17D_000103DD18CD__INCLUDED_)