Update binding, add core_input_mouse example

This commit is contained in:
TSnake41 2021-02-02 20:42:17 +01:00
parent 88b7d0f17e
commit 7d11e0ea51
3 changed files with 32 additions and 2 deletions

View File

@ -0,0 +1,30 @@
rl.SetTraceLogLevel(rl.LOG_WARNING)
rl.SetConfigFlags(rl.FLAG_VSYNC_HINT)
rl.InitWindow(800, 450, "raylib [core] example - mouse input");
local ball_position = rl.new("Vector2", -100, -100)
local ball_color = rl.DARKBLUE
while not rl.WindowShouldClose() do
ball_position.x = rl.GetMouseX()
ball_position.y = rl.GetMouseY()
if rl.IsMouseButtonPressed(rl.MOUSE_LEFT_BUTTON) then
ball_color = rl.MAROON
elseif rl.IsMouseButtonPressed(rl.MOUSE_MIDDLE_BUTTON) then
ball_color = rl.LIME
elseif rl.IsMouseButtonPressed(rl.MOUSE_RIGHT_BUTTON) then
ball_color = rl.DARKBLUE
end
rl.BeginDrawing()
rl.ClearBackground(rl.RAYWHITE)
rl.DrawCircleV(ball_position, 40, ball_color)
rl.DrawText("move ball with mouse and click mouse button to change color",
10, 10, 20, rl.DARKGRAY)
rl.EndDrawing()
end
rl.CloseWindow()

View File

@ -20,7 +20,7 @@ circle.enabled = false
rl.SetTargetFPS(60)
while not rl.WindowShouldClose() do
rl.RunPhysicsStep()
rl.UpdatePhysics()
if needsReset then
floor = rl.CreatePhysicsBodyRectangle({ screenWidth/2, screenHeight }, 500, 100, 10)

2
raylib

@ -1 +1 @@
Subproject commit bc332018f67fc6dcefd9f236b9147f20f17f86ab
Subproject commit 005bc4c4143f2b79ffc18fa98be144c905d2ce7f