[][src]Struct direct_gui::Gui

pub struct Gui { /* fields omitted */ }

The main entry point.

Typically a game has one instance of this struct where the resources are loaded before the main loop.

Methods

impl Gui[src]

pub fn new(size: (i32, i32)) -> Self[src]

Creates a new GUI.

pub fn update(&mut self, state: &ControlState)[src]

Handle the user input and information as supplied by the windowing library.

pub fn draw_to_buffer(&mut self, buffer: &mut Vec<u32>)[src]

Draw the drawable GUI controls on a target buffer.

pub fn draw_label(
    &mut self,
    buffer: &mut Vec<u32>,
    font_ref: FontRef,
    string: &String,
    pos: (i32, i32)
)
[src]

Draw a label a single frame.

pub fn register<T: 'static + Control>(&mut self, ctrl: T) -> ControlRef[src]

Register a control.

pub fn get<T: 'static + Control>(
    &self,
    control_ref: ControlRef
) -> Result<&T, Box<dyn Error>>
[src]

Retrieve a control by reference.

pub fn get_mut<T: 'static + Control>(
    &mut self,
    control_ref: ControlRef
) -> Result<&mut T, Box<dyn Error>>
[src]

Retrieve a control by mutable reference.

pub fn default_font(&self) -> FontRef[src]

Return the default font loaded from the assets/ folder and parsed by build.rs. Which is always the first item added to the fonts array.

pub fn load_sprite_from_file<P>(
    &mut self,
    path: P,
    mask_color: Color
) -> Result<SpriteRef, Box<dyn Error>> where
    P: AsRef<Path>, 
[src]

Load image from a path.

The mask color is the color that will be used as alpha in the sprite, a common color to use for this is 0xFF00FF.

Returns a reference to the image.

pub fn load_sprite_from_memory(
    &mut self,
    buffer: &[u8]
) -> Result<SpriteRef, Box<dyn Error>>
[src]

Load image from serialized memory. Returns a reference to the image.

pub fn load_font_sprite_from_file<P>(
    &mut self,
    path: P,
    settings: FontSettings
) -> Result<FontRef, Box<dyn Error>> where
    P: AsRef<Path>, 
[src]

Load font image from a path.

The mask color is the color that will be used as alpha in the sprite, a common color to use for this is 0xFF00FF.

Returns a reference to the font.

pub fn load_font_sprite_from_memory(
    &mut self,
    buffer: &[u8],
    settings: FontSettings
) -> Result<FontRef, Box<dyn Error>>
[src]

Load image from serialized memory. Returns a reference to the image.

Auto Trait Implementations

impl !Sync for Gui

impl Unpin for Gui

impl !Send for Gui

impl !UnwindSafe for Gui

impl !RefUnwindSafe for Gui

Blanket Implementations

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

impl<T> From<T> for 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.

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

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

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

impl<T> SetParameter for T

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
    T: Parameter<Self>, 

Sets value as a parameter of self.