summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--controller.lua2
-rw-r--r--main.lua6
-rw-r--r--settings.lua8
3 files changed, 12 insertions, 4 deletions
diff --git a/controller.lua b/controller.lua
index fde63c1..b56bd32 100644
--- a/controller.lua
+++ b/controller.lua
@@ -160,8 +160,6 @@ end
-- Load gamepad mappings from db file and init module
function Controller.load()
love.joystick.loadGamepadMappings("gamecontrollerdb.txt")
- Controller.registerSet("left", "right", "up", "down", "return", "rshift")
- Controller.registerSet("a", "d", "w", "s", "g", "h")
end
-- Create new sets when new joystick is added
diff --git a/main.lua b/main.lua
index 8c6eb8e..ab1c755 100644
--- a/main.lua
+++ b/main.lua
@@ -39,6 +39,7 @@ require "camera"
require "menu"
require "controller"
require "music"
+require "settings"
-- Temporary debug
debug = false
@@ -53,8 +54,9 @@ function love.load()
Bold = love.graphics.newImageFont("assets/font-big.png", " 0123456789AEFILNORSTUW", -2)
Font:setLineHeight(9/16)
love.graphics.setFont(Font)
- -- Controller
+ -- Modules
Controller.load()
+ Settings.load()
-- Scene
Scene = Menu:new()
end
@@ -84,7 +86,7 @@ function Controller.controlpressed(set, action, key)
-- pass to current Scene
Scene:controlpressed(set, action, key)
-- globals
- if key == "escape" or key == "f1" then
+ if key == "escape" then
love.event.quit()
end
if key == "f5" then
diff --git a/settings.lua b/settings.lua
new file mode 100644
index 0000000..0a31b41
--- /dev/null
+++ b/settings.lua
@@ -0,0 +1,8 @@
+Settings = {}
+
+function Settings.load()
+ if Controller then
+ Controller.registerSet("left", "right", "up", "down", "return", "rshift")
+ Controller.registerSet("a", "d", "w", "s", "g", "h")
+ end
+end \ No newline at end of file