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

📄 testdlg.h

📁 简单实现了A*寻路算法
💻 H
字号:
// testDlg.h : header file
//
#include "Cell.h"
#if !defined(AFX_TESTDLG_H__E9ED0CD1_2F92_45C5_8025_CFF9580EAE2C__INCLUDED_)
#define AFX_TESTDLG_H__E9ED0CD1_2F92_45C5_8025_CFF9580EAE2C__INCLUDED_

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

#define ny 19
#define nx 14

/////////////////////////////////////////////////////////////////////////////
// CTestDlg dialog

class CTestDlg : public CDialog
{
// Construction
public:
	int m_nCheck;
	int m_nAdd;
	int m_nCount;
	//int m_sEnd;
	//int m_sStart;
	BOOL WalkAble(int x,int y,int i);
	void InitBoard();
	void DrawPath();
	CPtrList m_ListOpen,m_ListClose;
	int ComputeG(CCell &cellA,CCell &cellB);
	void ClearList();
	CCell * m_pcellCur,m_cellStart,*m_pEnd;
	int m_nyDest;
	int m_nxDest;
	int GetH(int xdest,int ydest,int xorgin,int yorgin);
	void GetMinF(CPtrList *list,POSITION &pos);
	void InList(CPtrList &list,int x,int y,POSITION &pos);
	void FindPath();
	void GenNodes(CCell &center);
	void DrawArrow();
	int pty;
	void InitDC(int nType);
	void DrawChess();
	int px1,py1;
	void DrawBK(int nXOD,int nYOD,int nWidth,int nHeight,int nXOS,int nYOS);
	void DrawBmp();
	void TransparentBlt( HDC hdcDest,      // 目标DC
					int nXOriginDest,   // 目标X偏移
					int nYOriginDest,   // 目标Y偏移
					int nWidthDest,     // 目标宽度
					int nHeightDest,    // 目标高度
					HDC hdcSrc,         // 源DC
					int nXOriginSrc,    // 源X起点
					int nYOriginSrc,    // 源Y起点
					int nWidthSrc,      // 源宽度
					int nHeightSrc,     // 源高度
					UINT crTransparent  // 透明色,COLORREF类型
					);
	CTestDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	//{{AFX_DATA(CTestDlg)
	enum { IDD = IDD_TEST_DIALOG };
		// NOTE: the ClassWizard will add data members here
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CTestDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	//{{AFX_MSG(CTestDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnClose();
	afx_msg void OnBtnFind();
	afx_msg void OnBtnShow();
	afx_msg void OnBtnInit();	
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);	
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
private:
	BOOL m_bStop,m_bFind;
		
	BOOL m_bMove,m_bStart;
	BOOL m_bChange;
	CBitmap m_bmpBoard,m_bmpQZ;
	CDC compdc;
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_TESTDLG_H__E9ED0CD1_2F92_45C5_8025_CFF9580EAE2C__INCLUDED_)

⌨️ 快捷键说明

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