1
0
Fork 0
tetris-go/engine/render/rect.go
2025-09-14 22:16:29 +02:00

26 lines
857 B
Go

package render
import (
"image/color"
rl "github.com/gen2brain/raylib-go/raylib"
)
// DrawRectBorder draw a rectangle with a border around it.
// Note that the rectangle passed as the 'rect' parameter to the function represents the actual
// rectangle. The border will be drawn around it in all directions (outer border).
func DrawRectBorder(rect rl.RectangleInt32, col color.RGBA, border_size int32, border_col color.RGBA) {
rl.DrawRectangleRec(rl.Rectangle{
X: float32(rect.X),
Y: float32(rect.Y),
Width: float32(rect.Width),
Height: float32(rect.Height),
}, col)
rl.DrawRectangleLinesEx(rl.Rectangle{
X: float32(rect.X - border_size),
Y: float32(rect.Y - border_size),
Width: float32(rect.Width + (border_size * 2)),
Height: float32(rect.Height + (border_size * 2)),
}, float32(border_size), border_col)
}