summaryrefslogtreecommitdiffhomepage
path: root/config
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2017-01-15 00:05:33 +0100
committerAki <nthirtyone@gmail.com>2017-01-15 00:05:33 +0100
commit9250a0de60ec055f7ed60b8a0d92ec6e289f58c1 (patch)
tree3402c3f10f006b324ce87ea37ba0b53983146efc /config
parentb80ba2f5a7bf7acbbbf14c1325fca8df3c39cac4 (diff)
downloadroflnauts-9250a0de60ec055f7ed60b8a0d92ec6e289f58c1.zip
roflnauts-9250a0de60ec055f7ed60b8a0d92ec6e289f58c1.tar.gz
roflnauts-9250a0de60ec055f7ed60b8a0d92ec6e289f58c1.tar.bz2
Displaying old keys when changing them in settings
Diffstat (limited to 'config')
-rw-r--r--config/menusettings.lua11
1 files changed, 9 insertions, 2 deletions
diff --git a/config/menusettings.lua b/config/menusettings.lua
index 3046781..1631e4f 100644
--- a/config/menusettings.lua
+++ b/config/menusettings.lua
@@ -12,13 +12,16 @@ local keys = {"Left", "Right", "Up", "Down", "Attack", "Jump"}
local dimmer = element:new(menu)
:setPosition(width/2, 15)
:set("visible", false)
- :set("currentControl", "Left")
+ :set("currentControl", "Left") -- it actually means control that is being set CURRENTLY
+ :set("previousControl", "") -- it actually means key that was set as this control PREVIOUSLY
:set("draw", function (self, scale)
if self.visible then
love.graphics.setColor(0, 0, 0, 210)
love.graphics.rectangle("fill",0,0,width*getRealScale(),height*getRealScale())
love.graphics.setColor(120, 255, 120, 255)
love.graphics.printf("Press new key for: \n> " .. self.currentControl .. " <", (width/2-110)*scale, (height/2-4)*scale, 220, "center", 0, scale, scale)
+ love.graphics.setColor(120, 120, 120, 255)
+ love.graphics.printf("Old: " .. self.previousControl .. "", (width/2-110)*scale, (height/2+16)*scale, 220, "center", 0, scale, scale)
love.graphics.setColor(255, 255, 255, 255)
end
end)
@@ -36,6 +39,8 @@ local startChange = function (self)
self.parent.allowMove = false
self.inProgress = true
self.currentKey = 0
+ -- Displaying old key should be done less tricky; REWORK NEEDED
+ dimmer:set("previousControl", Controller.sets[self.setNumber()][string.lower(keys[self.currentKey+1])])
self.newSet = {}
end
local controlreleased = function(self, set, action, key)
@@ -44,14 +49,16 @@ local controlreleased = function(self, set, action, key)
table.insert(self.newSet, key)
dimmer:set("currentControl", keys[self.currentKey+1])
end
+ -- There is something wrong with this `if` statements... I mean, look at these numbers.
if self.currentKey > 5 then
dimmer:set("visible", false)
self.parent.allowMove = true
self.inProgress = false
- table.insert(self.newSet, Controller.sets[self.setNumber()].joystick)
+ table.insert(self.newSet, Controller.getSets()[self.setNumber()].joystick)
print(self.newSet[7])
Settings.change(self.setNumber(), self.newSet[1], self.newSet[2], self.newSet[3], self.newSet[4], self.newSet[5], self.newSet[6], self.newSet[7])
else
+ dimmer:set("previousControl", Controller.sets[self.setNumber()][string.lower(keys[self.currentKey+1])])
self.currentKey = self.currentKey + 1
end
end