Struct poke_a_mango::ops::Widgets [] [src]

pub struct Widgets { /* fields omitted */ }

Container for all widgets' IDs, also manages setting them.

The general idea is to call Widgets::new() once and then Widgets::update() each update event.

An external (usercode) variable is recommended to track the game's state.

Examples

let mut ui = conrod::UiBuilder::new(window_size).build();
let widgets = Widgets::new(ui.widget_id_generator());

let mut game_state = GameState::MainMenu;

// Then, in the event loop
event.update(|_| {
    widgets.update(ui.set_widgets(), &mut game_state);
});

Methods

impl Widgets
[src]

[src]

Generate widget IDs in preparation for later setting them in Ui.

Examples

let mut ui = conrod::UiBuilder::new(window_size).build();
let widgets = Widgets::new(ui.widget_id_generator());

[src]

Update the UI elements and set them.

Given the current game's state it will update it with the next one, if needed, for example, if GameState::MainMenu was passed in and the Start button was pressed it'll be updated to GameState::ChooseDifficulty.

Should be called on the update window event.

Examples

let mut game_state = GameState::MainMenu;
event.update(|_| {
    widgets.update(ui.set_widgets(), &mut game_state)
});

Trait Implementations

impl Debug for Widgets
[src]

[src]

Formats the value using the given formatter. Read more

impl Clone for Widgets
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Copy for Widgets
[src]

impl PartialEq for Widgets
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl Eq for Widgets
[src]

impl PartialOrd for Widgets
[src]

[src]

This method returns an ordering between self and other values if one exists. Read more

[src]

This method tests less than (for self and other) and is used by the < operator. Read more

[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Ord for Widgets
[src]

[src]

This method returns an Ordering between self and other. Read more

1.21.0
[src]

Compares and returns the maximum of two values. Read more

1.21.0
[src]

Compares and returns the minimum of two values. Read more