diff options
-rw-r--r-- | main.lua | 22 | ||||
-rw-r--r-- | reference.md | 7 |
2 files changed, 29 insertions, 0 deletions
diff --git a/main.lua b/main.lua index ced451d..fca94b5 100644 --- a/main.lua +++ b/main.lua @@ -316,6 +316,17 @@ function App.mousereleased(x,y, mouse_button) end end +function App.mousemoved(x,y, dx,dy, is_touch) + if current_app_is_warning() then return end + if Current_app == 'run' then + if run.mouse_move then run.mouse_move(dx,dy) end + elseif Current_app == 'source' then + if source.mouse_move then source.mouse_move(dx,dy) end + else + assert(false, 'unknown app "'..Current_app..'"') + end +end + function App.wheelmoved(dx,dy) if current_app_is_warning() then return end if Current_app == 'run' then @@ -327,6 +338,17 @@ function App.wheelmoved(dx,dy) end end +function App.mousefocus(in_focus) + if current_app_is_warning() then return end + if Current_app == 'run' then + if run.mouse_focus then run.mouse_focus(in_focus) end + elseif Current_app == 'source' then + if source.mouse_focus then source.mouse_focus(in_focus) end + else + assert(false, 'unknown app "'..Current_app..'"') + end +end + function love.quit() if Disable_all_quit_handlers then return end if current_app_is_warning() then return end diff --git a/reference.md b/reference.md index dc38bb8..972ab1d 100644 --- a/reference.md +++ b/reference.md @@ -73,12 +73,19 @@ automatically called for you as appropriate. button. Provides the same arguments as `App.mousepressed()` above. (Based on [LÖVE](https://love2d.org/wiki/love.mousereleased).) +* `App.mousemoved(x,y, dx,dy, is_touch)` -- called any time the mouse moves. + (Based on [LÖVE](https://love2d.org/wiki/love.mousemoved).) + * `App.wheelmoved(dx,dy)` -- called when you use the scroll wheel on a mouse that has it. Provides in `dx` and `dy` an indication of how fast the wheel is being scrolled. Positive values for `dx` indicate movement to the right. Positive values for `dy` indicate upward movement. (Based on [LÖVE](https://love2d.org/wiki/love.wheelmoved).) +* `App.mousefocus(in_focus)` -- called when the mouse pointer moves on or off + the app window. + (Based on [LÖVE](https://love2d.org/wiki/love.mousefocus).) + * `App.keychord_press(chord, key)` -- called when you press a key-combination. Provides in `key` a string name for the key most recently pressed ([valid values](https://love2d.org/wiki/KeyConstant)). Provides in `chord` a |