📄 snakeview.h
字号:
// SnakeView.h : interface of the CSnakeView class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_SNAKEVIEW_H__D4569F39_0DDB_4CC7_AB4F_BEAFDF4C94C4__INCLUDED_)
#define AFX_SNAKEVIEW_H__D4569F39_0DDB_4CC7_AB4F_BEAFDF4C94C4__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include "wcedb.h"
#include "SnakeModel.h"
class CSnakeView : public CFormView
{
protected: // create from serialization only
CSnakeView();
DECLARE_DYNCREATE(CSnakeView)
public:
//{{AFX_DATA(CSnakeView)
enum { IDD = IDD_SNAKE_FORM };
CString m_diplayScore;
//}}AFX_DATA
// Attributes
public:
CSnakeDoc* GetDocument();
CSnakeModel *snake;
//游戏数据库属性标识
CCeDBRecord m_Record;
CCeDBProp m_pValProp[2];
CString m_PlayerName;
ULONG m_Score;
UINT m_nStartSpeed;//起始速度
bool isRunning;
bool isPaused;
bool begining;
bool slowOrFast;
bool hasTongue;
int step;
CBrush blackBrush;
CRect rect;
POINT snakeTail;
POINT extFood;
POINT stone;
POINT movFood;
POINT food;
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSnakeView)
public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual void OnInitialUpdate();
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual void OnDraw(CDC* pDC);
//}}AFX_VIRTUAL
// Implementation
public:
void AppendRecord();
void loadDefoultSettings();
void Write();
void Read();
void erase(CDC *pDC,POINT point);
void paint(CDC *pDC,int eat);
void paintTongue(CDC *pDC);
void paintScore();
virtual ~CSnakeView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CSnakeView)
afx_msg void OnTimer(UINT nIDEvent);
afx_msg void OnAppInstruction();
afx_msg void OnGameContinue();
afx_msg void OnGameNew();
afx_msg void OnGamePause();
afx_msg void OnGameSet();
afx_msg void OnButtonUp();
afx_msg void OnButtonRight();
afx_msg void OnButtonDown();
afx_msg void OnButtonLeft();
afx_msg void OnAppHistory();
afx_msg void OnUpdateGamePause(CCmdUI* pCmdUI);
afx_msg void OnUpdateGameContinue(CCmdUI* pCmdUI);
afx_msg void OnButtonTongue();
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#ifndef _DEBUG // debug version in SnakeView.cpp
inline CSnakeDoc* CSnakeView::GetDocument()
{ return (CSnakeDoc*)m_pDocument; }
#endif
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft eMbedded Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_SNAKEVIEW_H__D4569F39_0DDB_4CC7_AB4F_BEAFDF4C94C4__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -