From 9e173372178c2df1dd3f6599dea5fe3c37675c6e Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Mon, 5 Jun 2023 22:21:04 -0700 Subject: [PATCH] rename modifier_down to key_down The old name was confusing, as its description showed. --- app.lua | 4 ++-- keychord.lua | 8 ++++---- reference.md | 3 +-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app.lua b/app.lua index 584b17b..89c7bf1 100644 --- a/app.lua +++ b/app.lua @@ -229,7 +229,7 @@ end function App.fake_key_release(key) App.fake_keys_pressed[key] = nil end -function App.modifier_down(key) +function App.key_down(key) return App.fake_keys_pressed[key] end @@ -444,7 +444,7 @@ function App.disable_tests() App.getTime = love.timer.getTime App.getClipboardText = love.system.getClipboardText App.setClipboardText = love.system.setClipboardText - App.modifier_down = love.keyboard.isDown + App.key_down = love.keyboard.isDown App.mouse_move = love.mouse.setPosition App.mouse_down = love.mouse.isDown App.mouse_x = love.mouse.getX diff --git a/keychord.lua b/keychord.lua index 3b43519..16fa48d 100644 --- a/keychord.lua +++ b/keychord.lua @@ -34,19 +34,19 @@ function App.any_modifier_down() end function App.ctrl_down() - return App.modifier_down('lctrl') or App.modifier_down('rctrl') + return App.key_down('lctrl') or App.key_down('rctrl') end function App.alt_down() - return App.modifier_down('lalt') or App.modifier_down('ralt') + return App.key_down('lalt') or App.key_down('ralt') end function App.shift_down() - return App.modifier_down('lshift') or App.modifier_down('rshift') + return App.key_down('lshift') or App.key_down('rshift') end function App.cmd_down() - return App.modifier_down('lgui') or App.modifier_down('rgui') + return App.key_down('lgui') or App.key_down('rgui') end function App.is_cursor_movement(key) diff --git a/reference.md b/reference.md index 3234cfa..525ae86 100644 --- a/reference.md +++ b/reference.md @@ -251,8 +251,7 @@ visible on screen. ### keyboard primitives -* `App.modifier_down(key)` -- returns `true` if the given key (doesn't - actually have to be just a modifier) is currently pressed. +* `App.key_down(key)` -- returns `true` if the given key is currently pressed. (Based on [LÖVE](https://love2d.org/wiki/love.keyboard.isDown).) ### interacting with files -- 2.11.4.GIT