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

📄 background.h

📁 游戏编程源码
💻 H
字号:
//-----------------------------------------------------------------
// Background Object
// C++ Header - Background.h
//-----------------------------------------------------------------

#ifndef BACKGROUND_H
#define BACKGROUND_H

//-----------------------------------------------------------------
// Include Files
//-----------------------------------------------------------------
#include <windows.h>
#include "Bitmap.h"

//-----------------------------------------------------------------
// Background Class
//-----------------------------------------------------------------
class Background
{
protected:
  // Member Variables
  int       m_iWidth, m_iHeight;
  COLORREF  m_crColor;
  Bitmap*   m_pBitmap;

public:
  // Constructor(s)/Destructor
          Background(int iWidth, int iHeight, COLORREF crColor);
          Background(Bitmap* pBitmap);
  virtual ~Background();

  // General Methods
  virtual void  Update();
  virtual void  Draw(HDC hDC);

  // Accessor Methods
  int GetWidth()  { return m_iWidth; };
  int GetHeight() { return m_iHeight; };
};

//-----------------------------------------------------------------
// Starry Background Class
//-----------------------------------------------------------------
class StarryBackground : Background
{
protected:
  // Member Variables
  int       m_iNumStars;
  int       m_iTwinkleDelay;
  POINT     m_ptStars[100];
  COLORREF  m_crStarColors[100];

public:
  // Constructor(s)/Destructor
          StarryBackground(int iWidth, int iHeight, int iNumStars = 100,
            int iTwinkleDelay = 50);
  virtual ~StarryBackground();

  // General Methods
  virtual void  Update();
  virtual void  Draw(HDC hDC);
};

#endif

⌨️ 快捷键说明

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