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]
pub fn new(id_gen: Generator) -> Widgets
[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());
pub fn update(&self, ui_wdgts: UiCell, cur_state: &mut GameState)
[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]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Clone for Widgets
[src]
fn clone(&self) -> Widgets
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Copy for Widgets
[src]
impl PartialEq for Widgets
[src]
fn eq(&self, __arg_0: &Widgets) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Widgets) -> bool
[src]
This method tests for !=
.
impl Eq for Widgets
[src]
impl PartialOrd for Widgets
[src]
fn partial_cmp(&self, __arg_0: &Widgets) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &Widgets) -> bool
[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &Widgets) -> bool
[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &Widgets) -> bool
[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &Widgets) -> bool
[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]
fn cmp(&self, __arg_0: &Widgets) -> Ordering
[src]
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more