Page 1 of 1

How do I get Full-Screen?

Posted: Sat Jul 28, 2012 6:08 pm
by Echo
How can I make the window full-screen for my game? Plus I don't want to change the resolution just make it full-screen mode ( just cover the rest of the screen with black, not a window ) and not in just an over-sized window if possible.

My resolution is 800x600 for my game, my PC supports 1366x768. (O_o)

Re: How do I get Full-Screen?

Posted: Sat Jul 28, 2012 6:32 pm
by Petunien
Change:

Code: Select all

t.screen.fullscreen = false
to:

Code: Select all

t.screen.fullscreen = true
in the conf.lua.

Read more: https://love2d.org/wiki/Config_Files

:)

Re: How do I get Full-Screen?

Posted: Sat Jul 28, 2012 9:21 pm
by Robin
Also, if you supply 0 as width and height, it'll use whatever the monitor can handle (so 1366x768 in your case). Note that if you do this, you must check what the width and height are inside your game (with love.graphics.getWidth andlove.graphics.getHeight) to make sure everything fits on the screen.

Re: How do I get Full-Screen?

Posted: Mon Jul 30, 2012 3:35 pm
by Echo
I want to use F to go to fullscreen mode and W to go to window mode.
I tried this code inside the conf script. The game does not start.

Code: Select all

if key == 'f' then
          -- fullscreen mode
	  t.screen.fullscreen = true
	  end

if key == 'w'
           -- window mode
           t.screen.fullscreen = false
           end
Is their a way I can control the fullscreen mode in the conf script?

Re: How do I get Full-Screen?

Posted: Mon Jul 30, 2012 6:42 pm
by Petunien
Forget coding in the conf.lua!

There are only configuration settings.

For your problem, insert the following code in the main.lua or expand your love.keypressed-function.

Code: Select all

function love.keypressed(key, unicode)
     if key == "f" then love.graphics.toggleFullscreen() end
end
See:
https://love2d.org/wiki/love.keypressed
https://love2d.org/wiki/love.graphics.toggleFullscreen

These sites help to understand. But for you as a beginner, reading some tutorials and the wiki would be better. ;)

Re: How do I get Full-Screen?

Posted: Mon Jul 30, 2012 8:10 pm
by Echo
wow, one line of code! I was way off...

Thanks, this works perfect (^_^)