forked from MoonsideGames/MoonWorks
combine button states
parent
d07a722fb1
commit
ab619192a6
|
@ -34,5 +34,28 @@
|
|||
|
||||
return new ButtonState(ButtonStatus.Released);
|
||||
}
|
||||
|
||||
public static ButtonState operator |(ButtonState a, ButtonState b)
|
||||
{
|
||||
if (a.ButtonStatus == ButtonStatus.Released)
|
||||
{
|
||||
return b;
|
||||
}
|
||||
else if (a.ButtonStatus == ButtonStatus.Pressed)
|
||||
{
|
||||
if (b.ButtonStatus == ButtonStatus.Held)
|
||||
{
|
||||
return new ButtonState(ButtonStatus.Held);
|
||||
}
|
||||
else
|
||||
{
|
||||
return a;
|
||||
}
|
||||
}
|
||||
else // held
|
||||
{
|
||||
return a;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue