-
-
Notifications
You must be signed in to change notification settings - Fork 87
地形配列(Dungeon Matrix)
Kasuga Chiyo edited this page Mar 3, 2019
·
5 revisions
ダンジョンの地形データを格納する配列。 多くの場合、STLを使用する。
記事ではmatrixという名前で宣言する。
また、引数に使用する場合はmatrix_という名前が使われる。
横(X軸方向)のサイズがdungeon_size_x、縦(Y軸方向)のサイズがdungeon_size_y、
変数型がdungeon_tの地形配列を作成。
std::array<std::array<dungeon_t, dungeon_size_x>, dungeon_size_y> matrix{ {} };横(X軸方向)のサイズがdungeon_size_x、縦(Y軸方向)のサイズがdungeon_size_y、
変数型がdungeon_tの地形配列を作成。
std::vector<std::vector<dungeon_t>> matrix(dungeon_size_y, std::vector<dungeon_t>(dungeon_size_x, 0));横(X軸方向)の位置がx、縦(Y軸方向)の位置がyの場所に0を代入する。
matrix[y][x] = 0;Copyright (c) 2018-2021 As Project.
Distributed under the Boost Software License, Version 1.0.(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)