aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-x[-rw-r--r--].gitignore0
-rwxr-xr-x[-rw-r--r--]README.md0
-rwxr-xr-x[-rw-r--r--]button.lua0
-rwxr-xr-x[-rw-r--r--]checkbox.lua0
-rwxr-xr-x[-rw-r--r--]core.lua18
-rwxr-xr-x[-rw-r--r--]init.lua0
-rwxr-xr-x[-rw-r--r--]input.lua0
-rwxr-xr-x[-rw-r--r--]label.lua0
-rwxr-xr-x[-rw-r--r--]slider.lua0
-rwxr-xr-x[-rw-r--r--]slider2d.lua0
-rwxr-xr-x[-rw-r--r--]style-default.lua0
11 files changed, 14 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
index dc5c077..dc5c077 100644..100755
--- a/.gitignore
+++ b/.gitignore
diff --git a/README.md b/README.md
index 0a4aa0d..0a4aa0d 100644..100755
--- a/README.md
+++ b/README.md
diff --git a/button.lua b/button.lua
index 2374645..2374645 100644..100755
--- a/button.lua
+++ b/button.lua
diff --git a/checkbox.lua b/checkbox.lua
index c5f5fce..c5f5fce 100644..100755
--- a/checkbox.lua
+++ b/checkbox.lua
diff --git a/core.lua b/core.lua
index f57caa9..10a0c72 100644..100755
--- a/core.lua
+++ b/core.lua
@@ -18,7 +18,7 @@ local function hasKeyFocus(id) return context.keyfocus == id end
-- input
local mouse = {x = 0, y = 0, down = false}
-local keyboard = {key = nil, code = -1}
+local keyboard = {key = nil, code = -1, ctrl = {down = {key = "tab", code = 9}, up = {key = "tab", code = 0}}}
function mouse.inRect(x,y,w,h)
return mouse.x >= x and mouse.x <= x+w and mouse.y >= y and mouse.y <= y+h
@@ -42,6 +42,12 @@ function keyboard.pressed(key, code)
keyboard.code = code
end
+function keyboard.controls(ctrl)
+ keyboard.ctrl.up = ctrl.up
+ keyboard.ctrl.down = ctrl.down
+end
+
+
function keyboard.tryGrab(id)
if not context.keyfocus then
context.keyfocus = id
@@ -50,13 +56,17 @@ end
local function makeTabable(id)
keyboard.tryGrab(id)
- if hasKeyFocus(id) and keyboard.key == 'tab' then
- if love.keyboard.isDown('rshift', 'lshift') then
+ if hasKeyFocus(id) then
+ if keyboard.key ~= nil then
+ print(string.format("Keyboard values: %s, %d | Set control values: (down) %s, %d (up) %s, %d", keyboard.key, keyboard.code, keyboard.ctrl.down.key, keyboard.ctrl.down.code, keyboard.ctrl.up.key, keyboard.ctrl.up.code))
+ end
+ if keyboard.key == keyboard.ctrl.up.key and keyboard.code == keyboard.ctrl.up.code then
setKeyFocus(context.lastwidget)
- else
+ elseif keyboard.key == keyboard.ctrl.down.key and keyboard.code == keyboard.ctrl.down.code then
setKeyFocus(nil)
end
keyboard.key = nil
+ keyboard.code = -1
end
context.lastwidget = id
end
diff --git a/init.lua b/init.lua
index 3b4e70c..3b4e70c 100644..100755
--- a/init.lua
+++ b/init.lua
diff --git a/input.lua b/input.lua
index 2ba29b5..2ba29b5 100644..100755
--- a/input.lua
+++ b/input.lua
diff --git a/label.lua b/label.lua
index 76f3c92..76f3c92 100644..100755
--- a/label.lua
+++ b/label.lua
diff --git a/slider.lua b/slider.lua
index ae75c01..ae75c01 100644..100755
--- a/slider.lua
+++ b/slider.lua
diff --git a/slider2d.lua b/slider2d.lua
index 023d16f..023d16f 100644..100755
--- a/slider2d.lua
+++ b/slider2d.lua
diff --git a/style-default.lua b/style-default.lua
index 7c85e46..7c85e46 100644..100755
--- a/style-default.lua
+++ b/style-default.lua