Spacebar event
This commit is contained in:
parent
e5f4c3a168
commit
6e916169d6
|
@ -11,6 +11,7 @@ type State struct {
|
||||||
|
|
||||||
// Special keys
|
// Special keys
|
||||||
Escape bool
|
Escape bool
|
||||||
|
Space bool
|
||||||
Enter bool
|
Enter bool
|
||||||
Shift bool
|
Shift bool
|
||||||
Ctrl bool
|
Ctrl bool
|
||||||
|
|
|
@ -166,12 +166,14 @@ func (r *Renderer) Poll() (*event.State, error) {
|
||||||
s.Ctrl = t.State == 1
|
s.Ctrl = t.State == 1
|
||||||
case sdl.SCANCODE_RCTRL:
|
case sdl.SCANCODE_RCTRL:
|
||||||
s.Ctrl = t.State == 1
|
s.Ctrl = t.State == 1
|
||||||
|
case sdl.SCANCODE_SPACE:
|
||||||
|
s.Space = t.State == 1
|
||||||
case sdl.SCANCODE_BACKSPACE:
|
case sdl.SCANCODE_BACKSPACE:
|
||||||
// Make it a key event with "\b" as the sequence.
|
// Make it a key event with "\b" as the sequence.
|
||||||
s.SetKeyDown(`\b`, t.State == 1 || t.Repeat == 1)
|
s.SetKeyDown(`\b`, t.State == 1 || t.Repeat == 1)
|
||||||
default:
|
default:
|
||||||
// Push the string value of the key.
|
// Push the string value of the key.
|
||||||
s.SetKeyDown(string(t.Keysym.Sym), t.State == 1)
|
s.SetKeyDown(string(t.Keysym.Sym), t.State == 1 || t.Repeat == 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user