-
-
Notifications
You must be signed in to change notification settings - Fork 81
dtl::XX::YY::drawArray
Kasugaccho edited this page Aug 10, 2019
·
2 revisions
English ๐ฌ๐ง / ๆฅๆฌ่ช ๐ฏ๐ต
// Array
template<typename Matrix_>
constexpr bool drawArray(Matrix_&& matrix_, const std::size_t max_x_, const std::size_t max_y_) const noexcept;
Draw on Matrix.
The return type is bool
.
Return Value | Description |
---|---|
false | Drawing failed. |
true | Drawing was successful. |
Don't throw exception.
O(n^2).
- Some are O(n).
#include <DTL.hpp>
#include <cstddef>
#include <cstdint>
int main() {
using shape_t = std::uint_fast8_t;
constexpr std::size_t width{ 16 };
constexpr std::size_t height{ 8 };
shape_t matrix[height * width]{};
dtl::shape::Border<shape_t>(1).drawArray(matrix, width, height);
dtl::console::OutputNumber<shape_t>(",").drawArray(matrix, width, height);
dtl::console::OutputString<shape_t>("//", "##").drawArray(matrix, width, height);
return 0;
}
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
################################
##////////////////////////////##
##////////////////////////////##
##////////////////////////////##
##////////////////////////////##
##////////////////////////////##
##////////////////////////////##
################################
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)