This repository has been archived on 2024-01-17. You can view files and clone it, but cannot push or open issues or pull requests.
2021-08-30 19:48:39 +00:00
|
|
|
package kibodo
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/hajimehoshi/ebiten/v2"
|
|
|
|
)
|
|
|
|
|
2021-09-16 07:37:37 +00:00
|
|
|
// Key represents a virtual key.
|
2021-08-30 19:48:39 +00:00
|
|
|
type Key struct {
|
|
|
|
LowerLabel string
|
|
|
|
UpperLabel string
|
|
|
|
LowerInput *Input
|
|
|
|
UpperInput *Input
|
|
|
|
|
|
|
|
x, y int
|
|
|
|
w, h int
|
2021-09-14 02:49:10 +00:00
|
|
|
|
2021-09-16 07:37:37 +00:00
|
|
|
pressed bool
|
|
|
|
pressedTouchID ebiten.TouchID
|
2021-08-30 19:48:39 +00:00
|
|
|
}
|
|
|
|
|
2021-09-16 07:37:37 +00:00
|
|
|
// Input represents the input from a key press.
|
2021-08-30 19:48:39 +00:00
|
|
|
type Input struct {
|
|
|
|
Rune rune
|
|
|
|
Key ebiten.Key
|
|
|
|
}
|
|
|
|
|
|
|
|
func (i *Input) String() string {
|
|
|
|
if i.Rune > 0 {
|
|
|
|
return string(i.Rune)
|
|
|
|
}
|
|
|
|
return i.Key.String()
|
|
|
|
}
|