-
-
Notifications
You must be signed in to change notification settings - Fork 82
openFrameworks
Kasuga Chiyo edited this page Feb 27, 2019
·
9 revisions
#include "ofMain.h"
#include "DTL.hpp"
#include <cstdint>
#include <cstddef>
#include <array>
#include <bitset>
constexpr std::size_t matrix_size{ 128 };
constexpr std::size_t dungeon_pixel_size{ 2 };
class ofApp : public ofBaseApp {
private:
std::array<std::bitset<matrix_size>, matrix_size> matrix{ {} };
public:
void setup() {
const dtl::generator::terrain::stl::SimpleVoronoiIsland<bool> create(matrix);
dtl::utility::stl::noiseShoreBool(matrix);
}
void draw() {
for (std::size_t row{}; row < matrix.size(); ++row)
for (std::size_t col{}; col < matrix[row].size(); ++col) {
(matrix[row][col]) ? ofSetColor(98, 170, 48) : ofSetColor(30, 30, 163);
ofDrawRectangle(float(col*dungeon_pixel_size), float(row*dungeon_pixel_size), float(dungeon_pixel_size), float(dungeon_pixel_size));
}
}
};
int main() {
ofSetupOpenGL(int(matrix_size*dungeon_pixel_size), int(matrix_size*dungeon_pixel_size), OF_WINDOW);
ofRunApp(new ofApp());
return 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)