31 lines
1,023 B
Go
31 lines
1,023 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)
|
|
|
|
DrawRectOutlineBorder(rect, border_size, border_col)
|
|
}
|
|
|
|
// DrawRectOutlineBorder draws a border (outer) around the rectangle.
|
|
func DrawRectOutlineBorder(rect rl.RectangleInt32, size int32, col color.RGBA) {
|
|
rl.DrawRectangleLinesEx(rl.Rectangle{
|
|
X: float32(rect.X - size),
|
|
Y: float32(rect.Y - size),
|
|
Width: float32(rect.Width + (size * 2)),
|
|
Height: float32(rect.Height + (size * 2)),
|
|
}, float32(size), col)
|
|
}
|