-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTetrisDlg.h
98 lines (86 loc) · 2.23 KB
/
TetrisDlg.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#pragma once
#include "block.h"
class CTetrisDlg : public CDialog
{
public:
CTetrisDlg(CWnd* pParent = NULL);
~CTetrisDlg();
enum
{
IDD = IDD_TETRIS_DIALOG,
ROW = 20,
COL = 10,
WIDTH = COL << 5,
HEIGHT = ROW << 5
};
protected:
BOOL PreTranslateMessage(MSG *pMsg);
protected:
HICON m_hIcon;
private:
CMenu m_menu;
CImage m_bk;
CImage m_block;
CImage m_window;
CImage m_gameover;
CDC m_memDC;
CBitmap m_memBmp;
CClientDC *m_pDC;
BYTE **m_board;
Block *m_pBlock;
BYTE m_level;
BYTE m_gameParam;
BYTE m_nextColor;
UINT m_lines;
UINT m_score;
BYTE m_mouseOver;
void Update();
void AdjustFrame();
void Initialize();
void RedrawBkgnd(RECT rect);
void DrawText(SHORT x1, SHORT y1, SHORT x2, SHORT y2,
CString &text, UINT format, COLORREF clr);
void SetFontSize(BYTE size);
void Play(MCIDEVICEID id);
void UpdateBlock();
void UpdateWindow();
void NextRandomBlock();
BYTE NextRandomColor();
Block *BlockFromIndex(BYTE i);
BOOL CheckLine(BYTE row);
void RemoveLine(BYTE row);
BOOL IsGameOver(BYTE blockType);
void GameOver();
public:
virtual BOOL OnInitDialog();
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg UINT OnGetDlgCode();
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg void OnTimer(UINT_PTR nIDEvent);
afx_msg void OnGameNew();
afx_msg void OnGamePause();
afx_msg void OnGameStop();
afx_msg void OnLevelBeginner();
afx_msg void OnLevelIntermediate();
afx_msg void OnLevelAdvanced();
afx_msg void OnLevelExpert();
afx_msg void OnLevelDevil();
afx_msg void OnLevelHell();
afx_msg void OnGameSound();
afx_msg void OnGameExit();
afx_msg void OnHelpAbout();
DECLARE_MESSAGE_MAP()
};
// CAboutDlg dialog
class CAboutDlg : public CDialog
{
public:
CAboutDlg(CWnd* pParent = NULL) : CDialog(CAboutDlg::IDD, pParent) {}
// Dialog Data
enum { IDD = IDD_ABOUTBOX };
};