📄 snakewnd.h
字号:
#if !defined(AFX_SNAKEWND_H__4C805A34_BFA9_4A63_9824_6C8FBE8EFFEE__INCLUDED_)
#define AFX_SNAKEWND_H__4C805A34_BFA9_4A63_9824_6C8FBE8EFFEE__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// SnakeWnd.h : header file
//
#include "Afxtempl.h"
#define BLOCKHEIGHT 4
#define BLOCKWIDTH 4
/////////////////////////////////////////////////////////////////////////////
// CSnakeWnd window
typedef struct {
CRect rect;
BOOL Ishoriz;
}SNAKEBLOCK;
class CSnakeWnd : public CWnd
{
// Construction
public:
CSnakeWnd();
CList <SNAKEBLOCK*,SNAKEBLOCK*> m_SnakeList;
int m_ndirection;//1:左2:上3:右4:下
int m_nLastDriction;//1:左2:上3:右4:下
CRect rectWnd;//窗体大小
CPoint m_RandPos;//设要吃掉的食物位置
int m_ms;
BOOL m_IsAnto;
// Attributes
public:
CPoint GetPointInSHow();
BOOL IsInSnake(CPoint pt);
BOOL IsInSnakeHead(CPoint pt);
BOOL IsOver();
void InitSnake();
void SetSpeed(int ms);
void AutoMove();
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSnakeWnd)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CSnakeWnd();
void DrawBlockH(CDC *pDC,CRect rect);
void DrawBlockV(CDC *pDC,CRect rect);
// Generated message map functions
protected:
//{{AFX_MSG(CSnakeWnd)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnPaint();
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnTimer(UINT nIDEvent);
afx_msg void OnSize(UINT nType, int cx, int cy);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_SNAKEWND_H__4C805A34_BFA9_4A63_9824_6C8FBE8EFFEE__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -