Created
November 25, 2016 17:26
-
-
Save shakesoda/d81c4cc3c330f35bdd33508fd9a1101a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- ...snip... | |
if not headless then | |
require "love.system" | |
require "love.window" | |
end | |
local flags = { | |
width = 1280, | |
height = 720, | |
highdpi = true, | |
-- ..snip... | |
} | |
local dpi_scale = 1 | |
if love.system.getOS() == "Linux" and not headless then | |
flags.highdpi = false | |
local lume = require "lume" | |
local f = io.popen("gsettings get org.gnome.desktop.interface scaling-factor") | |
local _scale = lume.split(f:read(), " ") | |
if _scale[2] then | |
dpi_scale = tonumber(_scale[2]) | |
flags.width = flags.width * dpi_scale | |
flags.height = flags.height * dpi_scale | |
love.window.toPixels = function(v) | |
return v * dpi_scale | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment