Struct direct_gui::Gui
[−]
[src]
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]
&mut self,
buffer: &mut Vec<u32>,
font_ref: FontRef,
string: &String,
pos: (i32, i32)
)
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<Error>>
[src]
&self,
control_ref: ControlRef
) -> Result<&T, Box<Error>>
Retrieve a control by reference.
pub fn get_mut<T: 'static + Control>(
&mut self,
control_ref: ControlRef
) -> Result<&mut T, Box<Error>>
[src]
&mut self,
control_ref: ControlRef
) -> Result<&mut T, Box<Error>>
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<Error>> where
P: AsRef<Path>,
[src]
&mut self,
path: P,
mask_color: Color
) -> Result<SpriteRef, Box<Error>> where
P: AsRef<Path>,
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<Error>>
[src]
&mut self,
buffer: &[u8]
) -> Result<SpriteRef, Box<Error>>
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<Error>> where
P: AsRef<Path>,
[src]
&mut self,
path: P,
settings: FontSettings
) -> Result<FontRef, Box<Error>> where
P: AsRef<Path>,
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<Error>>
[src]
&mut self,
buffer: &[u8],
settings: FontSettings
) -> Result<FontRef, Box<Error>>
Load image from serialized memory. Returns a reference to the image.