scroll on tools to rotate between variants

This commit is contained in:
Crispy 2024-10-13 00:55:28 +02:00
parent ed956ffbe4
commit 44017f4ed5
5 changed files with 145 additions and 69 deletions

View file

@ -250,6 +250,22 @@ impl WireType {
}
}
pub fn next(&mut self) {
*self = match self {
WireType::Vertical => WireType::Horizontal,
WireType::Horizontal => WireType::Cross,
WireType::Cross => WireType::Vertical,
}
}
pub fn prev(&mut self) {
*self = match self {
WireType::Vertical => WireType::Cross,
WireType::Horizontal => WireType::Vertical,
WireType::Cross => WireType::Horizontal,
}
}
pub const fn texture_name(&self) -> &'static str {
match self {
WireType::Vertical => "wire_vertical",
@ -277,6 +293,13 @@ impl MirrorType {
}
}
pub fn flip(&mut self) {
*self = match self {
MirrorType::Forward => MirrorType::Back,
MirrorType::Back => MirrorType::Forward,
}
}
pub const fn texture_name(&self) -> &'static str {
match self {
MirrorType::Forward => "mirror_forward",
@ -295,6 +318,26 @@ impl MathOp {
MathOp::Rem => "rem",
}
}
pub fn next(&mut self) {
*self = match self {
MathOp::Add => MathOp::Sub,
MathOp::Sub => MathOp::Mul,
MathOp::Mul => MathOp::Div,
MathOp::Div => MathOp::Rem,
MathOp::Rem => MathOp::Add,
}
}
pub fn prev(&mut self) {
*self = match self {
MathOp::Add => MathOp::Rem,
MathOp::Sub => MathOp::Add,
MathOp::Mul => MathOp::Sub,
MathOp::Div => MathOp::Mul,
MathOp::Rem => MathOp::Div,
}
}
}
impl GateType {
@ -306,4 +349,22 @@ impl GateType {
GateType::NotEqual => "neq",
}
}
pub fn next(&mut self) {
*self = match self {
GateType::LessThan => GateType::GreaterThan,
GateType::GreaterThan => GateType::Equal,
GateType::Equal => GateType::NotEqual,
GateType::NotEqual => GateType::LessThan,
}
}
pub fn prev(&mut self) {
*self = match self {
GateType::LessThan => GateType::NotEqual,
GateType::GreaterThan => GateType::LessThan,
GateType::Equal => GateType::GreaterThan,
GateType::NotEqual => GateType::Equal,
}
}
}