forked from gen2brain/raylib-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
36 lines (25 loc) · 797 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package main
import (
"github.com/gen2brain/raylib-go/raylib"
)
func main() {
screenWidth := int32(800)
screenHeight := int32(450)
rl.InitWindow(screenWidth, screenHeight, "raylib [shapes] example - cubic-bezier lines")
start := rl.NewVector2(0, 0)
end := rl.NewVector2(float32(screenWidth), float32(screenHeight))
rl.SetTargetFPS(60)
for !rl.WindowShouldClose() {
if rl.IsMouseButtonDown(rl.MouseLeftButton) {
start = rl.GetMousePosition()
} else if rl.IsMouseButtonDown(rl.MouseRightButton) {
end = rl.GetMousePosition()
}
rl.BeginDrawing()
rl.ClearBackground(rl.RayWhite)
rl.DrawText("USE MOUSE LEFT-RIGHT CLICK to DEFINE LINE START and END POINTS", 15, 20, 20, rl.Gray)
rl.DrawLineBezier(start, end, 2.0, rl.Red)
rl.EndDrawing()
}
rl.CloseWindow()
}