I'm wondering if there's any way to achieve that based on this example:
1 I want to show the game in a windowed mode at some resolution (640, 640)
2 Don't allow the player resize the window with mouse drag.
3 Allow the player to enter full screen with the OS maximize window button.
Applications typically don't use the OS maximize button to go fullscreen, and I don't even know if it's possible (probably not). You can provide a menu function and a shortcut key, and if you really must, you can even provide a GUI button to maximize it (see how YouTube does it for an example). A popular shortcut key is F11.
The idea would be to unset 'resizable' and set or unset 'fullscreen'.
Pgimeno, I understand, gracies! Allowing the user to control the resolution by a custom menu is the best option, isn't? Then I assume there is no simple way to achieve the 3 points I mentioned, am I right?
Grump, sure I should provide an ESC shortcut for exit game. Thanks
The 1st point is fine, although you should specify fullscreen = false as well in the flags table you pass to setMode;
Set resizable to false to achieve your 2nd point if you don't want people resizing your game through dragging the window's edge;
For the 3rd, forget about the maximize button triggering full-screen, that's not why that exists.
(in short, you can only achieve the first 2... although, if 0.11 will detect you pressing the maximize button, then maybe then, you could make it go fullscreen then...)
If you're adamant, you could do a borderless window, and draw your own window borders and top-buttons and whatever you want inside your app by yourself, but that does have some minor issues, like you might not be able to move the window with your mouse on certain OS-es.
If you only want to support -specific- window sizes, like having a base size, and integral zoom levels (1x, 2x, 3x, 4x, etc.) then you could set resizable to true, but also define the love.resize callback function, and add in code that detect the nearest zoom level that would match the size the user adjusted the window to, then setMode with that value.
Me and my stuff True 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.
If you intend on allowing fullscreen, which resizes the window to whatever dimensions the screen currently has, you might as well allow window resizing.
On macOS, the green Zoom button (The Mac equivalent to maximize) does put Löve into fullscreen if you enable it. It just changes the resolution of the window to the screen resolution. The benefit to this is that it also gets its own Space which you can switch between at will rather than taking over the screen completely and requiring you to exit the game or minimize it to get to other apps.
Windows doesn't do this I don't think. Maximize just resizes the window to the full screen but still keeps the titlebar and taskbar.
It also depends on the fullscreen mode (desktop or exclusive); older games used the latter type, but nowadays, it's better to use desktop fullscreen.
By the way, raidho is right in that the player's full-screen resolution may be anything, so allowing your game to switch to that needs to be handled in one of many specific ways; centering the graphics or stretching them, whether aspect-correctly or not (i.e. by the same amount on both axes, and the amount is either the smaller value that you need to stretch by to fit one axis and not have things be outside the screen, or the larger if you don't mind some parts of the screen not being shown)
Then again, as i said above, if you're going for a pixel-perfect look or something, then your only choice still is integral zooming, to keep things pixel perfect; that means both manual resizing and full-screen mode would need to display at supported resolutions as well. (w.r.t. full-screen, it could be made to be 1 size (supported full-screen size) bigger than the desired one, and just move the graphics to the center, as i said above)
Me and my stuff True 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.