-
-
Notifications
You must be signed in to change notification settings - Fork 81
OpenSiv3D中級サンプル
Kasugaccho edited this page May 19, 2019
·
1 revision
#include <Siv3D.hpp>
#include <DTL.hpp>
#include <cstddef>
#include <array>
#include <bitset>
void Main() {
constexpr std::size_t matrix_size{ 128 };
constexpr std::size_t dungeon_pixel_size{ 2 };
Window::Resize(int32(matrix_size * dungeon_pixel_size), int32(matrix_size * dungeon_pixel_size));
std::array<std::bitset<matrix_size>, matrix_size> matrix{ {} };
dtl::shape::SimpleVoronoiIsland<bool>(100, 0.5, 1, 0).draw(matrix);
dtl::utility::CellularAutomation<bool>().draw(matrix);
while (System::Update())
for (std::size_t row{}; row < matrix.size(); ++row)
for (std::size_t col{}; col < matrix[row].size(); ++col)
Rect(int32(col * dungeon_pixel_size), int32(row * dungeon_pixel_size), int32(dungeon_pixel_size)).draw((matrix[row][col]) ? Color(98, 170, 48) : Color(30, 30, 163));
}
#include <Siv3D.hpp>
#include <DTL.hpp>
#include <cstddef>
#include <array>
#include <bitset>
void Main() {
constexpr std::size_t matrix_size_x{ 196 };
constexpr std::size_t matrix_size_y{ 128 };
constexpr std::size_t dungeon_pixel_size{ 2 };
Window::Resize(int32(matrix_size_x * dungeon_pixel_size), int32(matrix_size_y * dungeon_pixel_size));
std::array<std::bitset<matrix_size_x>, matrix_size_y> matrix{ {} };
dtl::shape::SimpleVoronoiIsland<bool>(100, 0.5, 1, 0).draw(matrix);
dtl::utility::CellularAutomation<bool>().draw(matrix);
while (System::Update())
for (std::size_t row{}; row < matrix.size(); ++row)
for (std::size_t col{}; col < matrix[row].size(); ++col)
Rect(int32(col * dungeon_pixel_size), int32(row * dungeon_pixel_size), int32(dungeon_pixel_size)).draw((matrix[row][col]) ? Color(98, 170, 48) : Color(30, 30, 163));
}
#include <Siv3D.hpp>
#include <DTL.hpp>
#include <cstddef>
#include <array>
#include <bitset>
void Main() {
constexpr std::size_t matrix_size_x{ 196 };
constexpr std::size_t matrix_size_y{ 128 };
constexpr std::size_t dungeon_pixel_size{ 2 };
Window::Resize(int32(matrix_size_x * dungeon_pixel_size), int32(matrix_size_y * dungeon_pixel_size));
std::array<std::bitset<matrix_size_x>, matrix_size_y> matrix{ {} };
constexpr int loop_counter_max{ 20 };
int loop_counter{ loop_counter_max };
while (System::Update()) {
if (loop_counter >= loop_counter_max) {
dtl::utility::Init<bool>(0).draw(matrix);
dtl::shape::SimpleVoronoiIsland<bool>(100, 0.5, 1, 0).draw(matrix);
dtl::utility::CellularAutomation<bool>().draw(matrix);
loop_counter = 0;
}
for (std::size_t row{}; row < matrix.size(); ++row)
for (std::size_t col{}; col < matrix[row].size(); ++col)
Rect(int32(col * dungeon_pixel_size), int32(row * dungeon_pixel_size), int32(dungeon_pixel_size)).draw((matrix[row][col]) ? Color(98, 170, 48) : Color(30, 30, 163));
++loop_counter;
}
}
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)