pub struct Settings {
pub gamepads: Option<Gilrs>,
pub min_frame_duration: Option<Duration>,
}
Expand description
run time settings for thin engine including gamepad settings (through gilrs) and fps settings.
when running default()
the gamepads may fail to initialise and the program will continue
running after printing the error. if this is undesirable use with_gamepads()
instead.
Fields§
§gamepads: Option<Gilrs>
§min_frame_duration: Option<Duration>
Implementations§
Source§impl Settings
impl Settings
pub fn new( gamepads: Option<Gilrs>, min_frame_duration: Option<Duration>, ) -> Self
Sourcepub fn from_fps(fps: u32) -> Self
pub fn from_fps(fps: u32) -> Self
creates settings with the minimum frame duration set to 1/fps.
Sourcepub fn with_gamepads() -> Result<Self, Error>
pub fn with_gamepads() -> Result<Self, Error>
guarantees gamepads will be set instead of printing an error and moving on.
Sourcepub fn set_target_fps(&mut self, target_fps: Option<u32>)
pub fn set_target_fps(&mut self, target_fps: Option<u32>)
sets the minimum frame duration to 1/fps or none if inputed.
pub fn get_fps(&self) -> Option<u32>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Settings
impl RefUnwindSafe for Settings
impl Send for Settings
impl !Sync for Settings
impl Unpin for Settings
impl UnwindSafe for Settings
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.