fiveplusdlg.h
来自「该程序功能:用JAVa实现的彩色五珠棋小游戏」· C头文件 代码 · 共 170 行
H
170 行
// FivePlusDlg.h : header file
/*
author Bob Wang
version 1.0
The main dialog of Five Sharp,imitate FivePlus,http://www.lobstersoft.com.
*/
#if !defined(AFX_FIVEPLUSDLG_H__93322F9F_68CD_45C8_B3C2_94CF419D76F0__INCLUDED_)
#define AFX_FIVEPLUSDLG_H__93322F9F_68CD_45C8_B3C2_94CF419D76F0__INCLUDED_
#include "FivePlusGameModel.h" // Added by ClassView
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define GRID_WIDTH 38 //The width of a chessman, by pixel.
#define GRID_HEIGHT 38 //The height of a chessman, by pixel.
#define NEXT_GRID_LEFT 236 //The left of the new generated chessman area.
#define NEXT_GRID_TOP 4 //The top of the new generated chessman area.
#define PLAY_AREA_TOP 50 //The top of the game area.
/*When you select a chessman, the chessman will show gradually and disappear
gradually, this value is the minest alpha of the chessman.*/
#define MIN_ALPHA 0
/*Max alpha of the chessman*/
#define MAX_ALPHA 255
/*Changing step*/
#define CHANGE_STEP 8
enum TimerEvent{
FLASH_SELECT,
MOVE_SELECT,
DISAPPEAR,
SHOWING
};
class CFivePlusDlgAutoProxy;
/////////////////////////////////////////////////////////////////////////////
// CFivePlusDlg dialog
class CFivePlusDlg : public CDialog
{
DECLARE_DYNAMIC(CFivePlusDlg);
friend class CFivePlusDlgAutoProxy;
// Construction
public:
// CPoint* m_pptInvalid;
CFivePlusDlg(CWnd* pParent = NULL); // standard constructor
virtual ~CFivePlusDlg();
// Dialog Data
//{{AFX_DATA(CFivePlusDlg)
enum { IDD = IDD_FIVEPLUS_DIALOG };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CFivePlusDlg)
public:
/*Override this method for add an accelerator*/
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
CFivePlusDlgAutoProxy* m_pAutoProxy;
HICON m_hIcon;
BOOL CanExit();
// Generated message map functions
//{{AFX_MSG(CFivePlusDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnClose();
virtual void OnOK();
virtual void OnCancel();
afx_msg void OnGameNew();
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnTimer(UINT nIDEvent);
afx_msg void OnDestroy();
afx_msg void OnAboutbox();
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnGameScore();
afx_msg void OnHelpHowToPlay();
afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
afx_msg void OnToolSetting();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
void DrawInvalid();
void FlashShow();
void BeginDisappear();
void FlashDisappear();
POSITION m_posCurMove;
CRect m_rectScore;
CPoint m_ptMoveTo;
CPoint m_ptCurMove;
void FlashMove();
void FlashSelect();
/*One chessman bitmap.*/
CBitmap m_bmpOneGrid;
/*One chessman dc.*/
CDC m_dcOneGrid;
/*The blendfunction of the selected chessman.*/
BLENDFUNCTION m_bfSelect;
/*The blendfunction of the disappear chessman.*/
BLENDFUNCTION m_bfDisappear;
/*The accelerator of this game*/
HACCEL m_hAccel;
/*The selected chessman change step,
positive for gradually show,
negative for gradually disappear.*/
int m_nDirection;
/*The alpha value of the current selected chessman.*/
int m_nBlendSelect;
/*The alpha value of the disappearing chessman.*/
int m_nBlendDisappear;
/*The event of the selected chessman changing appearance.*/
UINT m_nTimerSelected;
/*The moving chessman event.*/
UINT m_nTimerMoving;
/*The disappearing chessman.*/
UINT m_nTimerDisappear;
/*The showing chessman.*/
UINT m_nTimerShow;
/*calculate the new score and draw it.*/
void DrawScore(CDC* dc);
/*Invalidate the invalid grid of the game model.*/
BOOL InvalidateGrid();
/*If bDirection equals to TRUE, then Map the point from client
coord to the chessman position of horiental and vertical, else reverse.
*/
CPoint MapCoord(CPoint point, BOOL bDirection = TRUE);
/*The play game area RECT*/
CRect m_rectPlayArea;
/*The new generated chessman show area.*/
CRect m_rectNextBalls;
/*The chessman source bitmap.*/
CBitmap m_bmpGrid;
/*The chessman source dc.*/
CDC m_dcGrid;
/*The score number source bitmap.*/
CBitmap m_bmpNumber;
/*The score number source dc.*/
CDC m_dcNumber;
/*If the selected chessman is moving.*/
BOOL m_bIsMoving;
/*If the chessman is diappearing*/
BOOL m_bIsDisappearing;
BOOL DrawNextBalls(CDC* dc);
BOOL DrawGrid(CDC* dc);
CFivePlusGameModel m_gameModel;
CBitmap m_bmpBK;
CDC m_dcBK;
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_FIVEPLUSDLG_H__93322F9F_68CD_45C8_B3C2_94CF419D76F0__INCLUDED_)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?