Skip to content

Instantly share code, notes, and snippets.

@shakesoda
Created November 25, 2016 17:26
Show Gist options
  • Save shakesoda/d81c4cc3c330f35bdd33508fd9a1101a to your computer and use it in GitHub Desktop.
Save shakesoda/d81c4cc3c330f35bdd33508fd9a1101a to your computer and use it in GitHub Desktop.
--- ...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