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

📄 ps.h

📁 Beginning Direct3D Game Programming源代码Part3chapter122dbitarray.rar
💻 H
字号:
#ifndef H_PHYSICALSPRITE
#define H_PHYSICALSPRITE

// This is just an example.  PIXELVALUE can be any size/integral type
typedef unsigned char PIXELVALUE;

class PhysicalSprite
{
public:
  // Constructor.  Initializes all data structures needed
  PhysicalSprite(PIXELVALUE* pix, 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);

  void SetPosition(int X, int Y) { x=X; y=Y; }

private:
  // Calculate the bit array from the pixel array
  void CalculateBitArray(PIXELVALUE* pix, PIXELVALUE transparent);
  // Retrieve a 32 bit array starting from a certain pixel position
  unsigned GetBitArray(int x, int y) const;
  // Return a bit mask for the given bits number
  static unsigned GetBitMask(int UpperBitsNumber);
protected:
  int          width;
  int          height;
  int          x;
  int          y;
  unsigned*    bitarray;
  int          groups_number;
};


#endif // PHYSICALSPRITE

⌨️ 快捷键说明

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