📄 hunter.h
字号:
// pet.h : Interface of class pet
#ifndef HUNTER_H
#define HUNTER_H
#include <vector>
#include "bitmap.h"
//----------------------------------------------------------------
// Define Direction for Hunter
//-----------------------------------------------------------------
enum HunterDirection
{
Hunter_Up, Hunter_Down, Hunter_Left, Hunter_Right, Hunter_None,
Hunter_DirectNumber
};
//-----------------------------------------------------------------
class Hunter
{
public:
Hunter( SimpleWindow& Window );
Position GetPosition() const;
void SetDirection( const HunterDirection &D );
void Create();
void Move();
protected:
SimpleWindow& GetWindow() const;
const BitMap& GetBmp( const HunterDirection& D ) const;
BitMap& GetBmp( const HunterDirection& D );
void SetPosition( const Position& p );
HunterDirection GetDirection() const; // get direction
Position NewPosition() const; // set a new position for bug to move to
//-----------------------------------------------------------
// get and set vertical movement
//-----------------------------------------------------------
float GetVertMovement() const;
void SetVertMovement( float v);
//-------------------------------------------------------------
// get and set horizontal movement
//-------------------------------------------------------------
float GetHorizMovement() const;
void SetHorizMovement( float h );
//-------------------------------------------------------------
// Draw and erase the bitmaps
//-------------------------------------------------------------
void Draw();
void Erase();
//-------------------------------------------------------------
// Judge whether the pet is at the Edge of window
//-------------------------------------------------------------
bool AtUpEdge() const;
bool AtDownEdge() const;
bool AtLeftEdge() const;
bool AtRightEdge() const;
private:
//------------------------------------------------------------
// Data members
//------------------------------------------------------------
SimpleWindow& m_Window;
vector<BitMap> m_Bmp;
HunterDirection m_HunterDirection;
Position m_HunterPosition;
float m_HorizMovement;
float m_VertMovement;
};
#endif
//------------------------------------------------------------------------
// end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -