[−][src]Struct pixel_engine::Engine
The core of this library Engine handle the backend of drawing and deals with sdl2
Fields
name: String
The name the engine
size: (u32, u32, u32)
The size of the Window, formated (width,height,pixel_size)
screen: Window
The window , where the drawing methods are
elapsed: f64
the time elapsed between the start of this frame and the old one
main: &'a dyn Fn(&mut Engine) -> Result<(), String>
The user code run by the Engine
Methods
impl<'a> Engine<'a>
[src]
pub fn new(
name: &str,
size: (u32, u32, u32),
main: &'a dyn Fn(&mut Engine) -> Result<(), String>
) -> Result<Engine<'a>, String>
[src]
name: &str,
size: (u32, u32, u32),
main: &'a dyn Fn(&mut Engine) -> Result<(), String>
) -> Result<Engine<'a>, String>
Create a new game Engine
pub fn new_frame(&mut self) -> Result<bool, String>
[src]
The core of the engine, where crucial value are calculated, like elapsed or the key's vector
pub fn start(&mut self) -> Result<(), String>
[src]
Start the engine, lanch the "main" function
pub fn get_key_state(&self, key: Keycode) -> KeyState
[src]
Return the state of "key" via KeyState enum
pub fn get_pressed(&self) -> HashSet<Keycode>
[src]
Return a clone of the vector conataining pressed keys
pub fn get_held(&self) -> HashSet<Keycode>
[src]
Return a clone of the vector conataining held keys
pub fn get_released(&self) -> HashSet<Keycode>
[src]
Return a clone of the vector conataining released keys
pub fn is_pressed(&self, key: Keycode) -> bool
[src]
Return true if "key" is pressed this frame, else, return false
pub fn is_held(&self, key: Keycode) -> bool
[src]
Return true if "key" is held this frame, else, return false
pub fn is_released(&self, key: Keycode) -> bool
[src]
Return true if "key" is released this frame, else , return false
Trait Implementations
Auto Trait Implementations
impl<'a> Unpin for Engine<'a>
impl<'a> !Sync for Engine<'a>
impl<'a> !Send for Engine<'a>
impl<'a> !UnwindSafe for Engine<'a>
impl<'a> !RefUnwindSafe for Engine<'a>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,