summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2016-09-30 16:35:05 +0200
committerAki <nthirtyone@gmail.com>2016-09-30 16:35:05 +0200
commit92c040a9c0104623b19f8f5d6590a260190b4492 (patch)
tree0d40de8412a38ca5cca39ef6f0a4f7fcbb811142
parent01304063655a31e102f312f6293e7aa4c7582d3f (diff)
downloadroflnauts-92c040a9c0104623b19f8f5d6590a260190b4492.zip
roflnauts-92c040a9c0104623b19f8f5d6590a260190b4492.tar.gz
roflnauts-92c040a9c0104623b19f8f5d6590a260190b4492.tar.bz2
Added Settings module scrap
-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