pub struct HexwebWidget<'a> { /* private fields */ }Expand description
An egui widget that renders an interactive hexweb board.
Drag a piece onto an empty node to move it there, or onto another piece
to swap the two, or click a piece and then click an empty destination.
Arrows pointing at another piece are drawn in
satisfied_color; the ones still pointing at an empty node or off the
board are drawn in unsatisfied_color, which is the board’s live
progress feedback. The puzzle is solved when no arrow is unsatisfied.
ui.add(egui_hexweb::HexwebWidget::new(&mut game));Implementations§
Source§impl<'a> HexwebWidget<'a>
impl<'a> HexwebWidget<'a>
pub fn new(game: &'a mut HexwebGame) -> Self
Sourcepub fn cell_size(self, size: f32) -> Self
pub fn cell_size(self, size: f32) -> Self
Override the size (in logical pixels) of each hexagon’s circumradius. When not set, the cell size is computed automatically to fill the available space of the parent container.
Sourcepub fn win_message(self, message: impl Into<String>) -> Self
pub fn win_message(self, message: impl Into<String>) -> Self
Message shown in the win banner drawn over the board once
GameStatus::Won is reached. Defaults to "Solved!". The crate
ships no translations; embedding apps pass their own.
Sourcepub fn satisfied_color(self, color: Color32) -> Self
pub fn satisfied_color(self, color: Color32) -> Self
Color for arrows that point at an occupied node. Defaults to the theme’s strong text color.
Sourcepub fn unsatisfied_color(self, color: Color32) -> Self
pub fn unsatisfied_color(self, color: Color32) -> Self
Color for arrows that point at an empty node or off the board. Defaults to the theme’s error color — the accent the player reads as “this piece still needs to move”.
Sourcepub fn interactive(self, interactive: bool) -> Self
pub fn interactive(self, interactive: bool) -> Self
Whether the widget responds to input at all. Set to false to
render the board read-only. Defaults to true.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !UnwindSafe for HexwebWidget<'a>
impl<'a> Freeze for HexwebWidget<'a>
impl<'a> RefUnwindSafe for HexwebWidget<'a>
impl<'a> Send for HexwebWidget<'a>
impl<'a> Sync for HexwebWidget<'a>
impl<'a> Unpin for HexwebWidget<'a>
impl<'a> UnsafeUnpin for HexwebWidget<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more