rustge
This commit is contained in:
parent
abbab00eea
commit
a6c51654e5
@ -73,20 +73,11 @@ impl InputInstruction{
|
|||||||
|crate::physics::InputInstruction::Reset
|
|crate::physics::InputInstruction::Reset
|
||||||
|crate::physics::InputInstruction::Idle=>0u32,
|
|crate::physics::InputInstruction::Idle=>0u32,
|
||||||
};
|
};
|
||||||
let id=match self{
|
self.discriminant()|parity
|
||||||
crate::physics::InputInstruction::MoveRight(_)=>0,
|
}
|
||||||
crate::physics::InputInstruction::MoveUp(_)=>1,
|
pub fn discriminant(&self)->u32{
|
||||||
crate::physics::InputInstruction::MoveBack(_)=>2,
|
//from documentation for std::mem::discriminant(&self)
|
||||||
crate::physics::InputInstruction::MoveLeft(_)=>3,
|
unsafe{*<*const _>::from(self).cast::<u32>()}
|
||||||
crate::physics::InputInstruction::MoveDown(_)=>4,
|
|
||||||
crate::physics::InputInstruction::MoveForward(_)=>5,
|
|
||||||
crate::physics::InputInstruction::Jump(_)=>6,
|
|
||||||
crate::physics::InputInstruction::Zoom(_)=>7,
|
|
||||||
crate::physics::InputInstruction::MoveMouse(_)=>8,
|
|
||||||
crate::physics::InputInstruction::Reset=>9,
|
|
||||||
crate::physics::InputInstruction::Idle=>10,
|
|
||||||
};
|
|
||||||
id|parity
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[derive(Clone,Hash)]
|
#[derive(Clone,Hash)]
|
||||||
|
Loading…
Reference in New Issue
Block a user