4 releases (2 breaking)
0.3.0 | Nov 19, 2023 |
---|---|
0.2.0 | Sep 22, 2023 |
0.1.1 | Dec 25, 2022 |
0.1.0 | Dec 25, 2022 |
#10 in #hexagon
Used in chessagon-cli
9KB
167 lines
hext-boards
A small library that renders hexagonal boards on the terminal.
Example
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 ⟩
\---/
*/
Dependencies
~3.5MB
~118K SLoC