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

📄 bwchessdlg.h

📁 这是我用vc编写的一个黑白棋网络游戏的使用程序
💻 H
字号:
// BWChessDlg.h : header file
//

#if !defined(AFX_BWChessDlg_H__9A01CC68_D589_11D1_92B0_000021003EA5__INCLUDED_)
#define AFX_BWChessDlg_H__9A01CC68_D589_11D1_92B0_000021003EA5__INCLUDED_

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

/////////////////////////////////////////////////////////////////////////////
// CBWChessDlg dialog
//本程序的主界面
#include "Undo.h"	// Added by ClassView
#include "DigitalPlayer.h"	// Added by ClassView
#include "stack.h"	// Added by ClassView
#define NUM	8//棋盘的大小

class CBWChessDlg : public CDialog//CBWChessDlg 是基于对话框的主界面
{
// Construction
public:
	CBWChessDlg(CWnd* pParent = NULL);	// standard constructor
	~CBWChessDlg();
	friend UINT CCplayFunc(LPVOID p);
	friend UINT ReceiveFunc(int kk);
// Dialog Data
	//{{AFX_DATA(CBWChessDlg)
	enum { IDD = IDD_BWCHESS_DIALOG };//IDD_BWCHESS_DIALOG为界面对话框的ID
	//以下6个为界面上的六个控件
	CStatic	 m_Time0;
	CStatic	 m_Info;
	CListBox m_ListInfo;
	CStatic	 m_Wnum;
	CStatic	 m_Time;
	CStatic	 m_Bnum;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CBWChessDlg)
	public:
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	void	ComputerPlay(int flag);
	void	DrawFrame(CDC *dc);
	void	SetChessTitle();
	void	RemoveStringFromList();
	void	AddStringToList(int x,int y, int color,int win=0);
	void	PutStone(BYTE, const CPoint &, CDC *);
	void	Ring(int m_nType);
	int		Distance(const CPoint &pt1, const CPoint &pt2);
	BOOL	IsStonePoint(CPoint& ptStone);
	BOOL	PointToStonePos(const CPoint &pt, CPoint& ptStone);
	void	InitParams();
	void	MoveCursor(int x, int y);
	void	Place(int *x,int *y,int color);
	void	duplicate();
	void	ShowNumber(int isTime=0);
	int		IsInPanel(CPoint &pt);
	void	Calcu_BW();
	int		ToEnd(int x,int y,int flag);
	int		Walk1(int *x1,int *y1,int flag);
	int		Check(int x,int y);
	int		IsEnd(int whogo);
	int		BtoW(int x1,int y1,int flag);
	int     Senddata(int x, int y,int command);
	void    Newchess(int ptBest_x,int ptBest_y);
protected:
	int				m_DemoOrReplay;//1 for demo, 0 for replay
	int				m_nIsContinueReplay;
	int				m_HintTime0;
	int				m_HintTime1;
	HACCEL			hAccelerator;
	HICON			m_hIcon;
	int			kernel[NUM][NUM];	//0 for none,1 for white,2 for black
	int			m_wXNull;
	int			m_wYNull;
	int				m_byColor;       
	BOOL			m_bSoundOn;
	CRect			m_Client;
	CMenu *			m_pMenu;
	CPoint			m_CurPt;
	WORD			m_wStoneWidth;
	WORD			m_wStoneHeight;
	int			m_wFrameWidth;
	int			m_wFrameHeight;
	stack			ListInfo;
	stack			m_PointGo;
	int				m_PeekOnce;
	int				m_IsGameStart;
	int				x1, y1, x2, y2;//used for Hint
	int				m_HintOnce;
	int				m_TimerOn;
	CWinThread *	m_CcThread;
	int				m_PaintNum;
	CDigitalPlayer	WCount;
	CDigitalPlayer	BCount;
	CDigitalPlayer	TimeCount;
	CDigitalPlayer	TimeCount0;
	CUndo			m_UndoPoint;
	long			m_PassedTime;
	long			m_PassedTime0;
	int				m_Skip;
	stack			wsp;
	stack			bsp;
	int				num_black;
	int				num_white;
    //CSocket socket;//客户
    //CSocket hostsocket;//主机
    //CSocketFile *sockfile;
    //CArchive *rcv;
    //CArchive *xmit;
	// Generated message map functions
	//{{AFX_MSG(CBWChessDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnPaint();
	afx_msg void OnLButtonDown(UINT, CPoint);	
	afx_msg void OnNew();
	afx_msg void OnExit();
	afx_msg void OnAbout();
	afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnPaletteChanged(CWnd* pFocusWnd);
	afx_msg BOOL OnQueryNewPalette();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnUndo();
	afx_msg void OnHowto();
	afx_msg void OnBest();
	afx_msg void OnHint();
	afx_msg void OnCanplace();
	afx_msg void OnSetting();
	afx_msg void OnOpen();
	afx_msg void OnSave();
	afx_msg void OnSaveinfo();
	afx_msg void OnDemo();
	afx_msg void OnReplay();
	afx_msg void OnConnect();
	afx_msg void OnHost();
	afx_msg void OnUnlink();
	//}}AFX_MSG
	afx_msg void OnListDoubleClicked();
	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_BWChessDlg_H__9A01CC68_D589_11D1_92B0_000021003EA5__INCLUDED_)

⌨️ 快捷键说明

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