Open Ronchiporc opened 1 year ago
I would like this as well, but in the meantime ironically enough I already wrote an extension for Windows (x86_64), Mac (x86_64/arm64 universal binary), and Linux (x86_64, aarch64, armv7l) which does this. It's open source so YoYo could just copy and paste it into their runner's code and make the function exposed to GML and call it done. I asked them to do this with adding a borderless toggle function and for many years, despite me giving them code which did all the work for them, they flat out refused to do something I would've done in minutes if I were on their development team.
They said it was not a priority, but is a few minutes really something to give a rats ass about? They did on windows at least, only took more than a decade just about. As for Mac and Linux, the code I wrote for them a decade ago is still good and right there in my ticket, should they ever be in an abnormally good mood and have a minute. But things have been getting better with them lately, ever since they've been adopted by opera they have been actually listening to us.
So don't worry about it too much, if there's a time they'll end up doing this, now's a good season. :)
I wrote it for Open Minecraft Note Block Studio, a Minecraft music maker:
https://github.com/time-killer-games/OpenNoteBlockStudio/releases/tag/v0.0.0.0
Source code of the library here:
It Is kinda tempting to go down the list of feature requests and see how quickly I can beat them to getting things done as one person in my down time unpaid, via extensions. Maybe sooner or later they'll catch on and hire me.
It relies on one other extension which gets platform information. It doesn't necessarily need to use that or the external_call()/_define() functions, but that's just how I chose to implement it for the time being.
function window_zoom() {
if (utsname_sysname() == "Windows_NT") {
external_call(external_define(working_directory + "libzoom.dll", "window_zoom", dll_cdecl, ty_real, 1, ty_string), window_handle());
} else if (utsname_sysname() == "Darwin") {
external_call(external_define(working_directory + "libzoom.dylib", "window_zoom", dll_cdecl, ty_real, 1, ty_string), window_handle());
} else if (utsname_sysname() == "Linux") {
if (utsname_machine() == "x86_64") external_call(external_define(working_directory + "libzoom.so", "window_zoom", dll_cdecl, ty_real, 1, ty_string), window_handle());
else if (utsname_machine() == "aarch64") external_call(external_define(working_directory + "libzoom_arm64.so", "window_zoom", dll_cdecl, ty_real, 1, ty_string), window_handle());
else if (utsname_machine() == "armv7l") external_call(external_define(working_directory + "libzoom_arm.so", "window_zoom", dll_cdecl, ty_real, 1, ty_string), window_handle());
}
}
Here you go! Exactly one line of code on Windows and one line on Mac. Just under a few lines on Linux. If YoYo can't copy/paste 15 lines of code, for the lack of a much better way to put it, there is a serious problem here. :)
To avoid issues on platforms that I haven't really tested this entirely with in particularly specific ways, you add could add the following line to be prepended as the first line of the function I have in the code tag posted above:
if (window_get_fullscreen() || !window_get_showborder()) return;
Making the function look like so:
function window_zoom() {
if (window_get_fullscreen() || !window_get_showborder()) return;
if (utsname_sysname() == "Windows_NT") {
external_call(external_define(working_directory + "libzoom.dll", "window_zoom", dll_cdecl, ty_real, 1, ty_string), window_handle());
} else if (utsname_sysname() == "Darwin") {
external_call(external_define(working_directory + "libzoom.dylib", "window_zoom", dll_cdecl, ty_real, 1, ty_string), window_handle());
} else if (utsname_sysname() == "Linux") {
if (utsname_machine() == "x86_64") external_call(external_define(working_directory + "libzoom.so", "window_zoom", dll_cdecl, ty_real, 1, ty_string), window_handle());
else if (utsname_machine() == "aarch64") external_call(external_define(working_directory + "libzoom_arm64.so", "window_zoom", dll_cdecl, ty_real, 1, ty_string), window_handle());
else if (utsname_machine() == "armv7l") external_call(external_define(working_directory + "libzoom_arm.so", "window_zoom", dll_cdecl, ty_real, 1, ty_string), window_handle());
}
}
This will prevent the window from maximizing when the window obviously is either fulllscreen or borderless, as it may or may not be needed to prevent undesirable behavior. I'll leave that up to the developer to for added flexibility. Don't expect a window that is not able to resize to be able to maximize, this would be just non-standard expectations for most people.
As window_get_showborder()
is a relatively new function that was added back and won't be present in older versions of Studio, you are free to omit that check from the if-statement as needed with whatever old version you happen to be using.
Use Game Options to enable a window resizing.
I had too much caffiene today to celebrate my birthday, forgive me if I sound overly critical of yoyo. Honestly you don't want to know the half of it. @YellowAfterlife knows what I am referring to XD
Is your feature request related to a problem?
If the game is in windowed non-borderless mode, there seems to be no way of maximizing the window automatically.
Resizing the window to display size and setting position to 0 does not consider the window's top bar height, and causes the window to be inacessible to the user. Putting an arbitrary vertical offset to the position is not great either because windows top bar have different sizes depending on user OS settings.
Describe the solution you'd like
window_maximize() which basically does the equivalent of clicking the [] button on the top right corner of a window.
Describe alternatives you've considered
The best sup-par comprise i have so far is this:
Additional context
No response