Hello world text flickering on fullscreen window

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
vitto
Prole
Posts: 10
Joined: Wed Nov 19, 2014 5:50 pm
Location: Italy
Contact:

Hello world text flickering on fullscreen window

Post by vitto »

I'm trying to create my first Hello world window but I see the text flickering only if the window is set to Fullscreen mode, where I'm wrong?

I have a MacBook Air 2011 with a screen resolution of 1440 x 900 pixels

Code: Select all

function love.draw()

    love.graphics.print('hey that\'s flickering!', 50, 50)
    
    success = love.window.setMode(1440, 900, {
        display        = 1,
        fullscreen     = true,
        centered       = true,
        fullscreentype = "normal",
        resizable      = false,
        borderless     = true,
        highdpi        = true,
        vsync          = false,
        fsaa           = 0,
        srgb           = false,
        minwidth       = 640,
        minheight      = 480
    })

end
I't seems like something is refreshing the contents constantly, I'm not sure where I'm wrong, can you help me?

:roll:
Last edited by vitto on Thu Nov 20, 2014 6:55 pm, edited 1 time in total.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Hello world text flickering on fullscreen window

Post by bartbes »

vitto wrote: I't seems like something is refreshing the contents constantly
Yes, you are!
Regardless of the fact that the screen is always constantly redrawn, your code is recreating the window every single frame. You see, love.window.setMode recreates a bunch of stuff to make sure it all works with the new settings, and this is generally quite slow. Even if fast, I imagine the flickering you're seeing is the constant switching between fullscreen modes (or a fullscreen window and nothing, even).

The solution: move the call to love.graphics.setMode to love.load, or, even nicer, if you apply the settings in conf.lua instead, the initially created window will already have those settings.
User avatar
vitto
Prole
Posts: 10
Joined: Wed Nov 19, 2014 5:50 pm
Location: Italy
Contact:

Re: Hello world text flickering on fullscreen window

Post by vitto »

Thank you, if you say that I suppose event handling is one of the first things I should read on documentation.

Now it's more clear why it's flickering!

bye

:ultraglee:
Post Reply

Who is online

Users browsing this forum: No registered users and 227 guests