added game font rendering using etxt to player hud, fixed current level

This commit is contained in:
2024-03-01 18:10:09 +01:00
parent ae8058e052
commit a2ed7782b2
10 changed files with 41 additions and 17 deletions

View File

@@ -29,6 +29,7 @@ func NewLevelScene(game *Game, startlevel int) Scene {
func (scene *LevelScene) GenerateLevels(game *Game) {
min := []int{}
for _, level := range assets.Levels {
level := level
scene.Levels = append(scene.Levels, NewLevel(game, 32, &level))
min = append(min, level.MinMoves)
}

View File

@@ -91,7 +91,7 @@ func (scene *NextlevelScene) SetupUILast() {
rowContainer := gameui.NewRowContainer(false)
label1text := "Last level, congratulations!"
label2text := fmt.Sprintf("Your final score: %d", observer.GetLevelScore())
label2text := fmt.Sprintf("Your final score: %d", observer.GetScore())
buttonMenu := gameui.NewMenuButton("Menu", *assets.FontRenderer.FontNormal,
func(args *widget.ButtonClickedEventArgs) {

View File

@@ -134,7 +134,7 @@ func (scene *SelectScene) SetupUI() {
}),
// This required function returns the string displayed in the list
widget.ListOpts.EntryLabelFunc(func(e interface{}) string {
return e.(LevelEntry).Name
return fmt.Sprintf("%02d %s", e.(LevelEntry).Id, e.(LevelEntry).Name)
}),
// Padding for each entry
widget.ListOpts.EntryTextPadding(widget.NewInsetsSimple(5)),