pub struct NonogramWidget<'a> { /* private fields */ }Expand description
An egui widget that renders a nonogram board with its row/column clues.
Left-click fills a cell; right-click crosses it out. Press and drag to paint (or erase) a whole stroke of cells in one gesture — the action is decided by the cell the drag started on and then repeated for every cell the pointer passes over. Once a row or column’s filled cells match its clue, that clue is dimmed (and struck through) as a solving aid.
ui.add(egui_nonogram::NonogramWidget::new(&mut game));Implementations§
Source§impl<'a> NonogramWidget<'a>
impl<'a> NonogramWidget<'a>
pub fn new(game: &'a mut NonogramGame) -> 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 grid cell. When not set, the cell size is computed automatically to fill the available space of the parent container (after reserving room for the clue gutters).
Sourcepub fn tap_mode(self, mode: TapMode) -> Self
pub fn tap_mode(self, mode: TapMode) -> Self
What a plain tap/primary-click does. Defaults to TapMode::Fill.
Sourcepub fn show_preview(self, enabled: bool) -> Self
pub fn show_preview(self, enabled: bool) -> Self
Show a small read-only thumbnail of the current filled cells beside
the board — a compact “how’s it coming along” overview on larger
grids. It only ever reflects cells the player has already filled, so
it can’t spoil a picture puzzle’s solution. Defaults to false.
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!" when not set.
Sourcepub fn interactive(self, interactive: bool) -> Self
pub fn interactive(self, interactive: bool) -> Self
Whether the widget responds to taps/drags at all. Set to false
to render the board read-only — e.g. while a surrounding
container (like egui::containers::Scene) should own pointer
gestures instead. Unlike wrapping the widget in a disabled Ui,
this does not dim it: painting stays full-opacity, only the
pointer sense changes. Defaults to true.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !UnwindSafe for NonogramWidget<'a>
impl<'a> Freeze for NonogramWidget<'a>
impl<'a> RefUnwindSafe for NonogramWidget<'a>
impl<'a> Send for NonogramWidget<'a>
impl<'a> Sync for NonogramWidget<'a>
impl<'a> Unpin for NonogramWidget<'a>
impl<'a> UnsafeUnpin for NonogramWidget<'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