Class gridpp::Maze¶
操作固定尺寸的迷宮牆面網格。 More...
#include <GridMaze.h>
Public Functions¶
| Type | Name |
|---|---|
| Maze () = default 建立不指向任何迷宮的 handler。 |
|
| Maze | deepCopy () const |
| bool | exists () const |
| int | height () const |
| bool | isWall (int x, int y) const |
| void | remove () 從引擎移除迷宮;呼叫後所有指向它的 handler 都會失效。 |
| void | setInitFunction (MazeCallback function) 取代初始化 callback;若迷宮已初始化,新函式不會自動補呼叫。 |
| void | setUpdateFunction (MazeCallback function) 取代每幀更新 callback。 |
| void | setWall (int x, int y, bool wall=true) 設定一格是否為牆。 |
| void | setWallImage (const std::string & image) 設定所有牆共用的素材,並切換至單一素材模式。 |
| void | setWallImages (const std::string & isolated, const std::string & end, const std::string & straight, const std::string & corner, const std::string & tee, const std::string & cross) 設定自動拼接牆面使用的六種素材,並切換至自動拼接模式。 |
| int | width () const |
Detailed Description¶
複製 handler 不會複製迷宮;所有複本仍操作同一個實體。迷宮被移除或 GameEngine 銷毀後, 可以用 exists() 檢查 handler 是否仍有效。除 exists() 之外,對失效 handler 呼叫其他函式 會拋出 std::runtime_error。
Public Functions Documentation¶
function Maze¶
建立不指向任何迷宮的 handler。
function deepCopy¶
Returns:
一個擁有獨立牆面、素材設定、callback 與新 handler 的迷宮複本。
function exists¶
Returns:
handler 是否仍指向存在的迷宮。
function height¶
Returns:
迷宮列數。
function isWall¶
Returns:
指定位置是否為牆;迷宮外一律回傳 true。
function remove¶
從引擎移除迷宮;呼叫後所有指向它的 handler 都會失效。
function setInitFunction¶
取代初始化 callback;若迷宮已初始化,新函式不會自動補呼叫。
function setUpdateFunction¶
取代每幀更新 callback。
function setWall¶
設定一格是否為牆。
Parameters:
x迷宮內的網格 x 座標。y迷宮內的網格 y 座標。walltrue 表示牆,false 表示通道。
Exception:
std::out_of_range若座標位於迷宮外。
function setWallImage¶
設定所有牆共用的素材,並切換至單一素材模式。
function setWallImages¶
設定自動拼接牆面使用的六種素材,並切換至自動拼接模式。
inline void gridpp::Maze::setWallImages (
const std::string & isolated,
const std::string & end,
const std::string & straight,
const std::string & corner,
const std::string & tee,
const std::string & cross
)
Parameters:
isolated孤立牆素材。end端點素材。straight直線素材。corner轉角素材。teeT 形素材。cross十字素材。
function width¶
Returns:
迷宮欄數。
The documentation for this class was generated from the following file GridMaze.h