Crates.io | hext-boards |
lib.rs | hext-boards |
version | 0.3.0 |
source | src |
created_at | 2022-12-25 09:04:46.033369 |
updated_at | 2023-11-19 13:51:33.142137 |
description | A small library that renders hexagonal boards with text on the terminal |
homepage | |
repository | https://github.com/Odilf/hext-boards/ |
max_upload_size | |
id | 745235 |
size | 8,111 |
A small library that renders hexagonal boards on the terminal.
use hext_boards::HexagonalBoard;
use glam::ivec2;
let board = HexagonalBoard::from([
(ivec2(0, 0), 'a'),
(ivec2(1, 0), 'b'),
(ivec2(0, 1), 'c'),
(ivec2(-1, -1), 'd'),
]);
let output = board.to_string();
// Also works
println!("{board}");
/* Output is the following:
/---\ /---\
⟨ b ⟩---⟨ c ⟩
\---⟨ a ⟩---/
⟩---⟨
⟨ d ⟩
\---/
*/