This commit is contained in:
Quaternions 2023-10-18 21:01:00 -07:00
parent c301477a2e
commit 7bff8bca28

View File

@ -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
} }
} }