step
This commit is contained in:
parent
05e7c1f5e7
commit
2f5d911417
193 changed files with 5 additions and 104847 deletions
|
@ -1,41 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/gen2brain/raylib-go/raylib"
|
||||
)
|
||||
|
||||
func main() {
|
||||
screenWidth := int32(800)
|
||||
screenHeight := int32(450)
|
||||
|
||||
rl.InitWindow(screenWidth, screenHeight, "raylib [core] example - keyboard input")
|
||||
|
||||
ballPosition := rl.NewVector2(float32(screenWidth)/2, float32(screenHeight)/2)
|
||||
|
||||
rl.SetTargetFPS(60)
|
||||
|
||||
for !rl.WindowShouldClose() {
|
||||
if rl.IsKeyDown(rl.KeyRight) {
|
||||
ballPosition.X += 0.8
|
||||
}
|
||||
if rl.IsKeyDown(rl.KeyLeft) {
|
||||
ballPosition.X -= 0.8
|
||||
}
|
||||
if rl.IsKeyDown(rl.KeyUp) {
|
||||
ballPosition.Y -= 0.8
|
||||
}
|
||||
if rl.IsKeyDown(rl.KeyDown) {
|
||||
ballPosition.Y += 0.8
|
||||
}
|
||||
|
||||
rl.BeginDrawing()
|
||||
rl.ClearBackground(rl.RayWhite)
|
||||
|
||||
rl.DrawText("move the ball with arrow keys", 10, 10, 20, rl.DarkGray)
|
||||
rl.DrawCircleV(ballPosition, 50, rl.Maroon)
|
||||
|
||||
rl.EndDrawing()
|
||||
}
|
||||
|
||||
rl.CloseWindow()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue