-
-
Notifications
You must be signed in to change notification settings - Fork 82
OpenSiv3D Sample [v0.2.X 0.3.X]
Kasugaccho edited this page Apr 30, 2019
·
1 revision
#include <Siv3D.hpp>
#include <DTL.hpp>
#include <cstdint>
#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{ {} };
const dtl::generator::terrain::stl::SimpleVoronoiIsland<bool> create(matrix);
dtl::utility::stl::noiseShoreBool(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 <cstdint>
#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{ {} };
const dtl::generator::terrain::stl::SimpleVoronoiIsland<bool> create(matrix);
dtl::utility::stl::noiseShoreBool(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 <cstdint>
#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{ {} };
const dtl::generator::terrain::stl::SimpleVoronoiIsland<bool> generation;
constexpr int loop_counter_max{ 20 };
int loop_counter{ loop_counter_max };
while (System::Update()) {
if (loop_counter >= loop_counter_max) {
dtl::utility::stl::init(matrix);
generation.create(matrix);
dtl::utility::stl::noiseShoreBool(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)