Struct pixel_engine::EngineWrapper
source · pub struct EngineWrapper(_);
Expand description
A Wrapper around an Engine
Implementations§
source§impl EngineWrapper
impl EngineWrapper
sourcepub async fn new(title: String, size: (u32, u32, u32)) -> Self
pub async fn new(title: String, size: (u32, u32, u32)) -> Self
Create the Engine and the Wrapper
sourcepub fn new_sync(title: String, size: (u32, u32, u32)) -> Self
pub fn new_sync(title: String, size: (u32, u32, u32)) -> Self
Create the Engine and the Wrapper
Methods from Deref<Target = Engine>§
sourcepub fn get_mouse_btn(&self, btn: MouseBtn) -> Input
pub fn get_mouse_btn(&self, btn: MouseBtn) -> Input
Get the status of a Mouse Button
sourcepub fn get_mouse_location(&self) -> Vu2d
pub fn get_mouse_location(&self) -> Vu2d
Get the mouse location (in pixel) on the screen Will be defaulted to (0,0) at the start of the program
sourcepub fn get_mouse_wheel(&self) -> MouseWheel
pub fn get_mouse_wheel(&self) -> MouseWheel
Get the scroll wheel direction (If Any) during the frame
sourcepub fn get_pressed(&self) -> HashSet<Keycodes>
pub fn get_pressed(&self) -> HashSet<Keycodes>
Get all Keys pressed during the last frame
sourcepub fn get_held(&self) -> HashSet<Keycodes>
pub fn get_held(&self) -> HashSet<Keycodes>
Get all the keys that were held during the last frame
sourcepub fn get_released(&self) -> HashSet<Keycodes>
pub fn get_released(&self) -> HashSet<Keycodes>
Get all the keys that were released during the last frame
sourcepub fn create_decal(&mut self, sprite: &Sprite) -> Decal
pub fn create_decal(&mut self, sprite: &Sprite) -> Decal
Create a GPU version of Sprite
sourcepub fn clear_input_buffer(&mut self)
pub fn clear_input_buffer(&mut self)
Will clear the input buffer and set the cursor to 0
sourcepub fn set_input_buffer(&mut self, value: impl AsRef<str>)
pub fn set_input_buffer(&mut self, value: impl AsRef<str>)
Set the input buffer to the desired value and put the input cursor at the end of the text
Warning
The value must be an ascii string
sourcepub fn insert_input_buffer(&mut self, value: impl AsRef<str>)
pub fn insert_input_buffer(&mut self, value: impl AsRef<str>)
Insert the given string into the input buffer at the input cursor
Warning
if the string is not only ASCII characters it will silently do nothing
sourcepub fn append_input_buffer(&mut self, value: impl AsRef<str>)
pub fn append_input_buffer(&mut self, value: impl AsRef<str>)
Append the given string onto the input buffer
Warning
if the string is not only ASCII characters it will silently do nothing
sourcepub fn add_input_passthrough(&mut self, iterator: impl Iterator<Item = Keycodes>)
pub fn add_input_passthrough(&mut self, iterator: impl Iterator<Item = Keycodes>)
Add keys onto the input pass through list
sourcepub fn remove_input_passthrough(
&mut self,
iterator: impl Iterator<Item = Keycodes>
)
pub fn remove_input_passthrough(
&mut self,
iterator: impl Iterator<Item = Keycodes>
)
Remove keys onto the input pass through list
sourcepub fn set_input_passthrough(&mut self, iterator: impl Iterator<Item = Keycodes>)
pub fn set_input_passthrough(&mut self, iterator: impl Iterator<Item = Keycodes>)
Set the input to the iterator
sourcepub fn set_ignore_passthrough_chars(&mut self, val: bool)
pub fn set_ignore_passthrough_chars(&mut self, val: bool)
If set to true, any key that is passed through when in input mode won’t have the char appended to the input buffer
sourcepub fn get_input_buffer(&self) -> &str
pub fn get_input_buffer(&self) -> &str
Return a view into the input buffer
sourcepub fn get_input_cursor(&self) -> usize
pub fn get_input_cursor(&self) -> usize
Return the input cursor
sourcepub fn start_input(&mut self)
pub fn start_input(&mut self)
Switch to text input mode, return true if it wasn’t in this mode before
sourcepub fn force_stop_input_mode(&mut self)
pub fn force_stop_input_mode(&mut self)
This will clear the input buffer, reset the input cursor and stop the input mode
sourcepub fn is_in_input_mode(&self) -> bool
pub fn is_in_input_mode(&self) -> bool
Is the engine in input mode
sourcepub fn end_input_mode(&mut self) -> &str
pub fn end_input_mode(&mut self) -> &str
Stop the input mode right there, and return a &str to the current buffer. This is if you need to leave the mode but retain the input buffer for a later re-entry