Skip to content

Commit

Permalink
add write number
Browse files Browse the repository at this point in the history
  • Loading branch information
AsPJT committed May 13, 2019
1 parent 810a280 commit fadaf09
Show file tree
Hide file tree
Showing 7 changed files with 464 additions and 184 deletions.
189 changes: 6 additions & 183 deletions MSVC/DungeonTemplateLibrary/20190502.cpp
Original file line number Diff line number Diff line change
@@ -1,193 +1,16 @@
#include <DTL.hpp>
#include <Dungeon/ImageWrite.hpp>
#include <cstdint>
#include <array>

#include <list>
#include <vector>
#include <string>

int main() {

using shape_t = std::uint_fast8_t;
std::array<std::array<shape_t, 128>, 64> matrix{ {} };
//std::vector<std::list<shape_t>> matrix(16, std::list<shape_t>(16, 0));

dtl::shape::RandomVoronoi<shape_t>(100, 0.5, 1, 0).draw(matrix);
//dtl::FractalIsland<shape_t>(10, 150, 70).draw(matrix);
//dtl::SimpleRogueLike<shape_t>(1, 2, 4, 2, 4, 2, 4, 2).draw(matrix);
//dtl::MazeDig<shape_t>(1, 0).draw(matrix);
dtl::OutputNumber<shape_t>(",").draw(matrix);
//dtl::console::OutputStringBool<shape_t>("##", "//").drawOperator(matrix, [](const shape_t value_) {return value_ > 80; });

//dtl::FileTerrainOBJ<shape_t>("Save/o.obj").write(matrix);

//dtl::Rect<shape_t>(dtl::MatrixRange(5, 5, 5, 5), 1).drawList(matrix);

//for (auto&& row : matrix) {
// for (auto&& col : row) {
// std::cout << (int)col << ',';
// }
// std::cout << '\n';
//}

//dtl::console::OutputStringBool<shape_t>(dtl::MatrixRange(5, 5, 5, 5), "#", "/").drawList(matrix);

dtl::CellularAutomatonMixIsland<shape_t>(5, 0, 1, 2, 3, 4).draw(matrix);

//dtl::storage::FileTXT_0_9<shape_t>("Save/file_sample_0_9.txt").write(matrix,32,32);

//dtl::storage::FilePBM<shape_t>("Save/file_sample.pbm").setRange(2, 2, 25, 25).write(matrix, 32, 32);
//dtl::storage::FilePBM<shape_t>(dtl::MatrixRange(2, 2, 25, 25), "Save/file_sample2.pbm").write(matrix);

//dtl::storage::FilePNG<shape_t>("Save/file_samplen.png", 3).write(matrix, [](const shape_t value, unsigned char* const color) {
// switch (value) {
// case 0:
// color[0] = 41;
// color[1] = 40;
// color[2] = 159;
// break;
// case 1:
// color[0] = 101;
// color[1] = 163;
// color[2] = 56;
// break;
// case 2:
// color[0] = 223;
// color[1] = 203;
// color[2] = 140;
// break;
// case 3:
// color[0] = 9;
// color[1] = 100;
// color[2] = 5;
// break;
// case 4:
// color[0] = 164;
// color[1] = 143;
// color[2] = 50;
// break;
// }
// });

//dtl::storage::FileJPG<shape_t>("Save/file_samplen.jpg", 3).write(matrix, [](const shape_t value, unsigned char* const color) {
// switch (value) {
// case 0:
// color[0] = 41;
// color[1] = 40;
// color[2] = 159;
// break;
// case 1:
// color[0] = 101;
// color[1] = 163;
// color[2] = 56;
// break;
// case 2:
// color[0] = 223;
// color[1] = 203;
// color[2] = 140;
// break;
// case 3:
// color[0] = 9;
// color[1] = 100;
// color[2] = 5;
// break;
// case 4:
// color[0] = 164;
// color[1] = 143;
// color[2] = 50;
// break;
// }
// });
std::array<std::array<int, 10>, 10> matrix{ {} };

//dtl::storage::FileBMP<shape_t>("Save/file_samplen.bmp", 3).write(matrix, [](const shape_t value, unsigned char* const color) {
// switch (value) {
// case 0:
// color[0] = 41;
// color[1] = 40;
// color[2] = 159;
// break;
// case 1:
// color[0] = 101;
// color[1] = 163;
// color[2] = 56;
// break;
// case 2:
// color[0] = 223;
// color[1] = 203;
// color[2] = 140;
// break;
// case 3:
// color[0] = 9;
// color[1] = 100;
// color[2] = 5;
// break;
// case 4:
// color[0] = 164;
// color[1] = 143;
// color[2] = 50;
// break;
// }
// });
dtl::Border<int>(1).draw(matrix);

//dtl::storage::FileTGA<shape_t>("Save/file_samplen.tga", 3).write(matrix, [](const shape_t value, unsigned char* const color) {
// switch (value) {
// case 0:
// color[0] = 41;
// color[1] = 40;
// color[2] = 159;
// break;
// case 1:
// color[0] = 101;
// color[1] = 163;
// color[2] = 56;
// break;
// case 2:
// color[0] = 223;
// color[1] = 203;
// color[2] = 140;
// break;
// case 3:
// color[0] = 9;
// color[1] = 100;
// color[2] = 5;
// break;
// case 4:
// color[0] = 164;
// color[1] = 143;
// color[2] = 50;
// break;
// }
// });
std::string str{};
dtl::board::WriteNumber<int>("\n", "(", "), ").draw(matrix, str);

//dtl::storage::FileHDR<shape_t>("Save/file_samplen.hdr", 3).write(matrix, [](const shape_t value, float* const color) {
// switch (value) {
// case 0:
// color[0] = 41.0f / 255.0f;
// color[1] = 40.0f / 255.0f;
// color[2] = 159.0f / 255.0f;
// break;
// case 1:
// color[0] = 101.0f / 255.0f;
// color[1] = 163.0f / 255.0f;
// color[2] = 56.0f / 255.0f;
// break;
// case 2:
// color[0] = 223.0f / 255.0f;
// color[1] = 203.0f / 255.0f;
// color[2] = 140.0f / 255.0f;
// break;
// case 3:
// color[0] = 9.0f / 255.0f;
// color[1] = 100.0f / 255.0f;
// color[2] = 5.0f / 255.0f;
// break;
// case 4:
// color[0] = 164.0f / 255.0f;
// color[1] = 143.0f / 255.0f;
// color[2] = 50.0f / 255.0f;
// break;
// }
// });
std::cout << str;

return 0;
}
2 changes: 2 additions & 0 deletions MSVC/DungeonTemplateLibrary/DungeonTemplateLibrary.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\include\Base\Struct.hpp" />
<ClInclude Include="..\..\include\Board\WriteNumber.hpp" />
<ClInclude Include="..\..\include\Camera\MatrixView.hpp" />
<ClInclude Include="..\..\include\Chrono\Time.hpp" />
<ClInclude Include="..\..\include\Console\OutputNumber.hpp" />
Expand All @@ -36,6 +37,7 @@
<ClInclude Include="..\..\include\Deprecated\RogueLike.hpp" />
<ClInclude Include="..\..\include\DTL.hpp" />
<ClInclude Include="..\..\include\Dungeon\Base.hpp" />
<ClInclude Include="..\..\include\Dungeon\Board.hpp" />
<ClInclude Include="..\..\include\Dungeon\Camera.hpp" />
<ClInclude Include="..\..\include\Dungeon\Chrono.hpp" />
<ClInclude Include="..\..\include\Dungeon\Console.hpp" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@
<Filter Include="ヘッダー ファイル\Type">
<UniqueIdentifier>{24c5dc8a-0e29-4784-a0bf-ea946424d0b6}</UniqueIdentifier>
</Filter>
<Filter Include="ヘッダー ファイル\Board">
<UniqueIdentifier>{096d7971-9c79-40ba-bf6b-2edfac2a9cfa}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\include\Utility\Binarization.hpp">
Expand Down Expand Up @@ -326,6 +329,12 @@
<ClInclude Include="..\..\include\Utility\MatrixWrapper.hpp">
<Filter>ヘッダー ファイル\Utility</Filter>
</ClInclude>
<ClInclude Include="..\..\include\Board\WriteNumber.hpp">
<Filter>ヘッダー ファイル\Board</Filter>
</ClInclude>
<ClInclude Include="..\..\include\Dungeon\Board.hpp">
<Filter>ヘッダー ファイル\Dungeon</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="20190502.cpp">
Expand Down
Loading

0 comments on commit fadaf09

Please sign in to comment.