step
This commit is contained in:
parent
0bec81c656
commit
fe6d2c0ed3
190 changed files with 104835 additions and 5 deletions
35
examples/core/input_mouse/main.go
Normal file
35
examples/core/input_mouse/main.go
Normal file
|
@ -0,0 +1,35 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/gen2brain/raylib-go/raylib"
|
||||
)
|
||||
|
||||
func main() {
|
||||
rl.InitWindow(800, 450, "raylib [core] example - mouse input")
|
||||
rl.SetTargetFPS(60)
|
||||
|
||||
ballColor := rl.DarkBlue
|
||||
|
||||
for !rl.WindowShouldClose() {
|
||||
ballPosition := rl.GetMousePosition()
|
||||
|
||||
if rl.IsMouseButtonPressed(rl.MouseLeftButton) {
|
||||
ballColor = rl.Maroon
|
||||
} else if rl.IsMouseButtonPressed(rl.MouseMiddleButton) {
|
||||
ballColor = rl.Lime
|
||||
} else if rl.IsMouseButtonPressed(rl.MouseRightButton) {
|
||||
ballColor = rl.DarkBlue
|
||||
}
|
||||
|
||||
rl.BeginDrawing()
|
||||
|
||||
rl.ClearBackground(rl.RayWhite)
|
||||
rl.DrawCircleV(ballPosition, 40, ballColor)
|
||||
|
||||
rl.DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, rl.DarkGray)
|
||||
|
||||
rl.EndDrawing()
|
||||
}
|
||||
|
||||
rl.CloseWindow()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue