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

📄 snake.h

📁 贪吃蛇的源代码..比较简单,就不介绍了...
💻 H
字号:
#pragma once
#include "Global.h"
#include "object.h"
#include <vector>
using std::vector;

enum DIR {UP, DOWN, LEFT, RIGHT};
//================================
//Class Node
//================================
class Node  :
    virtual public Object
{
private:
    USHORT m_x,m_y;
    DIR m_dir;
public:
    Node(void);
    Node(USHORT x, USHORT y);
    //Node(const Node& N);
    virtual ~Node(void);
    USHORT  GetX(void) const;
    void    SetX(USHORT x);
    USHORT  GetY(void) const;
    void    SetY(USHORT y);
    void    GetXY(USHORT& x, USHORT& y) const;
    void    SetXY(USHORT x, USHORT y);
    operator    char() const;
    DIR     GetDir(void) const;
    void    SetDir(DIR dir);
};

//================================
//Class Snake
//================================
class Snake :
    virtual public Object
{
private:
    vector<Node> m_body;
public:
    Snake(void);
    virtual ~Snake(void);
    bool isInBody(USHORT x, USHORT y);

#ifdef DEBUG
public:
#if (DEBUG==1)
    void print(void);
#endif //end #if(DEBUG==1)
#endif

};

⌨️ 快捷键说明

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