46 lines
1.6 KiB
Go
46 lines
1.6 KiB
Go
package goo
|
|
|
|
import (
|
|
. "git.danitheskunk.com/squishy/blooblib"
|
|
"git.danitheskunk.com/squishy/blooblib/color"
|
|
)
|
|
|
|
type Game struct {
|
|
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)
|
|
screen.DrawTextOutline("Chat Log Conf", DefaultFontThin, Vec2i{X: 496, Y: 5}, 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)
|
|
}
|
|
}
|
|
|
|
func (g *Game) Update(bloob *Bloob) {
|
|
}
|