[][src]Struct mergui::Context

pub struct Context<'a> { /* fields omitted */ }

This manages the GUI. It contains every widget that needs to be drawn and makes sure they are updated properly

Methods

impl<'a> Context<'a>[src]

pub fn new(cursor: Vector2<f32>) -> Self[src]

pub fn add_layer(&mut self) -> LayerId[src]

Adds a layer that can hold multiple widgets. Usefull to group widgets together that need to be removed at the same time

pub fn event(&mut self, event: &Event, window: &Window)[src]

Call this in the event function of the state to update every widget.

pub fn render(&mut self, gfx: &mut Graphics, window: &Window) -> QuickResult<()>[src]

Call this in the render function of your state to render every widget

pub fn add_widget<R, W, Res>(
    &mut self,
    widget: R,
    layer_id: &LayerId
) -> Result<Response<Res>, ()> where
    R: WidgetConfig<Res, W>,
    W: Widget + 'a,
    Res: Sized
[src]

Adds a widget configuration to a given layer.

Returns an Error if the layer does not exist.

Otherwise, returns both the id of the widget AND a channel to comunicate with it.

Auto Trait Implementations

impl<'a> !RefUnwindSafe for Context<'a>

impl<'a> !Send for Context<'a>

impl<'a> !Sync for Context<'a>

impl<'a> Unpin for Context<'a>

impl<'a> !UnwindSafe for Context<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.