x-backend #2

Merged
sashakoshka merged 34 commits from x-backend into main 2022-11-14 21:40:25 -07:00
2 changed files with 14 additions and 3 deletions
Showing only changes of commit b816a4abf5 - Show all commits

View File

@ -38,10 +38,14 @@ func main () {
os.Exit(0)
case stone.EventPress:
event := event.(stone.EventPress)
if stone.event.Printable() {
application.SetRune(caret, 0, rune(stone.event))
button := stone.Button(event.(stone.EventPress))
if button.Printable() {
application.SetRune(caret, 0, rune(button))
caret ++
width, _ := application.Size()
if caret >= width {
caret = 0
}
application.Draw()
}

View File

@ -1,5 +1,7 @@
package stone
import "unicode"
type Button int
const (
@ -69,3 +71,8 @@ const (
KeyF11 Button = 154
KeyF12 Button = 155
)
func (button Button) Printable () (printable bool) {
printable = unicode.IsPrint(rune(button))
return
}