player gui

This commit is contained in:
Squishy Bloob 2024-03-23 14:07:10 +00:00
parent 2a063ebcd5
commit 1a63808236
3 changed files with 15 additions and 5 deletions

BIN
assets/default-avatar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 532 B

BIN
assets/player-gui.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -1,33 +1,43 @@
package src
import (
"fmt"
. "git.danitheskunk.com/squishy/blooblib"
"git.danitheskunk.com/squishy/blooblib/color"
)
type Game struct {
gobanRenderer *GobanRenderer
boardState *BoardState
gobanRenderer *GobanRenderer
boardState *BoardState
imgPlayerGui *Image
imgDefaultAvatar *Image
}
func (g *Game) Init(bloob *Bloob, settings *Settings) {
settings.Title = "Goo v0.0"
settings.TargetFps = 240
g.imgPlayerGui = LoadImage("assets/player-gui.png")
g.imgDefaultAvatar = LoadImage("assets/default-avatar.png")
g.boardState = NewBoardState()
g.gobanRenderer = NewGobanRenderer(g.boardState)
g.boardState.Set(Vec2i{X: 3, Y: 3}, Black)
}
func (g *Game) Render(bloob *Bloob, screen *Image) {
mouseTilePos := DivScalar(bloob.MousePos, 16)
g.gobanRenderer.Render(screen)
screen.Draw(g.imgDefaultAvatar, Vec2i{X: 16, Y: 18})
screen.Draw(g.imgDefaultAvatar, Vec2i{X: 16, Y: 184})
screen.Draw(g.imgPlayerGui, Vec2i{})
screen.DrawTextOutline("Squishy Bloob", DefaultFontThin, Vec2i{X: 19, Y: 151}, color.White, color.Black)
screen.DrawTextOutline("P:10 T:23:24 B:3", DefaultFontThin, Vec2i{X: 19, Y: 162}, color.White, color.Black)
screen.DrawTextOutline("Tomato Kigu", DefaultFontThin, Vec2i{X: 19, Y: 317}, color.White, color.Black)
screen.DrawTextOutline("P:3 T: 3:24 B:2", DefaultFontThin, Vec2i{X: 19, Y: 328}, color.White, color.Black)
if mouseTilePos.X >= 10 && mouseTilePos.Y >= 1 && mouseTilePos.X < 29 && mouseTilePos.Y < 20 {
tilePos := Sub(mouseTilePos, Vec2i{X: 10, Y: 1})
g.boardState.DrawHover(screen, tilePos, Black)
}
screen.DrawText(fmt.Sprintf("%3d x %3d", bloob.MousePos.X, bloob.MousePos.Y), DefaultFont, Vec2i{10, 10}, color.White)
}
func (g *Game) Update(bloob *Bloob) {