A downloadable extension for Windows

Download NowName your own price

Quick links: documentation · source code
Versions: GameMaker: Studio, GameMaker Studio 2
Platforms: Windows, Windows (YYC)

Note: if you only need borderless fullscreen, OutsideTheBox might be a better choice - see Things To Be Aware Of.

This fancy extension addresses a quirk where GameMaker games cease to update while the window is being dragged around or resized.

The issue is Windows-specific behaviour - unless you run game logic and rendering on separate threads, system's dragging/resizing logic overtakes anything else and no other code executes until that's done.

The approach this extension takes is best called "a delightful hack" - the DLL starts up an simple helper program, into the window of which the game's window is then inserted as a child window.

This has the game window continue to run while the window is being manipulated, as well as allowing to enable/disable the window frame, allowing to also use it for borderless fullscreen.

The extension also includes its own versions of Window Commands functions.

Note: Don't forget to disable the default border in Global Game Settings - Windows - Graphics (GMS1) / Game Options - Windows - Graphics (GMS2)!

Download

Download NowName your own price

Click download now to get access to the following files:

window_frame (GMS1.4).gmez 33 kB
window_frame (GMS2.2).yymp 68 kB
window_frame (GMS2.3+).yymps 47 kB
window_frame_demo.yyz 124 kB
window_frame_demo.zip 2 MB

Development log

Comments

Log in with itch.io to leave a comment.

Hello, I use the GMS2.3+ project, and when I use window_command_set_active() disable any window command, my project starts to crash... Is there any solution?

Hi, this is just what I was looking for! But unfortunately it does not seem to be working for me. I'm using the latest version on GMS2 on steam: 2.3.3.437 And I picked 2.3+.

When I launch the demo, there's a popup with an exclamation mark, the app still loads but it comes up behind the GMS2 editor window so I didn't see it right away. But when I found it it did not have the border, I pressed 1 to open it but that didn't do anything.

I might try getting an earlier version of GMS2 from there site and try that, but if you have a fix for me that would be great! :)

I just tried running the YYZ from itch on 2.3.3.437 and it worked fine - aside of the popup (see comments below on where to disable that). Do note, however, that the extension doesn’t work with 64-bit Windows runtime at the moment.

It's probably the 64-bit runtime then, is support for that planned?

Why not check? Do you have “use 64-bit runtime” ticket in Game Options - Windows - General?

Oh, I thought I might have just had that version running, it was already off. Tried it on, same result, turn it off, same again.

I have been looking at what you can do with standard game maker code though, no plugins. I made my own, the only part I can't make is a minimize button.

In that case you could use my Window Commands extension to minimize the window (so long as you’re not using the 64-bit runtime - most of these extensions need to be updated for it).

How to make the window keep the aspect ratio? 🙏

(+1)

Using math, e.g. this instead of regular resize logic in demo’s Step

if (window_frame_get_visible()) {
    var w = window_frame_get_width();
    var h = window_frame_get_height();
    if (w > 0 && h > 0 && surface_exists(application_surface)
    && (window_get_width() != w || window_get_height() != h)
    ) {
        var gameWidth = 320, gameHeight = 240;
        var scale = min(w/gameWidth, h/gameHeight);
        var outWidth = gameWidth * scale;
        var outHeight = gameHeight * scale;
        var outX = (w - outWidth) div 2;
        var outY = (h - outHeight) div 2;
        // resize room (since we don't use views):
        room_width = outWidth; room_height = outHeight;
        // resize the game inside the frame-window to fit it's size:
        window_frame_set_region(outX, outY, outWidth, outHeight);
        // also resize application_surface:
        surface_resize(application_surface, outWidth, outHeight);
    }
}

gmlive.js demo

Thanks! But now I need the window to be adjusted to the game's resolution 😅

That may mean a few things so I trust that you can take it from here

windows tells me it is a potential virus, should I be concerned?

(+1)

You mean the dialog that shows up for almost every executable downloaded from the internet?

Can compile it from source code if you are concerned and know how to use Visual Studio.

no, no, I mean that when I download the windows defender file it detects it as a virus, it also detects it at https://www.virustotal.com/gui/ and it also detects it as a virus

In that case, you can try compiling it yourself from the source code and seeing if that stops it from triggering false positives or not. Other option is spending several hours filing false positives with each of those antivirus makers.

(-1)

I just tried to download the source code and it also detected a virus, according to my antivirus it is a Trojan: Win32 / Zpevdo.B, but the truth is I don't know if that is part of the extension, because if I have seen that some files contain dlls usually detect them as viruses

(-1)

I also downloaded this and it said that it contained a trojan

(1 edit)

(I also wrote this to you by email.)

Can you fix the ugly window resizing of GameMaker Studio 1?

Hello Yal.

I saw your itch.io project, Window freeze fix, and although I don't need it, maybe you can help me.

The problem is this: when you run a Windows game in GameMaker Studio 1.4, these things happen:

a) If you maximize and restore the window, you notice that the game display adjusts its aspect ratio after a short delay, instead of immediately adjust in. That delay makes it look ugly.

b) If you resize the window by dragging its sides, the window is filled with a white colour instead of showing the game image. That looks ugly too.

To best understand me, try running a game in GameMaker 8. When you press maximize and restore, the image immediately adjusts to the change in window size. It looks good.

And when you resize by dragging the window sides, the game view freezes (which is okay for me), and the room and its contents remain visible, and the aspect ratio immediately adjusts to the change in window size. It looks smooth and good. That is how it is on GameMaker 8.

I don't know why GameMaker Studio 1 changed it, so that now the window fills with white when resized, and there is a delay in changing aspect ratio.

Could you write a DLL or extension or something for GameMaker Studio 1.4, to make the window behave as it did in GameMaker 8?

Maybe GML code can help? Resizing the application surface, etc?

Replied to your email with details - previously GM would resize and repaint the window every step of the way, which was a bad idea in some cases. Now GM waits until you’re done resizing and resizes the internal buffers after 10 frames, which is good for performance but looks weirder.

This can be addressed with an extension (by finding and modifying the internal countdown until resize and by hacking into the window’s background drawing respectively), but doing so requires an amount of research and experimentation.

Thanks a lot. I really need this. By the way can you please make this version for Android please? You know Gamemaker projects in Android has a big issue that whenever you lower the notification bar, everything will be frozen (even the musics) and the game only works again when the notification bar is close. This is such a huge problem to multiplayer game.

(+1)

I’m not familiar enough with Android development to tell you whether that is something that can be done, but I can definitely tell you that your game will not be running if the user switches to a different application or Task List, and you’ll have to account for this somehow.

(1 edit) (-1)

Thanks for creating this. I am having two issues with it, however.

Whenever I hit the X button to close the window, nothing happens. I have to force close the window. Would this not be usable in production? I'm concerned about how players would handle not being able to close the game in this fashion.

There is a bigger problem, though. Whenever I first load up a game using this, I am met with a pop-up with an exclamation mark. I have to hit the Close button on this pop-up to move forward. I looked through your code and I'm not sure where this is being called (or why it would be) and I didn't find anything.

I'm using GMS 2.3, any ideas why this may be happening? It also happens in your provided project, so it's not a case of user implementation error.

(1 edit) (+1)

Regarding the exclamation message, you’ll need to remove that single show_message call from window_frame.gml in the extension’s directory. That is a leftover of me spending a while trying to figure out why the extension wouldn’t work right in GMS2.x

By default, the example demonstrates Window Commands functions and will wait 30 frames before closing the game. You can find a handful of comments in the example object.

Thank you. In regards to the window_frame.gml, I confess I'm not very well versed in how to change anything regarding extensions. I poked around in GMS2.3 and looked through the window_frame.gml in the Extensions section but I don't really see any meaningful data in there at all, none-the-less anything about a show_message, so I must be missing how you properly go about modifying an Extension.

(+1)

You go into the extension’s directory in Explorer and open the file with any text/code editor

This is a great extension! Once I understood how to get the most out of it, it made the window handling for my current project look so much more professional. I love you work, YAL, and your NSFS extension worked wonders for me!

However, for the life of me, I can't grasp out how to make the project detect controllers while this extension is active; I've read in the May 26 devlog that this was fixed, but I don't know what I'm doing wrong-  ; ^ ;

Is there something that I'm missing? All I have is calling "window_frame_update()" every frame, disabled the default window border, and kept the frame size updated to match the window frame every frame, as well, for easy resizing; commenting out the latter didn't help, and I didn't need to use application surface functions to get the results I have. It's just three lines of code at the very beginning of the Step Event.

Should be fine - check if the example project works? It draws the direction of left stick of first gamepad around the mouse cursor.

So that's what that does? That's neat!

The direction of the circle below the mouse cursor doesn't change for the first controller slot, unfortunately; not for any directions after the first frame of the example launching. So if I held down on the analog stick as it was starting, it shows a long line facing down below the cursor, but doesn't update after that.

I'm on Windows 8.1 still, if that matters here.

An update on the matter: My Windows 10 testers can't receive inputs from their controllers either, while the extension is turned on.

I'm finishing this game in Studio 1.4, so I wonder if this issue is unique to 1.4, but works fine on Studio 2? I own Studio 2 as well, but I'm waiting until my first original project to use it; the current project relies too heavily on 1.4's tile system to be ported easily.

If you are using the most recent version of the extension’s example project (I updated it 4 days ago) and a recent version of GMS1 (1.4.1773 or newer), and it doesn’t work, I have no clue - it works fine for me, and worked fine for whomever that proposed this change (further down on the comments page here)

Yes, I am using the new version of the extension, and GMS1 v1.4.9999.


So, if everything's fine on your end, as well as the person who requested the change, then there must be something I need to address on my part, to make my controller code work while the extension is active.

I'll do my best to discover what that is, as well as dig more into how the extension's example handles inputs. The example was a very helpful reference, alongside the docs, in getting the most out of it!

In any case, thank you for your time and confirmation that nothing suddenly broke. You're an outstanding developer, YAL, you do so much for us Game Maker users!

Upon some thought, it might be the change that I made another extension for - I think that made it to 9999: https://yellowafterlife.itch.io/gamepad-force-focus

Hello, thank you for this extension. I seem to be running into some minor errors. (I am using Windows 10, and GMS 2.3.) 

When right clicking on the game, it'll display the name as window_frame_host.exe, with its associated icon. Clicking the icon will show the empty black window: "this is a helper program for window_frame.dll". I've also inconsistently found that trying to close the game project on its own will leave the window frame onscreen. It's hard to recreate this bug, though. Thanks for your time.

I believe the information shown for taskbar buttons comes from the executable information, so at most you could either recompile window_frame_host with your own labels or edit it using Resource Hacker. The earlier-mentioned third party rewrite was supposed to address the issue, but I’m not sure when that’s going to be out.

A black preview is a side effect of however Windows calculates them - I’m not sure if this is easily fixable.

If the game crashes or closes abruptly (without executing the normal game end events), there’ll be no one to tell the frame window to close, so it will only do so once some kind of interaction happens.

If your only desire is to have borderless fullscreen, OutsideTheBox is more reliable.

I love this extension!
Hey I think you should include msvcp140.dll and vcruntime140.dll in the extension, as I had to include them for some systems.

That would be a bug - the DLL is compiled to not have MSVC dependencies, but window_frame_host isn’t.

Is there a specific license for this? I'm wondering if I can include this in my open source project.

If your project is freeware, feel free to pick apart the source code with attribution.

Awesome. Thank you!

(2 edits)

This is amazing, and I'll definitely use for projects.
Just one thing...
What exactly happens when you disable border and then minimize? Because it creates a new window without having minimized the borderless, and then when you return it splits.

Easily avoidable by re-enabling border before minimizing, but I would like to know why that happens, and if it is intended.
Also, when that happens, it can't be closed through the X.

https://imgur.com/a/LWtFJhP

Window Commands like functions all apply to the frame, so using minimize command with frame disabled minimizes the frame, causing it to become visible but not attached to the game window. As mentioned in my comment below, the extension is currently undergoing a rewrite so it is not clear whether it is worth backporting a fix for this.

It's great that it's going to be updated! Will working code for this be compatible, just needing to replace the extension?
If not, please try to, I'd like to already start using this. hahaha

I haven't used this extension in over a year. I found game breaking bug now developing a project in gm2.3 and went online looking to see if you have updated it. Found my answer I trust you to fix in the rewrite, thanks for all your hard work Yellow.

(1 edit)

Found another issue today: If the game "crashes" (i.e., Game Maker pops up an error window), window_frame_host.exe doesn't exit and just sticks around forever.

Also, if I'm in full-screen (via window_frame_set_fullscreen(true)) and I'm not running through the IDE/runner (found in a YYC package build specifically) game maker's error popups show behind the game so I can't see them and I can only close them or exit the game by pressing "enter"

(1 edit)

Fullscreen simply hides away the frame window and runs the regular fullscreen, so I'm not sure if that's something on my part or a more general Windows quirk.

There is in-progress work to make the DLL spawn a secondary thread instead of a separate process (which fixes oddities related to that), but that involves rewriting entirety of the code so may take a bit before it's out.

When I import the extension, only the objects, room, font, and HTML file are included. I tried downloading it again but it still doesn't work.

If you are importing the extension into GMS1, extension is always imported when clicking "Import" so it does not show under resources

I'm trying to import it into GMS2. This image is all I see when importing it.

(4 edits)

This works perfectly on my desktop, but on my laptop (Motile brand, AMD GPU) the code "window_frame_is_ready" always returns false. I'm going to test to see if I can get away with removing this conditional.

EDIT: Well, now I can switch between fullscreen and windowed, but I can't seem to get the window border to appear. Very weird.

That would suggest that the helper executable does not start up for some reason. You could try running it manually and see if the empty window opens at all.

(2 edits)

Love this extension! Couple of things I've noticed...

1) The title bar seems to deactivate when I click inside the game itself. The frame only shows active when I click on the frame itself. This doesn't break anything, but does seem like an odd user experience all the same. This may just be an unavoidable consequence of the fact that there are technically two windows. It'd be lovely if there's a way to fix it, but not end of the world if not.

2) A bit more problematic is that the resize arrows seem to stop showing up after the first time I resize the frame. It's still resizable, the cursors just don't show correctly. I'm working around this by setting the cursor myself, but I thought I'd let you know this is happening in case you weren't aware of it.

I'm not super familiar with WinAPI so I don't really know how easy either of these is to fix, but if you don't get to it in the next... oh, few months while I'm working on my game, I'll probably look into it eventually and see if I can't make you a pull request for it, since you've helpfully provided source. :)

Hey. Do you know why does this happen when pressing Alt + Space?
https://gyazo.com/6269b691321fa4ff36b2cc4cfbd6e165

I have now uploaded a new version that fixes that - a native menu pops up on most windows when you press Alt+Space, but this one certainly isn't having a good time drawing over the game window.

Hello. I tried importing the GMEZ file to a new project in GMStudio 2.
This is the result I got: 
https://gyazo.com/a5af1b486ba7670ef1e79cdf004cb443

It works fine in GMStudio 1... Can you please test it yourself and see if maybe I'm missing something? Thanks and it looks really cool, can't wait to use it!

Don't forget to flag disable the regular border!

Oh right! sorry...

I've seen it and tried to find it in the IDE but then I just forgot about it lol..

i have gms2 can't i include the extension ?

(+1)

You can! Right-click on Extensions section in the resource tree, pick "Import Extension", and it'll let you pick the GMEZ. Or pick "Import" on home tab and pick the GMZ.

i have emotional problems with this, i just want to switch between hd res with border to fullscreen borderless with one button, but after longass trying everything i still dont understand the functions xD if there is any advice you have, ill be thankful. This extension broke me, it broke my will and spirit XD

Unfortunately, in two years time no one agreed to pay me to write out documentation for the extension, and now I do not remember how most of it is supposed to work either, so you'll have to experiment and see how things work.

Hey, love that you made this!

I'm struggling getting window resizing working together with borderless toggling. I can get one or the other working, but I'm not sure how to resize the frame after the window itself has been resized. window_frame_set_rect and window_frame_set_region don't seem to do it, at least not in the order I'm doing it

Also, when "borderless windowed" matches the full size of the screen (fake fullscreen), the taskbar sometimes covers the game. Is there any way around this too?

window_frame_set_rect should work. If you've got a minimal reproducible example, I'll take a look at weekend.

As for taskbar overlap, I've seen someone mention that but again, it's hard to tell what's up without reproduction steps, and even then it sounds like something on Windows' end so is a matter of whether someone is willing to sit down and try different hacks until something fixes it.

It took a bit of finagling, but I figured it out. Had to do window_frame_set_rect(middleX,middleY,w,h), then window_frame_set_region(0,0,w,h), then window_set_size(w,h), then window_set_position(0,0). 

As far as the taskbar overlap, it only shows up on game load, not when player was setting the resolution in game. I just set an alarm on my window manager object with a 20 frame delay that triggers my resolution change script. That puts it back over the taskbar.

Thanks again! Nice to have borderless "fullscreen" windowed be the default but be able to see the frame when it's at lower resolutions. :)

GameMaker Studio 2 support?

The extension reportedly works in GMS2, are you seeing anything particular?

Deleted 1 year ago
(+1)

На данный момент документации не существует, лишь проект-пример (GMZ) и примечания к некоторым функциям в авто-завершении. Если есть возможность пожертвовать ~$20 через итч, документация по 26 функциям расширения может быть написана (пример) на русском или английском языке в ближайший выходной.

Deleted 1 year ago
(+1)

Для игры настраивается borderless режим в global game settings; спустя несколько вызовов window_frame_update расширение подвязывает к игре свое окно-рамку, благодаря которому фриз и устраняется

Deleted 1 year ago
Deleted 1 year ago
(+1)

Не слышал о таком. Если можно маленький проект-пример, на котором проблема воспроизводится, я гляну на досуге

(1 edit)

Hi, I was curious if you had problems with Asynchronous System events while using window_frame. It doesn't seem to fire them anymore while being used. I disabled window_frame temporarily and the async events started firing again.

I need Asynchronous System events for gamepad support :]

Apparently the issue with both is that, since it is the frame window that is in focus rather than the game (though it is a child of it and takes input), it is not counted as active and will not take inputs. Not actually sure if there's an easy fix, but if you know anyone experienced with WinAPI and willing to help, you can have them look at the source code.

I checked the source code and I fixed the focus issue with ( to wndproc of the window_frame_host )

case WM_SETFOCUS: {
            HWND game = (HWND)GetWindowLongPtr( hWnd, GWLP_USERDATA );
            if ( game != nullptr ) {
                if ( IsWindow( game ) ) {
                    SetFocus( game );
                }
            }
            return 0;
        };

This just checks for focus on the window and passes it to the game window. Seems to work for me.

Doesn't fix the gamepad issue though :[

Can you share an edited extension that has this fix? I have downloaded the source code and attempted to fix it myself, but I have no idea what I am doing and my attempts at learning aren't going so well.

Any chance it can be updated with 'window_frame_has_focus' function to check for focus, The 'window_has_focus' gamemaker has won't function properly with this.

TY anyway :)

1) Yes, I see an example from the Window Commands, but I think that this extensions minimizes the window in the Windows Taskbar, and not in the System Tray. Am I mistaken?

2) Let is the question yet. By default, window_set_fullscreen in GMS2 opens a window on the main monitor, or am i mistaken?

Ah, sorry. I didn't pay enough attention to your first message.

  1. It'd take an entirely different system to minimize to tray instead.
    If you are able to pay for that (rough estimate is $100..$150 depending on features), that could be implemented into this or a separate extension.
    (if you are wondering, this extension similarly exists only because someone sponsored the development and was fine with it being made publicly available)
  2. Conventional (DirectX) fullscreen rolls up on the monitor that it was initialized for, so usually the primary one.
    It's usually possible to move the game window between screens via Win+Shift+Left/Right, but I'm not sure if you could cheat it by pressing those keys via keyboard_key_press.
    If window_set_rect has any effect in fullscreen (or you are fine with borderless fullscreen), I could modify my other extension to return screen XYWH per monitor index.

I understand! =) I do not have free money for my non-commercial projects. Maybe later, maybe never, but definitely not now... In other words, I'm a beggar! =) I was just curious about your plans to change this extension. Thanks for answers.

Very nice idea of such an extension. Thank you! Little questions: 1) Is it planned to make to minimize window in system tray? 2) Is it planned to make to fullscreen mode on the monitor on which window is located? Thanks for answers.

(+1)

1. See the example from Window Commands extension, this one has the same-styled functions.
2. Disabling border (see the example attached) would allow you to call window_set_fullscreen as usual.

Very often this blocks the steam overlay from launching with tab-shift. Otherwise works like a charm.

When using this together with Window Commands for GameMaker you get an error:
Maybe include the Freeze feature into Windows Commands?

Compile Extensions...Error : duplicate script name found window_command_hook in extension window_frame in file window_frame.gml
Error : duplicate script name found window_command_unhook in extension window_frame in file window_frame.gml
Error : duplicate script name found window_command_run in extension window_frame in file window_frame.gml
Error : duplicate script name found window_command_get_active in extension window_frame in file window_frame.gml
Error : duplicate script name found window_command_set_active in extension window_frame in file window_frame.gml

(1 edit)

As the description states, this extension includes it's own versions of all of Window Commands functions as they had to be reimplemented in a different way (the window being in an external process and all). You would remove Window Commands when switching to this extension.

ahh. Sorry. I should read more :-)

This extension doesn't appear to include the window_set_topmost function from Window Commands - or am I missing something?

Thank you for all of the excellent software, by the way.

I have to manually backport any functions that I add to Window Commands, so that is not here yet.

gr8 work again mah dood