diff options
author | Aki <nthirtyone@gmail.com> | 2017-07-31 22:17:24 +0200 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2017-07-31 22:17:24 +0200 |
commit | a5dfe50a4f4dd64ef0f54e1caaef8a2672ff8c76 (patch) | |
tree | 0a9b867bdf766817e08d42f885443eaa10218be0 | |
parent | 29310cc9a4b29b4f758fb23d6cd963e2caa549b3 (diff) | |
download | roflnauts-a5dfe50a4f4dd64ef0f54e1caaef8a2672ff8c76.zip roflnauts-a5dfe50a4f4dd64ef0f54e1caaef8a2672ff8c76.tar.gz roflnauts-a5dfe50a4f4dd64ef0f54e1caaef8a2672ff8c76.tar.bz2 |
For testing purpose - static change of display settings
-rw-r--r-- | conf.lua | 8 | ||||
-rw-r--r-- | not/Settings.lua | 55 |
2 files changed, 41 insertions, 22 deletions
@@ -2,11 +2,11 @@ function love.conf(t) t.title = "Roflnauts 2" t.version = "0.10.2" - -- t.window.width = 320*3 - -- t.window.height = 180*3 + t.window.width = 320 + t.window.height = 180 -- t.window.borderless = true t.identity = "not-nautz" - t.window.fullscreentype = "desktop" - t.window.fullscreen = true + -- t.window.fullscreentype = "desktop" + -- t.window.fullscreen = true t.console = false end diff --git a/not/Settings.lua b/not/Settings.lua index ff28e6a..f2919ea 100644 --- a/not/Settings.lua +++ b/not/Settings.lua @@ -4,22 +4,34 @@ Settings = { current = {} } -function Settings.load () +-- Converts from old settings format to the one after `02aba07e03465205b45c41df7aec6894d4e89909`. +local function convertToNew (old) + return {sets = old, display = "fullscreen"} +end + +local function filePrepare () + 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 +end + +local function fileLoad () + local getSettings = love.filesystem.load("settings") + local settings = getSettings() + if not settings.sets then + settings = convertToNew(settings) + end + Settings.current = settings +end + +local function controllerLoad () if Controller then - 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") - Settings.current = getSettings() - if not Settings.current.sets then - Settings.current = Settings.convertToNew() - end Controller.reset() - local joysticksList = love.joystick.getJoysticks() -- local list for editing + local joysticksList = love.joystick.getJoysticks() for _,set in pairs(Settings.current.sets) do local isJoystick = set[7] local joystick @@ -35,10 +47,17 @@ function Settings.load () end end --- Converts from old settings format to the one after `02aba07e03465205b45c41df7aec6894d4e89909`. -function Settings.convertToNew () - local old = Settings.current - return {sets = old, display = "fullscreen"} +local function displayLoad () + local width, height = 320, 180 + love.window.setFullscreen(false) + love.window.setMode(width*2, height*2) +end + +function Settings.load () + filePrepare() + fileLoad() + controllerLoad() + displayLoad() end function Settings.save () |