Skip to content

dtl::shape::RogueLike (形状クラス)

Kasugaccho edited this page Oct 12, 2019 · 15 revisions

バージョン:0.4.13.0以降

<DTL/Shape/RogueLike.hpp>

// v0.4.13.0
namespace dtl::shape {
  template <typename T>
  class RogueLike;
}

// v0.4.14.0 -
namespace dtl::shape {
  template <typename T, typename Random_Engine = DTL_RANDOM_DEFAULT_RANDOM>
  class RogueLike;
}

T は3bit以上の型

Random_Engineは乱数生成クラス (デフォルトでDTL_RANDOM_DEFAULT_RANDOMが入っている)

対応機能

機能名 対応
非長方形Matrix 不可

例 (C++11)

#include <DTL.hpp>
#include <cstdint>
#include <array>

int main() {

	using shape_t = std::uint_fast8_t;
	std::array<std::array<shape_t, 32>, 24> matrix{ {} };

	dtl::shape::RogueLike<shape_t>(0, 1, 2, 3, 4, 20, 
		dtl::base::MatrixRange(3, 3, 2, 2), 
		dtl::base::MatrixRange(3, 3, 4, 4)).draw(matrix);

	dtl::console::OutputNumber<shape_t>(",").draw(matrix);
	dtl::console::OutputString<shape_t>("%%", "##", "  ", "++", "--").draw(matrix);

	return 0;
}

出力

0,0,0,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,1,4,1,2,2,2,1,1,1,2,2,2,3,4,4,4,1,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,1,4,1,2,2,2,3,4,1,2,2,2,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,1,4,1,2,2,2,1,4,3,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,1,3,1,1,1,3,1,4,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,1,2,2,2,1,4,1,4,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,1,2,2,2,3,4,1,4,4,4,4,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,1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0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
%%%%%%%%##############%%##################%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%##--##      ######      ++------##%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%##--##      ++--##      ##########%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%##--##      ##--++      ##%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%##++######++##--##      ##%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%##      ##--##--##########%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%##      ++--##----------##%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%##      ##--##--##########%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%##############----------##%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%##########++##%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%##############%%##      ##%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%##--##      ##%%##      ##%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%##--##      ######      ##%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%##--##      ++--++      ##%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%##--++      ##--######++########%%##########%%%%%%%%%%%%
%%%%%%%%######++######--##%%##--------##%%##      ##%%%%%%%%%%%%
%%%%%%%%%%%%##--##%%##--##%%######++####%%##      ##%%%%%%%%%%%%
%%%%%%%%%%%%##--##%%######%%%%##      ##%%##      ##%%%%%%%%%%%%
%%%%%%%%%%%%##--##%%%%%%%%%%%%##      ########++####%%%%%%%%%%%%
%%%%%%%%%%%%##--################      ++--------##%%%%%%%%%%%%%%
%%%%%%%%%%%%##--####----------++      ############%%%%%%%%%%%%%%
%%%%%%%%%%%%##--####################++##%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%######%%%%%%%%%%%%##------##%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%##########%%%%%%%%%%%%%%%%%%%%%%%%

画像

rl1 rl2

Clone this wiki locally