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

📄 tile.h

📁 [游戏开发参考书-用DirectX编写RPG游戏]这是一个系列的丛书如果你都看并且懂的话你就可以你工作啦!
💻 H
字号:
#ifndef _TILE_H_
#define _TILE_H_

class cTiles
{
  private:
    cGraphics *m_Graphics;     // Parent cGraphics

    long       m_NumTextures;  // # of textures
    cTexture  *m_Textures;     // cTexture array
    long      *m_Widths;       // Tile widths array
    long      *m_Heights;      // Tile heights array
    long      *m_Columns;      // # columns in texture

  public:
    cTiles();
    ~cTiles();

    // Functions to create and free the tile interface
    BOOL Create(cGraphics *Graphics, long NumTextures);
    BOOL Free();

    // Functions to load and free a single texture
    BOOL Load(long TextureNum, char *Filename,                \
              short TileWidth = 0, short TileHeight = 0,      \
              D3DCOLOR Transparent = 0,                       \
              D3DFORMAT Format = D3DFMT_A1R5G5B5);
    BOOL Free(long TextureNum);

    // Functions to retrieve tile dimensions and 
    // # of tiles in a texture.
    long GetWidth(long TextureNum);
    long GetHeight(long TextureNum);
    long GetNum(long TextureNum);

    // Enable or disable transparent blitting
    BOOL SetTransparent(BOOL Enabled = TRUE);

    // Draw a single tile to location
    BOOL Draw(long TextureNum, long TileNum,                  \
              long ScreenX, long ScreenY,                     \
              D3DCOLOR Color = 0xFFFFFFFF,                    \
              float XScale = 1.0f, float YScale = 1.0f);
};

#endif

⌨️ 快捷键说明

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