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

📄 bounds.h

📁 Beginning Direct3D Game Programming源代码Part3chapter12
💻 H
字号:
#ifndef H_BOUNDS
#define H_BOUNDS

typedef unsigned char PIXELVALUE;

class PhysicalSprite
{
public:
  // Constructor.  Initializes all data structures needed
  PhysicalSprite(PIXELVALUE* pix, int pitch, 
                 int w, int h, PIXELVALUE transparent);
  // Destructor.  Frees allocated buffers
  virtual ~PhysicalSprite();

  // Test this sprite against another to see if they collide
  bool DetectCollision(const PhysicalSprite& other);

  // Set the sprite's position in the 2D world
  void SetPosition(int X, int Y) { x=X; y=Y; }

private:
  // Calculates the sprite's bounds during initialization
  void CalculateBounds(PIXELVALUE* pix, int pitch, PIXELVALUE transparent);

protected:
  int  x;
  int  y;
  int  width;
  int  height;
  int* top;
  int* bottom;
  int* left;
  int* right;
};


#endif // H_BOUNDS

⌨️ 快捷键说明

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