[][src]Struct thyme::Context

pub struct Context { /* fields omitted */ }

The main Thyme Context that holds internal PersistentState and is responsible for creating Frames.

This is created by build on ContextBuilder after resource registration is complete.

Implementations

impl Context[src]

pub fn wants_mouse(&self) -> bool[src]

Returns true if thyme wants to use the mouse in the current frame, generally because the mouse is over a Thyme widget. If this returns true, you probably want Thyme to handle input this frame, while if it returns false, your application or game logic should handle input.

pub fn add_theme_file<P: Into<PathBuf>>(&mut self, path: P)[src]

Adds the specified path as a source file for the resources being used by the theme for this context. This will only work if the theme was set up to read source data from files, i.e. using ContextBuilder#register_theme_from_files This does not rebuild the theme; you will need to call rebuild_all for that.

pub fn remove_theme_file<P: Into<PathBuf>>(&mut self, path: P)[src]

Removes the theme source file with the specified path from the resources being used by the theme for this context, if it is present. If it is not present, does nothing. This does not rebuild the theme; you will need to call rebuild_all for that.

pub fn rebuild_all<R: Renderer>(
    &mut self,
    renderer: &mut R
) -> Result<(), Error>
[src]

Rebuilds this context, reloading all asset data. Notably, files on disk that were used in building the context are re-read. If any errors are encountered in reading or parsing files, this will return Err and no changes are made to the context.

pub fn check_live_reload<R: Renderer>(
    &mut self,
    renderer: &mut R
) -> Result<(), Error>
[src]

Checks the internal live reload thread to see if any file notifications have occurred since the last check. If so, will fully rebuild the theme. If any errors are encountered in the process of rebuilding the theme, will return the Err and no changes are made to the current theme. Note that if you built the context with live reload disabled (see BuildOptions), this function will do nothing.

pub fn create_frame(&mut self) -> Frame[src]

Creates a Frame, the main object that should pass through your UI building functions and is responsible for constructing the widget tree. This method should be called each frame you want to draw / interact with the UI.

Auto Trait Implementations

impl !RefUnwindSafe for Context

impl !Send for Context

impl !Sync for Context

impl Unpin for Context

impl !UnwindSafe for Context

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