diff options
Diffstat (limited to 'go/activities')
| -rw-r--r-- | go/activities/about.go | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/go/activities/about.go b/go/activities/about.go new file mode 100644 index 00000000..8669f5bb --- /dev/null +++ b/go/activities/about.go @@ -0,0 +1,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() +} |
