neofeels/app/credits.go

44 lines
1.1 KiB
Go
Raw Normal View History

2025-01-05 16:40:26 +00:00
package app
import (
"git.sr.ht/~rockorager/vaxis"
"git.tilde.town/nbsp/neofeels/ui"
)
type Credits struct {
title string
credits string
help string
}
func NewCredits() *Credits {
return &Credits{
2025-01-05 19:42:53 +00:00
title,
2025-01-05 16:40:26 +00:00
`ttbp written for tilde.town by ~endorphant in python
neofeels written by ~nbsp in go
tips for development of ttbp are accepted at https://liberapay.com/modgethanc/
tips for development of neofeels are accepted at https://liberapay.com/nbsp/
kind words are also extremely appreciated :)`,
2025-01-05 19:42:53 +00:00
"q return",
2025-01-05 16:40:26 +00:00
}
}
func (credits *Credits) Event(state *ui.State, event vaxis.Event) (processed bool) {
if key, ok := event.(vaxis.Key); ok && key.EventType == vaxis.EventPress {
switch key.String() {
case "Ctrl+c", "Ctrl+d":
close(ui.Quit)
2025-01-05 20:58:43 +00:00
case "Enter", "q", "h", "l", "Left", "Right":
2025-01-09 02:54:03 +00:00
ui.ViewChange <- NewMainMenu(7)
2025-01-05 16:40:26 +00:00
}
processed = true
}
win := state.Window()
win.New(win.Width/2-10, win.Height/2-8, 20, 5).Print(vaxis.Segment{Text: credits.title})
win.New(win.Width/2-40, win.Height/2-2, 80, 7).Print(vaxis.Segment{Text: credits.credits})
2025-01-05 19:42:53 +00:00
win.New(win.Width/2-4, win.Height/2+6, 8, 1).Print(vaxis.Segment{Text: credits.help})
2025-01-05 16:40:26 +00:00
return
}