updated to raylib

This commit is contained in:
partisan 2024-12-20 18:58:53 +01:00
parent f82fa6ef37
commit 84fe6fe9eb
18 changed files with 1065 additions and 1130 deletions

21
input.go Normal file
View file

@ -0,0 +1,21 @@
package main
import rl "github.com/gen2brain/raylib-go/raylib"
// Check if a point is over a rectangle
func overRect(p rl.Vector2, r rl.Rectangle) bool {
return p.X >= r.X && p.X <= r.X+r.Width && p.Y >= r.Y && p.Y <= r.Y+r.Height
}
// Check if a point is over a circle
func overCircle(p rl.Vector2, center rl.Vector2, radius float32) bool {
dx := p.X - center.X
dy := p.Y - center.Y
return (dx*dx + dy*dy) <= (radius * radius)
}
// Simplified helper to check if mouse is over a button-like rectangle
func overButton(mousePos rl.Vector2, x, y, w, h int32) bool {
r := rl.Rectangle{X: float32(x), Y: float32(y), Width: float32(w), Height: float32(h)}
return overRect(mousePos, r)
}