fix divide by zero crashes when mouse has not moved
This commit is contained in:
parent
a612d1f864
commit
76bafa4d0a
@ -14,6 +14,7 @@ impl<T> Time<T>{
|
||||
pub const MIN:Self=Self::raw(i64::MIN);
|
||||
pub const MAX:Self=Self::raw(i64::MAX);
|
||||
pub const ZERO:Self=Self::raw(0);
|
||||
pub const EPSILON:Self=Self::raw(1);
|
||||
pub const ONE_SECOND:Self=Self::raw(1_000_000_000);
|
||||
pub const ONE_MILLISECOND:Self=Self::raw(1_000_000);
|
||||
pub const ONE_MICROSECOND:Self=Self::raw(1_000);
|
||||
|
@ -71,7 +71,7 @@ pub enum InternalInstruction{
|
||||
// Water,
|
||||
}
|
||||
|
||||
#[derive(Clone,Debug,Default)]
|
||||
#[derive(Clone,Debug)]
|
||||
pub struct InputState{
|
||||
mouse:MouseState,
|
||||
next_mouse:MouseState,
|
||||
@ -104,6 +104,15 @@ impl InputState{
|
||||
((dm*t)/dt).as_ivec2()
|
||||
}
|
||||
}
|
||||
impl Default for InputState{
|
||||
fn default()->Self{
|
||||
Self{
|
||||
mouse:MouseState{pos:Default::default(),time:Time::ZERO-Time::EPSILON*2},
|
||||
next_mouse:MouseState{pos:Default::default(),time:Time::ZERO-Time::EPSILON},
|
||||
controls:Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
#[derive(Clone,Debug)]
|
||||
enum JumpDirection{
|
||||
Exactly(Planar64Vec3),
|
||||
|
Loading…
x
Reference in New Issue
Block a user