Changing display resolution in-game?

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
InStars
Prole
Posts: 2
Joined: Tue Oct 27, 2009 8:05 pm

Changing display resolution in-game?

Post by InStars »

I want my game to work on multiple resolutions.
Is it possible to create a menu where user can chose his resolution and toogle fullscreen/windowed mode in-game?
I know that such stuff is stored in the config file, but is it possible to somehow modify it after the game is compiled?
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Changing display resolution in-game?

Post by Robin »

  1. The game is not actually compiled.
  2. You can use setMode (http://love2d.org/docs/love_graphics_setMode_1.html):

Code: Select all

love.graphics.setMode(width, height, fullscreen, true, 0)
Help us help you: attach a .love.
InStars
Prole
Posts: 2
Joined: Tue Oct 27, 2009 8:05 pm

Re: Changing display resolution in-game?

Post by InStars »

Thanks a lot, that was the thing I was looking for ;)
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Changing display resolution in-game?

Post by bartbes »

Robin wrote:The game is not actually compiled.
I beg to differ, you might want to learn the inner workings of lua?

Anyway, the code is compiled at runtime, so in theory you should be able to modify the config, however LÖVE doesn't offer a way to change things in the .love. You should probably just write to the game.conf (it will then be written to the save dir, which will take precedence over the game.conf in the .love) Another way is to stop LÖVE from creating a window and do it manually after reading the settings from a save file, the first one is probably easier.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Changing display resolution in-game?

Post by Robin »

Sure, Lua is compiled at run-time, but .loves are not.
Help us help you: attach a .love.
Post Reply

Who is online

Users browsing this forum: No registered users and 99 guests