Functions to check for common buttons/keys
This commit is contained in:
@@ -89,23 +89,23 @@ func (this *Button) applyLayout () {
|
||||
}
|
||||
|
||||
func (this *Button) handleKeyDown (key input.Key, numberPad bool) bool {
|
||||
if key != input.KeyEnter && key != input.Key(' ') { return false }
|
||||
if !isClickingKey(key) { return false }
|
||||
this.on.click.Broadcast()
|
||||
return true
|
||||
}
|
||||
|
||||
func (this *Button) handleKeyUp (key input.Key, numberPad bool) bool {
|
||||
if key != input.KeyEnter && key != input.Key(' ') { return false }
|
||||
if !isClickingKey(key) { return false }
|
||||
return true
|
||||
}
|
||||
|
||||
func (this *Button) handleButtonDown (button input.Button) bool {
|
||||
if button != input.ButtonLeft { return false }
|
||||
if !isClickingButton(button) { return false }
|
||||
return true
|
||||
}
|
||||
|
||||
func (this *Button) handleButtonUp (button input.Button) bool {
|
||||
if button != input.ButtonLeft { return false }
|
||||
if !isClickingButton(button) { return false }
|
||||
if this.Window().MousePosition().In(this.Bounds()) {
|
||||
this.on.click.Broadcast()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user