Skip to content

Commit

Permalink
Add version text to main menu
Browse files Browse the repository at this point in the history
  • Loading branch information
rzaf committed Feb 28, 2024
1 parent 3cfc09a commit de80f14
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions states/menu/menu.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ var (
menu *game.Menu
gameCamera ray.Camera2D = ray.NewCamera2D(ray.NewVector2(0, 0), ray.NewVector2(0, 0), 0, 1)
githubProfileLink *core.Button
gitVersion *core.Text
)

type MainMenu struct{}
Expand All @@ -23,6 +24,7 @@ func (m MainMenu) OnEnter() {
game.TileManager.GameMap = &game.GameMap{}
game.TileManager.LoadFromFile("assets/menuMap.txt")
if githubProfileLink == nil {
gitVersion = core.NewText("v 0.1.0", ray.GetFontDefault(), ray.NewVector2(float32(game.Width)-70, float32(game.Height)-20), 15, 2, ray.White)
t2 := core.NewText("github.com/rzaf/bomberman-clone", ray.GetFontDefault(), ray.NewVector2(90, float32(game.Height)-20), 15, 2, ray.White)
githubProfileLink = core.NewTextButton(
t2,
Expand Down Expand Up @@ -68,6 +70,7 @@ func (MainMenu) OnWindowResized() {
menu.Pos.Y = float32(game.Height)/2 - 200
menu.Refresh()
fitCamera()
gitVersion.Pos = ray.NewVector2(float32(game.Width)-70, float32(game.Height)-20)
githubProfileLink.Text.Pos = ray.NewVector2(90, float32(game.Height)-20)
githubProfileLink.Boundary.Y = githubProfileLink.Text.Pos.Y
}
Expand Down Expand Up @@ -100,5 +103,6 @@ func (MainMenu) Draw() {
ray.DrawRectangle(0, 0, int32(ray.GetScreenWidth()), int32(ray.GetScreenHeight()), ray.NewColor(0, 0, 0, 150))
menu.Draw()
ray.DrawText("Source Code:", 5, int32(game.Height)-18, 12, ray.White)
gitVersion.Draw()
githubProfileLink.Draw()
}

0 comments on commit de80f14

Please sign in to comment.