hext-boards

Crates.iohext-boards
lib.rshext-boards
version0.3.0
sourcesrc
created_at2022-12-25 09:04:46.033369
updated_at2023-11-19 13:51:33.142137
descriptionA small library that renders hexagonal boards with text on the terminal
homepage
repositoryhttps://github.com/Odilf/hext-boards/
max_upload_size
id745235
size8,111
(Odilf)

documentation

README

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  ⟩
      \---/
*/
Commit count: 11

cargo fmt