44 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| 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{
 | |
| 		title,
 | |
| 		`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 :)`,
 | |
| 		"q return",
 | |
| 	}
 | |
| }
 | |
| 
 | |
| 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)
 | |
| 		case "Enter", "q":
 | |
| 			ui.ViewChange <- NewMainMenu()
 | |
| 		}
 | |
| 		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})
 | |
| 	win.New(win.Width/2-4, win.Height/2+6, 8, 1).Print(vaxis.Segment{Text: credits.help})
 | |
| 	return
 | |
| }
 |