How do I get Full-Screen?

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
Echo
Prole
Posts: 46
Joined: Fri Jul 13, 2012 4:50 pm
Location: Lucid Moon

How do I get Full-Screen?

Post 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)
User avatar
Petunien
Party member
Posts: 191
Joined: Fri Feb 03, 2012 8:02 pm
Location: South Tyrol (Italy)

Re: How do I get Full-Screen?

Post 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

:)
"Docendo discimus" - Lucius Annaeus Seneca
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: How do I get Full-Screen?

Post 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.
Help us help you: attach a .love.
User avatar
Echo
Prole
Posts: 46
Joined: Fri Jul 13, 2012 4:50 pm
Location: Lucid Moon

Re: How do I get Full-Screen?

Post 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?
User avatar
Petunien
Party member
Posts: 191
Joined: Fri Feb 03, 2012 8:02 pm
Location: South Tyrol (Italy)

Re: How do I get Full-Screen?

Post 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. ;)
"Docendo discimus" - Lucius Annaeus Seneca
User avatar
Echo
Prole
Posts: 46
Joined: Fri Jul 13, 2012 4:50 pm
Location: Lucid Moon

Re: How do I get Full-Screen?

Post by Echo »

wow, one line of code! I was way off...

Thanks, this works perfect (^_^)
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 81 guests