probably all the assets in the game will be sprites,from the UI to the main characters.
Sprites 就是中文的子画面的意思 看下代码
#pragma once
#if !defined(__BACKBUFFER_H__)
#define __BACKBUFFER_H__
// Library Includes
#include <Windows.h>
// Local Includes
// Types
// Constants
// Prototypes
class CBackBuffer
{
// Member Functions
public:
CBackBuffer();
~CBackBuffer();
bool Initialise(HWND _hWnd, int _iWidth, int _iHeight);
HDC GetBFDC() const;
int GetHeight() const;
int GetWidth() const;
void Clear();
void Present();
protected:
private:
CBackBuffer(const CBackBuffer& _kr);
CBackBuffer& operator= (const CBackBuffer& _kr);
// Member Variables
public:
protected:
HWND m_hWnd; //画图的用protect
HDC m_hDC;
HBITMAP m_hSurface;
HBITMAP m_hOldObject;
int m_iWidth;
int m_iHeight;
private:
};
#endif // __BACKBUFFER_H__
定义了好多个 const member function 还有 许多method 如Clear Present
然而这只是一个叫什么backbuffer的
// Library Includes
// Local Includes
// This include
#include "BackBuffer.h"
// Static Variables
// Static Function Prototypes
// Implementation
CBackBuffer::CBackBuffer() //在cpp里面初始化
: m_hWnd(0)
, m_hDC(0)
, m_hSurface(0)
, m_hOldObject(0)
, m_iWidth(0)
, m_iHeight(0)
{
}
CBackBuffer::~CBackBuffer() // destructor
{
SelectObject(m_hDC, m_hOldObject);
DeleteObject(m_hSurface);
DeleteObject(m_hDC);
}
bool
CBackBuffer::Initialise(HWND _hWnd, int _iWidth, int _iHeight)
{
m_hWnd = _hWnd;
m_iWidth = _iWidth;
m_iHeight = _iHeight;
HDC hWindowDC =