Page 1 of 1

Love ignores resolution settings in Conf and SetMode

Posted: Fri Apr 03, 2015 8:53 am
by Justin_C
I'm having some issues setting the resolution in Love (Windows 8.1) and it's really bugging me. I've tried setting the resolution to 1920x1080 in both Conf.lua and by using SetMode, and no matter what I do it always seems to use 1536x864 as the resolution.

1920x1080 is my native resolution. And I only noticed the issue because Fraps has been repeatedly recording at that resolution instead of 1920x1080, so I know the window is actually using that resolution.

Here's a code sample to show you what I am doing:

Code: Select all

function love.load()
  window_height_conf = love.window.getHeight()
  window_width_conf = love.window.getWidth()

  love.window.setMode(1920, 1080, SetMode())
  
  window_height_setmode = love.window.getHeight()
  window_width_setmode = love.window.getWidth()
  
  font_24 = love.graphics.newFont(24)
  love.graphics.setFont(font_24)
end

function love.draw(dt)
  local text = "Conf: (" .. window_width_conf .. ", " .. window_height_conf .. ")"
  love.graphics.printf(text, window_width_setmode - ((love.graphics.getFont():getWidth(text) + 10)), 10, 1000, "left", 0, 1, 1)
  text = "SetMode: (" .. window_width_setmode .. ", " .. window_height_setmode .. ")"
  love.graphics.printf(text, window_width_setmode - ((love.graphics.getFont():getWidth(text) + 10)), 15 + love.graphics.getFont():getHeight(text), 1000, "left", 0, 1, 1)
end

function SetMode()
  local r = {}
  r.fullscreen = true
  r.fullscreentype = "desktop"
  r.vsync = true
  r.fsaa = 2
  r.resizable = false
  r.borderless = false
  r.centered = true
  r.display = 1
  r.minwidth = 1
  r.minheight = 1
  r.highdpi = false
  r.srgb = false
  r.x = nil
  r.y = nil
  
  return r
end
I set the resolution as 1920x1080 in Conf.lua as well, which you can see in the attachment. The resolution turns out the same whether I manually set the mode or not. It runs at the same resolution whether I run it in ZeroBrane Studio, through Love using a .love file, or when I compile it into an .exe. No matter what I do it just refuses to use the resolution I specified.

Someone please help me with this. If I can't get Love to run at the proper resolution I'm going to have to stop using it, and I don't want to do that.

EDIT: If I switch the fullscreen mode to "normal" it sets the resolution to 1600x900. It seems to have a mind of its own.

Re: Love ignores resolution settings in Conf and SetMode

Posted: Fri Apr 03, 2015 11:38 am
by Evine
I'd guess you have scaling enabled in windows.

Similar issue:
viewtopic.php?f=3&t=79614&p=179911#p179911

Re: Love ignores resolution settings in Conf and SetMode

Posted: Fri Apr 03, 2015 12:02 pm
by bartbes
Yes, in desktop fullscreen mode it makes the window as big as the desktop. This is intended and documented.
If fullscreen is enabled and the width or height is not supported (see love.window.getFullscreenModes), the window may be resized to the closest available resolution and a resize event will be triggered.

If the fullscreen type is "desktop", then the window will be automatically resized to the desktop resolution.

Re: Love ignores resolution settings in Conf and SetMode

Posted: Fri Apr 03, 2015 6:37 pm
by Justin_C
Yeah, that fixed it. Thanks!