color setting, drawing

This commit is contained in:
Gnawmon 2024-04-23 13:59:12 +03:00
parent cdfecd5ae3
commit 30a4bafcf3
1 changed files with 12 additions and 3 deletions

15
bf.go
View File

@ -18,7 +18,8 @@ var (
ballpos = rl.Vector2{X: 400, Y: 225}
speed = 3
squareSize = 100
squares = [5]rl.Vector2{{X: 640 - float32(squareSize), Y: 315}, {X: 640, Y: 315}, {X: 640 + float32(squareSize), Y: 315}, {X: 640, Y: 315 - float32(squareSize)}, {X: 640, Y: 315 - float32(squareSize)*2}}
squares = []rl.Vector2{{X: 640 - float32(squareSize), Y: 315}, {X: 640, Y: 315}, {X: 640 + float32(squareSize), Y: 315}, {X: 640, Y: 315 - float32(squareSize)}, {X: 640, Y: 315 - float32(squareSize)*2}}
paints = []paint{}
)
func main() {
@ -26,7 +27,6 @@ func main() {
checkUserdataValid(userdata)
rl.InitWindow(screenWidth, screenHeight, "balls offline")
guessy4 := rl.LoadFont("guessy4.ttf")
rl.SetTargetFPS(60)
@ -52,6 +52,10 @@ func main() {
moveBall()
drawTextShadow(userdata["username"].(string), rl.Vector2{X: ballpos.X - ballRadius - 24, Y: ballpos.Y - ballRadius - 40}, guessy4)
for paint := range paints {
rl.DrawRectangleV(paint.location, ballRadius, rl.Black)
}
drawTextShadow("your name", rl.Vector2{X: ballpos.X - ballRadius - 24, Y: ballpos.Y - ballRadius - 40}, guessy4)
rl.EndDrawing()
@ -61,7 +65,7 @@ func main() {
rl.CloseWindow()
}
func draw() {
rl.DrawRectangle(int32(ballpos.X), int32(ballpos.Y), ballRadius, ballRadius, rl.Black)
}
func moveBall() {
@ -145,3 +149,8 @@ func checkCollision(newPos rl.Vector2) bool {
}
return false
}
type paint struct {
time float32
location rl.Vector2
}