?? hwrectview.h
字號:
// HWRECTView.h : interface of the CHWRECTView class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_HWRECTVIEW_H__8B080E4F_DF7E_11D2_A2DF_00A0248D3AC7__INCLUDED_)
#define AFX_HWRECTVIEW_H__8B080E4F_DF7E_11D2_A2DF_00A0248D3AC7__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// 宏變量:白色和黑色
#define WHITE RGB(255,255,255)
#define BLACK RGB(0,0,0)
#define BLUE RGB(0,0,255)
//下降,左移,右移宏定義
#define LEFT 0
#define RIGHT 1
#define UP 2
#define DOWN 3
class CHWRECTView : public CView
{
protected: // create from serialization only
CHWRECTView();
DECLARE_DYNCREATE(CHWRECTView)
// Attributes
public:
CHWRECTDoc* GetDocument();
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CHWRECTView)
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CHWRECTView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
//列與行的數量
int m_iCol;
int m_iRow;
//小方塊的大小,它會隨著行與列的不同而不同,具體為:
// 12行10列,30個象素的正方形
// 18行15列,20
// 24行20列,15
// 30行25列,12
int m_iLarge;
//當前的級別,換算成速度的算法為:1500 - m_iLevel*200
int m_iLevel;
//游戲區域左上角的坐標
int m_iStartX;
int m_iStartY;
void RectChange();
BOOL RightIsLimit();
BOOL LeftIsLimit();
//各種不同形狀方塊的接觸面,接觸面是指這樣的小方塊:它下面如果有另外的方塊則表示
//此方塊已到底。
//此數組記錄了這些接觸面在當前方塊動態位置數組中的元素號
int InterFace[74][4];
//當前的方塊形狀
int m_currentRect;
//判斷當前方塊是否到底
void ActiveIsBottom();
//當前方塊下降
void RectDown();
//當前方塊加速:UP,左移:LEFT,右移:RIGHT
void RectArrow(int m_Type);
//將一方塊初始樣式數據賦給當前方塊動態位置數組以及下一次將要出來的方塊的位置數組
void RectStatusToActiveStatus(int m_which);
void RectStatusToNextStatus(int m_which);
void ActiveStatusToGameStatus();
int Random(int MaxNumber);
//標識方塊已到底的變量,到底為TRUE
BOOL m_isBottom;
//用于標志方塊狀態的數組,大小由橫格與豎格數據決定,為1表示該方塊顯示,或者不顯示
//畫形狀只需要修改數組中相應元素的狀態值即可
//由時鐘控制,定時在OnPaint函數中根據數組畫方塊
int GameStatus[100][100];
//用于保存當前方塊的動態位置,4個小方塊分別在大數組中的位置
//存放位置為先左后右,每一列又遵循先上后下的原則
int ActiveStatus[4][2];
//存入下一次要出來的方塊的模樣的數組
int NextStatus[4][2];
// Generated message map functions
protected:
BOOL m_bGamePaush;
void StopMid();
void PlayMid();
void CurrentAreaAndLevel();
//用于記錄當前區域大小與當前級別的字符串,用于顯示在屏幕上提示用戶當前狀態
CString m_strArea;
CString m_strLevel;
//當前的樣式與下一個將會出現的樣式
int m_icurrentStatus;
int m_inextStatus;
//OnDraw中需要用到的設備名稱
CPen *whitePen;
CPen *blackPen;
CBrush *blueBrush,*grayBrush,*blackBrush;
//是否畫網格線
BOOL m_bDrawGrid;
//是否插放背景音樂
BOOL m_bMusic;
//游戲總成績
int m_iPerformance;
//游戲是否已結束,為FALSE表示開始,否則為結束
BOOL m_bGameEnd;
//刷新指定的區域,它的大小為:四個小方塊所在的正方形的大小
void InvalidateCurrent();
//{{AFX_MSG(CHWRECTView)
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnTimer(UINT nIDEvent);
afx_msg void OnGameStart();
afx_msg void OnGameEnd();
afx_msg void OnGameOption();
afx_msg void OnUpdateGameStart(CCmdUI* pCmdUI);
afx_msg void OnUpdateGameOption(CCmdUI* pCmdUI);
afx_msg void OnUpdateGameEnd(CCmdUI* pCmdUI);
afx_msg void OnUpdateGameExit(CCmdUI* pCmdUI);
afx_msg void OnUpdateHelpAbout(CCmdUI* pCmdUI);
afx_msg void OnUpdateHelpHelp(CCmdUI* pCmdUI);
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnHelpHelp();
afx_msg void OnUpdateOptionArea1(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionArea2(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionArea3(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionArea4(CCmdUI* pCmdUI);
afx_msg void OnOptionArea1();
afx_msg void OnOptionArea2();
afx_msg void OnOptionArea3();
afx_msg void OnOptionArea4();
afx_msg void OnUpdateOptionLevel1(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionLevel2(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionLevel3(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionLevel4(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionLevel5(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionLevel6(CCmdUI* pCmdUI);
afx_msg void OnOptionLevel1();
afx_msg void OnOptionLevel2();
afx_msg void OnOptionLevel3();
afx_msg void OnOptionLevel4();
afx_msg void OnOptionLevel5();
afx_msg void OnOptionLevel6();
afx_msg void OnUpdateOptionGrid(CCmdUI* pCmdUI);
afx_msg void OnOptionGrid();
afx_msg void OnUpdateOptionMusic(CCmdUI* pCmdUI);
afx_msg void OnOptionMusic();
afx_msg void OnUpdateGamePaush(CCmdUI* pCmdUI);
afx_msg void OnGamePaush();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#ifndef _DEBUG // debug version in HWRECTView.cpp
inline CHWRECTDoc* CHWRECTView::GetDocument()
{ return (CHWRECTDoc*)m_pDocument; }
#endif
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_HWRECTVIEW_H__8B080E4F_DF7E_11D2_A2DF_00A0248D3AC7__INCLUDED_)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -