aboutsummaryrefslogtreecommitdiff
path: root/go/activities/about.go
blob: 8669f5bbeed41ee8a283520bf74c0f731ef9e97f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package activities

import (
	"image/color"

	"muhq.space/muhqs-game/go/ui"
)

// About is an Activity that presents the about information in a scrollable buffer.
// It features an arrow back button calling activities.PopActivity().
type About struct {
	ui.Collection
}

var about = [...]string{
	" ",
	"Muhq's Game",
	"Copyright Florian Fischer",
	"Game material GNU Free Documentation License",
	"Implementation GNU GPL 3+",
	" ",
	"Font: Antykwa Torunska",
	"Designer: Zygfryd Gardzielewski",
	"Author: Janusz Marian Nowacki",
	"This work is released under the GUST Font Nosource License",
	" ",
	"Used go packages",
	"github.com/RyanCarrier/dijkstra -  MIT License",
	"github.com/hajimehoshi/ebiten - Apache 2.0 license",
	"golang.org/x/image - BSD-3-Clause",
	"golang.org/x/net - BSD-3-Clause",
	"gopkg.in/yaml.v3",
}

const ABOUT_MARGIN = 25

func NewAbout(width, height int) *About {
	a := &About{ui.Collection{Width: width, Height: height}}

	buffer := ui.NewBuffer(ABOUT_MARGIN, ABOUT_MARGIN, width-2*ABOUT_MARGIN, height-2*ABOUT_MARGIN)
	a.AddWidget(buffer)
	buffer.Bg(color.Black)
	buffer.AddLines(about[:])

	back := ui.NewRoundSimpleButton(5, 5, 40, "←", func(*ui.SimpleButton) { PopActivity() })
	a.AddWidget(back)

	return a
}

func (a *About) Layout(int, int) (int, int) {
	return a.Width, a.Height
}

func (a *About) Update() error {
	if err := ui.Update(); err != nil {
		return err
	}
	return a.Collection.Update()
}