goo/internal/game.go

46 lines
1.6 KiB
Go
Raw Permalink Normal View History

package goo
2024-03-23 09:10:26 +01:00
import (
. "git.danitheskunk.com/squishy/blooblib"
2024-03-23 13:54:00 +01:00
"git.danitheskunk.com/squishy/blooblib/color"
2024-03-23 09:10:26 +01:00
)
type Game struct {
2024-03-23 15:07:10 +01:00
gobanRenderer *GobanRenderer
boardState *BoardState
imgPlayerGui *Image
imgDefaultAvatar *Image
2024-03-23 09:10:26 +01:00
}
2024-03-23 13:54:00 +01:00
func (g *Game) Init(bloob *Bloob, settings *Settings) {
2024-03-23 09:10:26 +01:00
settings.Title = "Goo v0.0"
2024-03-23 13:54:00 +01:00
settings.TargetFps = 240
2024-03-23 15:07:10 +01:00
g.imgPlayerGui = LoadImage("assets/player-gui.png")
g.imgDefaultAvatar = LoadImage("assets/default-avatar.png")
2024-03-23 09:10:26 +01:00
g.boardState = NewBoardState()
g.gobanRenderer = NewGobanRenderer(g.boardState)
2024-03-23 13:54:00 +01:00
g.boardState.Set(Vec2i{X: 3, Y: 3}, Black)
2024-03-23 09:10:26 +01:00
}
2024-03-23 13:54:00 +01:00
func (g *Game) Render(bloob *Bloob, screen *Image) {
mouseTilePos := DivScalar(bloob.MousePos, 16)
2024-03-23 09:10:26 +01:00
g.gobanRenderer.Render(screen)
2024-03-23 15:07:10 +01:00
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)
2024-03-24 01:14:26 +01:00
screen.DrawTextOutline("Chat Log Conf", DefaultFontThin, Vec2i{X: 496, Y: 5}, color.White, color.Black)
2024-03-23 13:54:00 +01:00
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)
}
2024-03-23 09:10:26 +01:00
}
2024-03-23 13:54:00 +01:00
func (g *Game) Update(bloob *Bloob) {
2024-03-23 09:10:26 +01:00
}