-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtitle_draw.go
47 lines (38 loc) · 1.6 KB
/
title_draw.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
45
46
47
package main
import (
"fmt"
"github.com/hajimehoshi/ebiten/v2"
"github.com/hajimehoshi/ebiten/v2/text"
)
func (g *Game) TitleDraw(screen *ebiten.Image) {
titleOp := &ebiten.DrawImageOptions{}
titleOp.GeoM.Scale(0.5, 0.5)
screen.DrawImage(TitleImage, titleOp)
if LDConnection == "ok" {
ldButtonOP := &ebiten.DrawImageOptions{}
if x, y := ebiten.CursorPosition(); x <= 350 && y <= 200 {
screen.DrawImage(LDButtonActiveImage, ldButtonOP)
} else {
screen.DrawImage(LDButtonImage, ldButtonOP)
}
}
ldConnectionOp := &ebiten.DrawImageOptions{}
ldConnectionOp.GeoM.Scale(0.5, 0.5)
ldConnectionOp.GeoM.Translate(10, SCREENHEIGHT-5)
text.DrawWithOptions(screen, fmt.Sprintf("Leaderboard connection: %v", LDConnection), MyEpicGamerFont, ldConnectionOp)
versionOp := &ebiten.DrawImageOptions{}
versionOp.GeoM.Scale(0.5, 0.5)
versionOp.GeoM.Translate(10, SCREENHEIGHT-30)
text.DrawWithOptions(screen, fmt.Sprintf("Version: %v", VERSION), MyEpicGamerFont, versionOp)
userNameOp := &ebiten.DrawImageOptions{}
userNameOp.GeoM.Scale(0.5, 0.5)
userNameOp.GeoM.Translate(10, SCREENHEIGHT-55)
text.DrawWithOptions(screen, fmt.Sprintf("User Name: %v", UInfo.Name), MyEpicGamerFont, userNameOp)
editInfoMsg := "press i to edit your leaderboard information"
editInfoMsgOp := &ebiten.DrawImageOptions{}
editInfoMsgOp.GeoM.Scale(0.5, 0.5)
editInfoMsgOp.GeoM.Translate(
float64((SCREENWIDTH - text.BoundString(MyEpicGamerFont, editInfoMsg).Dx()/2 - 15)),
float64(SCREENHEIGHT-text.BoundString(MyEpicGamerFont, editInfoMsg).Dy()/2+10))
text.DrawWithOptions(screen, editInfoMsg, MyEpicGamerFont, editInfoMsgOp)
}