-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloading_screen.go
44 lines (33 loc) · 1.09 KB
/
loading_screen.go
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
package main
import (
"image/color"
"github.com/hajimehoshi/ebiten/v2"
)
var loadingLog []string
type LoadingScreen struct {
Screen
}
// Process drawing of loading screen in drawing goroutine
func (s *LoadingScreen) Draw(screen *ebiten.Image) {
op := &ebiten.DrawImageOptions{}
op.GeoM.Translate(-float64(splash.Bounds().Dx())/2, -float64(splash.Bounds().Dy())/2)
op.GeoM.Translate(screenWidth/2, screenHeight/2)
screen.DrawImage(splash, op)
s.game.systemFontRenderer.DrawTextFormattedAt(screen, "Loading...", TextFormat{textColor: color.White, scale: 2.0, shadow: true}, 10, 10)
for i, logString := range loadingLog {
s.game.systemFontRenderer.DrawTextFormattedAt(screen, logString, TextFormat{textColor: color.White, scale: 1.0, shadow: true}, 10, 32+float64(i*16))
}
}
func (s *LoadingScreen) ProcessKeyEvents() bool {
return true
}
func (s *LoadingScreen) Update() {
if s.game.ready {
s.game.SetScreen(CreateMainMenu(s.game))
}
}
func NewLoadingScreen(g *Game) *LoadingScreen {
screen := new(LoadingScreen)
screen.game = g
return screen
}