Skip to main content

NonogramWidget

Struct NonogramWidget 

Source
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>

Source

pub fn new(game: &'a mut NonogramGame) -> Self

Source

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).

Source

pub fn tap_mode(self, mode: TapMode) -> Self

What a plain tap/primary-click does. Defaults to TapMode::Fill.

Source

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.

Source

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.

Source

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§

Source§

impl Widget for NonogramWidget<'_>

Source§

fn ui(self, ui: &mut Ui) -> Response

Allocate space, interact, paint, and return a Response. Read more
Source§

fn boxed<'a>(self) -> Box<dyn FnOnce(&mut Ui) -> Response + 'a>
where Self: Sized + 'a,

Box this widget for dynamic dispatch.

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.