summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--controller.lua5
-rw-r--r--main.lua1
-rw-r--r--settings.lua18
3 files changed, 15 insertions, 9 deletions
diff --git a/controller.lua b/controller.lua
index b56bd32..e435d63 100644
--- a/controller.lua
+++ b/controller.lua
@@ -162,11 +162,6 @@ function Controller.load()
love.joystick.loadGamepadMappings("gamecontrollerdb.txt")
end
--- Create new sets when new joystick is added
-function Controller.joystickadded(joystick)
- Controller.registerSet("axis:leftx-", "axis:leftx+", "axis:lefty-", "axis:lefty+", "a", "b", joystick)
-end
-
-- Gamepad input callbacks
function Controller.gamepadaxis(joystick, axis, value)
if value ~= 0 then
diff --git a/main.lua b/main.lua
index 93d0408..3e28d90 100644
--- a/main.lua
+++ b/main.lua
@@ -75,7 +75,6 @@ function love.draw()
end
end
-- Pass input to Controller
-function love.joystickadded(joystick) Controller.joystickadded(joystick) end
function love.gamepadaxis(joystick, axis, value) Controller.gamepadaxis(joystick, axis, value) end
function love.gamepadpressed(joystick, key) Controller.gamepadpressed(joystick, key) end
function love.gamepadreleased(joystick, key) Controller.gamepadreleased(joystick, key) end
diff --git a/settings.lua b/settings.lua
index 5b0e38a..920abdf 100644
--- a/settings.lua
+++ b/settings.lua
@@ -2,8 +2,20 @@ Settings = {}
function Settings.load()
if Controller then
- Controller.registerSet("left", "right", "up", "down", "return", "rshift")
- Controller.registerSet("a", "d", "w", "s", "g", "h")
+ if not love.filesystem.exists("settings") then
+ local def = love.filesystem.newFile("settings.default")
+ local new = love.filesystem.newFile("settings")
+ new:open("w") def:open("r")
+ new:write(def:read())
+ new:close() def:close()
+ end
+ local getSettings = love.filesystem.load("settings")
+ for _,set in pairs(getSettings()) do
+ local isJoystick = set[7]
+ if isJoystick then
+ -- Add first free joystick from joysticks list
+ end
+ Controller.registerSet(set[1], set[2], set[3], set[4], set[5], set[6], joystick)
+ end
end
- print(love.filesystem.getIdentity(), love.filesystem.exists("settings.lua"))
end