Hi there. I'm developing a small arcade game that uses the 512x448 resolution. In window mode it runs normally, but when I turn on the fullscreen mode, the window size changes to 640x480, messing up with positions and center alignment.
Window mode:
Fullscreen mode:
I found out this happens both on Windows and on Mac OSX. Is this supposed to happen? Thank you in advance!
Fullscreen bug
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: Fullscreen bug
A lot of monitors (and/or graphic cards, I am not sure where's the culprint) can't swich to a "random" screen resolution in fullscreen; instead, they have a "list of valid combinations of width & height".
In LÖVE, you can get that list by using [wiki]love.window.getFullscreenModes[/wiki].
In your case, what seems to happen is that LÖVE is giving you either the closest mode matching what you requested, or just the smallest mode.
If you want to stick to the 512x448 resolution, you will have to go around this when in full screen. You can either add "black borders" around your game, or draw to a canvas and "stretch it" on the screen.
In LÖVE, you can get that list by using [wiki]love.window.getFullscreenModes[/wiki].
In your case, what seems to happen is that LÖVE is giving you either the closest mode matching what you requested, or just the smallest mode.
If you want to stick to the 512x448 resolution, you will have to go around this when in full screen. You can either add "black borders" around your game, or draw to a canvas and "stretch it" on the screen.
When I write def I mean function.
Re: Fullscreen bug
Ah, I see. I will try to draw some black borders and center the screen to make up the difference then. Thank you so much for the help.
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Fullscreen bug
It's definitely more preferred these days to not change the resolution if you can. Especially to low ones from the early days of computing.
I recommend the Canvas method, or a simple use of push, scale and pop if you can, and then use "Desktop" fullscreen mode. Code the game to just scale to whatever size the window is using simple math (scale factor = window dimension / game resolution dimension) so we can control the window size ourselves with the Maximize, Zoom or Lion Fullscreen buttons in the titlebar or the window edges. It also lets us change to other applications when we can. Something streamers complain about with a lot of "impolite" games because a few won't let you change to a browser when needed and it makes streaming more difficult, sometimes requiring them to play windowed.
It requires literally little to no effort on your part if done right. And is highly recommended especially if you're making a game that uses pixel art graphics.
Something to note is if you use the method above, (And make sure to set all image filters to "nearest" for goodness sakes) you'll get crisp clean large pixels on your screen, whereas if you actually try to set the monitor resolution, you're gonna end up with blurriness due to the display blending the low resolution to fill up the large screen area.
I'd even go so far as to refuse to play a game if I can't set its resolution to my display's resolution. I don't want no blurry pixels or inability to change windows when needed.
If you want advice, I can try and answer and provide samples.
I recommend the Canvas method, or a simple use of push, scale and pop if you can, and then use "Desktop" fullscreen mode. Code the game to just scale to whatever size the window is using simple math (scale factor = window dimension / game resolution dimension) so we can control the window size ourselves with the Maximize, Zoom or Lion Fullscreen buttons in the titlebar or the window edges. It also lets us change to other applications when we can. Something streamers complain about with a lot of "impolite" games because a few won't let you change to a browser when needed and it makes streaming more difficult, sometimes requiring them to play windowed.
It requires literally little to no effort on your part if done right. And is highly recommended especially if you're making a game that uses pixel art graphics.
Something to note is if you use the method above, (And make sure to set all image filters to "nearest" for goodness sakes) you'll get crisp clean large pixels on your screen, whereas if you actually try to set the monitor resolution, you're gonna end up with blurriness due to the display blending the low resolution to fill up the large screen area.
I'd even go so far as to refuse to play a game if I can't set its resolution to my display's resolution. I don't want no blurry pixels or inability to change windows when needed.
If you want advice, I can try and answer and provide samples.
Re: Fullscreen bug
As a noobie, I definitely want to learn more about this. :0 Any good samples or tutorials to learn from?Jasoco wrote:It's definitely more preferred these days to not change the resolution if you can. Especially to low ones from the early days of computing.
...
If you want advice, I can try and answer and provide samples.
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Fullscreen bug
Okay. First a question. How are you drawing your game right now?
It might be as simple as using the love.push/scale/pop() commands. But some information will be handy. Do you have a sample .love maybe?
Are you using graphics that are already doubled up? Is 512x448 the resolution you are currently drawing at?
For a start, try this:
Set the window's "resizable" flag to true. Either by putting it in the conf.lua file or when you setMode. If you don't call setMode at launch, put these flags in your conf.lua file:
What this will do is A) set the window to be freely resizable and B) I believe the "desktop" mode enables the Lion Fullscreen button in the top right corner to let a Löve game on OS X go into Fullscreen on its own space.
Place this code in your love.draw() function before the drawing stuff:
And this at the end of the draw function:
And report what you get. If done correctly, you should A) be able to resize the window freely or maximize it and B) the drawing stuff should scale with the window height. (It won't be centered yet though. This is just a starting point.)
Maybe take a screenshot of your window maximized.
If you're willing to use the Canvas method mentioned above, there is a different approach we can use.
It might be as simple as using the love.push/scale/pop() commands. But some information will be handy. Do you have a sample .love maybe?
Are you using graphics that are already doubled up? Is 512x448 the resolution you are currently drawing at?
For a start, try this:
Set the window's "resizable" flag to true. Either by putting it in the conf.lua file or when you setMode. If you don't call setMode at launch, put these flags in your conf.lua file:
Code: Select all
t.window.resizable = true
t.window.fullscreentype = "desktop"
Place this code in your love.draw() function before the drawing stuff:
Code: Select all
local s = love.window.getHeight() / 448 --Where 448 is the height you are drawing your game content at; Change this if/when needed
love.push()
love.scale(s)
Code: Select all
love.pop()
Maybe take a screenshot of your window maximized.
If you're willing to use the Canvas method mentioned above, there is a different approach we can use.
Re: Fullscreen bug
I dunno about OP, but none of those love.functions (push, scale, pop) seem to do anything for me. Get errors like this:
It's worth noting that I've never used any of those and don't know what they do.
Code: Select all
Error: main.lua:32: attempt to call field 'push' (a nil value)
stack traceback:
main.lua:32: in function 'draw'
[string "boot.lua"]:438: in function <[string "boot.lua"]:399>
[C]: in function 'xpcall'
- Attachments
-
- TempGame01.love
- (9.13 KiB) Downloaded 190 times
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Fullscreen bug
I'm an idiot. It's love.graphics.push/scale/pop. Change those and it should work.
Re: Fullscreen bug
Oh ya much better. TY!
Re: Fullscreen bug
If you're interested in the canvas method, it would look something like this (untested)
Code: Select all
function love.load()
awesomecanvas = love.graphics.newCanvas(512, 448)
awesomecanvas:setFilter("nearest", "nearest")
-- and the rest of your love.load of course
end
function love.draw2() -- this is your current love.draw function, you just have to rename it to something else
...
end
function love.draw()
awesomecanvas:renderTo(love.draw2)
local w = love.window.getWidth()
local h = love.window.getHeight()
local s = math.floor(h/448)
love.graphics.draw(awesomecanvas, w*0.5 - s*512, h*0.5 - s*448, 0, s, s)
end
My game called Hat Cat and the Obvious Crimes Against the Fundamental Laws of Physics is out now!
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 4 guests