⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stone.h

📁 VC面向对象的学习教程
💻 H
字号:
// Stone.h: interface for the CStone class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_STONE_H__B89BCCAA_0EFB_485E_AA15_241A383AAAD3__INCLUDED_)
#define AFX_STONE_H__B89BCCAA_0EFB_485E_AA15_241A383AAAD3__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

// 棋子类
// 定义棋子名称
#include "plate.h"
#define		BING		1
#define		PAO		2
#define		JU		3
#define		MA		4
#define		XIANG	5
#define		SHI		6
#define		JIANG		7
class CStone	
{
	BOOL	m_bRed;			// 是否红方
	BOOL	m_bSelected;			// 是否被选择
	int	m_nCol;			// 路
	int	m_nRow;			// 行
	CRect	m_rectStone;			// 棋子包含矩形
	BOOL	m_bShow;			// 是否显示
	CString	m_sName;			// 棋子名称
	int		m_nR;			// 棋子半径
	int		m_nType;		// 棋子类型
public:
	CStone(){}
	CStone(BOOL red, int col, int row, LPCSTR name, int type, CPlate &plate);
	void	ShowStone(CDC *pDC);
	void	MoveTo(int col, int row, CPlate &plate);
	CRect	GetRect(){return m_rectStone;}
	int		GetType(){return m_nType;}
	BOOL	BeKilled(int col, int row)
	{return m_bShow && m_nCol==col && m_nRow == row;}
	BOOL	MouseOnStone(CPoint point)
	{return m_rectStone.PtInRect(point) && m_bShow;}
	void	KillIt(){m_bShow = FALSE;}
	void	SelectStone(){m_bSelected = !m_bSelected;}
};

#endif // !defined(AFX_STONE_H__B89BCCAA_0EFB_485E_AA15_241A383AAAD3__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -