This extension eliminates a certain caveat in GameMaker where the window ceases operation while being dragged around.
This can be desirable for applications that should not be easily interrupted.
This is a "cheat sheet" for Window Freeze Fix extension by YellowAfterlife.
The extension can be downloaded from itch.io.
Source code can be found on GitHub.
An up-to-date version of this document can always be found online.
Click on sections to expand/collapse them.
Quick display controls: Categories
· Sections
· Everything
·
This extension eliminates a certain caveat in GameMaker where the window ceases operation while
being dragged around.
This can be desirable for applications that should not be easily interrupted.
Since the extension's initial release in 2017 it has been established
that this isn't such a good idea:
All in all, unless your application fits the narrow critera where above are acceptable
sacrifices (read: it is probably not a videogame) or you have the intricate knowledge
of WinAPI required to attempt resolving these issues, I suggest that you do not
use this extension.
Should be called once per frame.
Manages startup and sync (e.g. hiding/unhiding the frame as the game enters/exits fullscreen).
Turns the frame on/off.
Returns whether the frame is currently being shown.
Enables or disables fullscreen.
You must use this in place of regular window_set_fullscreen
or you may land yourself or your project's users in an unusual situation
involving a fullscreen window that is click-through and cannot be minimized.
Counterpart of the above function.
Equivalent to built-in window_has_focus, but counts the frame too.
Returns whether the window (or the frame) is formally maximized.
Note that occupying the entire display area is not the same as maximizing the window,
and this will only change to true when clicking the "maximize" button
or invoking the command.
Returns X of either the frame (if visible) or the game window.
Returns Y of either the frame (if visible) or the game window.
Returns width of either the frame (if visible) or the game window.
Returns height of either the frame (if visible) or the game window.
Returns a 4-element array containing x/y/width/height
of either the frame (if visible) or the game window.
Equivalent to window_set_rectangle.
Will move either the frame (if active)
or the actual game window.
If the frame is resizable, this function allows to specify minimum user-defined size.
For example,
If the frame is resizable, this function allows to specify maximum user-defined size.
For example,
If the frame is active, this moves and/or resizes the game window inside the frame.
From the sample project:
Sets the background color shown on the portions of the frame window not occupied by your game. Can be set to -1 to not draw anything there.
Like window_set_caption, but for the frame.
If you are using extensions that change the window icon,
you can call this function afterwards to carry them over to the frame window.
(note: copies raw HICON IDs, doesn't store bitmaps)
Changes whether the window (game or frame) will stay on top of other windows.
It is most likely possible to break something with this function and it should not
generally be used in videogames.
Returns whether the window (game or frame) is currently marked as stay-on-top.
The following mirror my other extension:
Supported command constants:
State:
Enables or disables a command.
Returns whether succeeded.
Fails if the extension doesn't have a meaningful way of disabling the said command
(in which case you should use hooks instead).
So
would disable the ability to minimize the window.
Note that a disabled (or hooked) command can still be ran via window_command_run.
Returns whether a command is currently enabled, or -1 if unknown.
Hooks:
Hooks the specified command, intercepting the action and allowing you to check
for it using window_command_check. Only button-commands can be hooked.
Un-hooks the specified command, allowing it to be performed as usual.
A convenience function for two of above.
Returns whether the specified command is currently hooked.
Returns whether the given command's button was pressed since the last call to this function.
Invocation:
Runs the specified command, regardless of whether it is currently hooked.
This essentially invokes WM_SYSCOMMAND on the frame.
lParam is optional since for most (all?) commands it contains the mouse coordinates
and is not used by the command processor.
So
would minimize the window when invoked.
NB! Many commands cannot be ran if a mouse button is currently being held down on the window.
You'll want to either run commands on mouse_check_button_released or set a flag on press
and wait for release.
Samuel's borderless fullscreen implementation
for the video player extension.
I think this implies disabling the frame yourself beforehand.
Counterpart of above function.
Takes a buffer_get_address of a buffer and pokes the frame's HWND to
beginning of it as buffer_u64.
Rest assured, the buffer should be at least 8 bytes long or your game will hard crash.
Returns the frame's HWND (a 64-bit integer) as a string.
You should subsequently call int64 on the result to convert it to an actual int64.
For example, should you comment out the window_frame_force_focus
call in window_frame.gml, after entering and exiting fullscreen something strange
will happen to the frame window after the game's window is clicked, causing it to
become unfocusable and unable to process window button (min/max/close) clicks.
window_frame_set_min_size(224, 192);
window_frame_set_max_size(1600, 900);
// resize the game to fit the container window if it's visible
// (if you don't do window resizing, you don't need this)
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)
) {
// resize room (since we don't use views):
room_width = w; room_height = h;
// resize the game inside the frame-window to fit it's size:
window_frame_set_region(0, 0, w, h);
// also resize application_surface:
surface_resize(application_surface, w, h);
}
}
window_frame_set_background(make_color_rgb(136, 158, 197));
The button for un-maximizing the window.
Disabling this can be generally considered somewhat evil.
If disabled, the window cannot be resized.
If disabled, the window cannot be dragged around.
For example, for buttons this grays out the button.
window_command_set_active(window_command_minimize, 0);
window_command_run(window_command_minimize);