-deleted post

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
xuurcanx
Prole
Posts: 1
Joined: Wed Jan 11, 2017 9:10 am

-deleted post

Post by xuurcanx »

-deleted post
Last edited by xuurcanx on Tue Oct 27, 2020 2:27 pm, edited 1 time in total.
User avatar
zorg
Party member
Posts: 3436
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: setting the resolution fitting with the display

Post by zorg »

Hi and welcome to the forums.

I'd recommend reading the PiL, to get a foothold of lua (It's enough to skim it at first, or to just use it to look up stuff you might not fully understand), or use the tutorials on this site, since they might also be helpful.
After that, browsing the Löve wiki will also help.

That said, here's your code corrected, with comments:

Code: Select all

function love.load()
  local count = love.window.getDisplayCount() -- Not sure you need this at all; maybe for sanity checks regarding the below comment.
  local currentDisplay = 1 -- You speficy which display you want the window to open at; this should be only relevant if you're actually saving this to a file, so on reload, it can show the window on the display you last left the window on, for example.
  --local width, height = love.window.getDesktopDimensions(currentDisplay) -- You don't need this because of the below comment.
  love.window.setMode(0, 0, {display = currentDisplay, fullscreen = true}) -- From the wiki: "If width or height is 0, setMode will use the width and height of the desktop.". The fullscreen mode defaults to "deskop fullscreen", which is better than exclusive fullscreen, especially when people might have more screens. Also, the screen the window will first pop up is completely irrelevant, since you don't know the layout of the screens that make out the whole desktop.
end
or, in short:

Code: Select all

function love.load()
  love.window.setMode(0, 0, {fullscreen = true})
end
or better yet, in order to avoid flicker, just use the conf.lua config file, as shown here: [wiki]Config_Files[/wiki].

Code: Select all

function love.conf(t)
    t.identity = nil                    -- The name of the save directory (string)
    t.version = "0.10.2"                -- The LÖVE version this game was made for (string)
    t.console = false                   -- Attach a console (boolean, Windows only)
    t.accelerometerjoystick = true      -- Enable the accelerometer on iOS and Android by exposing it as a Joystick (boolean)
    t.externalstorage = false           -- True to save files (and read from the save directory) in external storage on Android (boolean) 
    t.gammacorrect = false              -- Enable gamma-correct rendering, when supported by the system (boolean)
 
    t.window.title = "Untitled"         -- The window title (string)
    t.window.icon = nil                 -- Filepath to an image to use as the window's icon (string)
    t.window.width = 0                 -- The window width (number)
    t.window.height = 0                -- The window height (number)
    t.window.borderless = false         -- Remove all border visuals from the window (boolean)
    t.window.resizable = false          -- Let the window be user-resizable (boolean)
    t.window.minwidth = 1               -- Minimum window width if the window is resizable (number)
    t.window.minheight = 1              -- Minimum window height if the window is resizable (number)
    t.window.fullscreen = true         -- Enable fullscreen (boolean)
    t.window.fullscreentype = "desktop" -- Choose between "desktop" fullscreen or "exclusive" fullscreen mode (string)
    t.window.vsync = true               -- Enable vertical sync (boolean)
    t.window.msaa = 0                   -- The number of samples to use with multi-sampled antialiasing (number)
    t.window.display = 1                -- Index of the monitor to show the window in (number)
    t.window.highdpi = false            -- Enable high-dpi mode for the window on a Retina display (boolean)
    t.window.x = nil                    -- The x-coordinate of the window's position in the specified display (number)
    t.window.y = nil                    -- The y-coordinate of the window's position in the specified display (number)
 
    t.modules.audio = true              -- Enable the audio module (boolean)
    t.modules.event = true              -- Enable the event module (boolean)
    t.modules.graphics = true           -- Enable the graphics module (boolean)
    t.modules.image = true              -- Enable the image module (boolean)
    t.modules.joystick = true           -- Enable the joystick module (boolean)
    t.modules.keyboard = true           -- Enable the keyboard module (boolean)
    t.modules.math = true               -- Enable the math module (boolean)
    t.modules.mouse = true              -- Enable the mouse module (boolean)
    t.modules.physics = true            -- Enable the physics module (boolean)
    t.modules.sound = true              -- Enable the sound module (boolean)
    t.modules.system = true             -- Enable the system module (boolean)
    t.modules.timer = true              -- Enable the timer module (boolean), Disabling it will result 0 delta time in love.update
    t.modules.touch = true              -- Enable the touch module (boolean)
    t.modules.video = true              -- Enable the video module (boolean)
    t.modules.window = true             -- Enable the window module (boolean)
    t.modules.thread = true             -- Enable the thread module (boolean)
end
This way, you don't even need that one line either.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
NobodysSon
Prole
Posts: 33
Joined: Tue Oct 30, 2012 10:37 pm

Re: setting the resolution fitting with the display

Post by NobodysSon »

I know that this post was answered over a month ago but I thought I would tack my own question regarding setting screen resolution onto the end rather than make an entirely new thread:

I was mistaken to think that using love.window.setMode(800,600,{fullscreen=true}) would set the display mode to fullscreen with a dimension of 800 by 600. Instead, it sets the display mode to fullscreen with a dimension of the current desktop. What is the correct way to set the screen to fullscreen with defined dimensions?
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: setting the resolution fitting with the display

Post by Positive07 »

love.window.setMode(800,600,{fullscreen=true, fullscreentype="exclusive"})

Always read the wiki when in doubt
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
zorg
Party member
Posts: 3436
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: setting the resolution fitting with the display

Post by zorg »

That said, nowadays it's a bit rude to force users into exclusive desktop mode... as an initial setting, at least; multi-monitor setups are not that rare now, and an application messing it up for me is grounds on me never running it again. :P
(I'm being at least marginally serious though, at least only use it as an option, and don't have it as the default mode.)
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
NobodysSon
Prole
Posts: 33
Joined: Tue Oct 30, 2012 10:37 pm

Re: setting the resolution fitting with the display

Post by NobodysSon »

Positive07 wrote: Fri Mar 03, 2017 10:41 pm love.window.setMode(800,600,{fullscreen=true, fullscreentype="exclusive"})

Always read the wiki when in doubt
I truly do appreciate this sentiment, and I always try to find the answers myself before posting, but as far as I can see, there is no mention of the "exclusive" setting on the wiki page for love.window.setMode.
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: setting the resolution fitting with the display

Post by Positive07 »

Wiki wrote: NOTES: If fullscreen is enabled and the width or height is not supported (see love.window.getFullscreenModes), the window may be resized to the closest available resolution and a resize event will be triggered.
If the fullscreen type is "desktop", then the window will be automatically resized to the desktop resolution.
That should tip you to look at the FullscreenType wiki page where it says what are the fullscreen types
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
NobodysSon
Prole
Posts: 33
Joined: Tue Oct 30, 2012 10:37 pm

Re: setting the resolution fitting with the display

Post by NobodysSon »

Positive07 wrote: Fri Mar 03, 2017 11:42 pm
Wiki wrote: NOTES: If fullscreen is enabled and the width or height is not supported (see love.window.getFullscreenModes), the window may be resized to the closest available resolution and a resize event will be triggered.
If the fullscreen type is "desktop", then the window will be automatically resized to the desktop resolution.
That should tip you to look at the FullscreenType wiki page where it says what are the fullscreen types
Thank you for the link.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 4 guests