State returns the raw state of a key.
()
| 79 | |
| 80 | // State returns the raw state of a key. |
| 81 | func (key *KeyState) State() int { |
| 82 | if key.lastState { |
| 83 | if key.currentState { |
| 84 | return KeyStateDown |
| 85 | } |
| 86 | return KeyStateJustUp |
| 87 | } |
| 88 | if key.currentState { |
| 89 | return KeyStateJustDown |
| 90 | } |
| 91 | return KeyStateUp |
| 92 | } |
| 93 | |
| 94 | // JustPressed returns whether a key was just pressed |
| 95 | func (key KeyState) JustPressed() bool { |