Skip to content

Commit

Permalink
Fix macOS fullscreen and included files
Browse files Browse the repository at this point in the history
  • Loading branch information
nkrapivin committed Mar 12, 2022
1 parent 8c11a58 commit 501e029
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 16 deletions.
14 changes: 7 additions & 7 deletions SonicTimeTwisted.gmx/Configs/MacOS.config.gmx
Original file line number Diff line number Diff line change
Expand Up @@ -405,26 +405,26 @@
<option_loadtransparent>false</option_loadtransparent>
<option_mac_app_category>Action Games : public.app-category.action-games</option_mac_app_category>
<option_mac_app_id>com.overboundstudio.sonictimetwisted</option_mac_app_id>
<option_mac_appstore_incoming_allow>0</option_mac_appstore_incoming_allow>
<option_mac_appstore_outgoing_allow>0</option_mac_appstore_outgoing_allow>
<option_mac_appstore_incoming_allow>-1</option_mac_appstore_incoming_allow>
<option_mac_appstore_outgoing_allow>-1</option_mac_appstore_outgoing_allow>
<option_mac_build_version>2</option_mac_build_version>
<option_mac_copyright_info>(c)2022 Overbound Game Studio</option_mac_copyright_info>
<option_mac_copyright_info>(c) 2022 Overbound and contributors</option_mac_copyright_info>
<option_mac_create_app_store>0</option_mac_create_app_store>
<option_mac_display_name>Sonic Time Twisted</option_mac_display_name>
<option_mac_enable_retina>-1</option_mac_enable_retina>
<option_mac_enable_retina>0</option_mac_enable_retina>
<option_mac_enable_steam>0</option_mac_enable_steam>
<option_mac_fullscreen>0</option_mac_fullscreen>
<option_mac_icon_png>Configs\MacOS\mac\icon512.png</option_mac_icon_png>
<option_mac_interpolate>0</option_mac_interpolate>
<option_mac_major_version>1</option_mac_major_version>
<option_mac_menu_dock>0</option_mac_menu_dock>
<option_mac_minor_version>1</option_mac_minor_version>
<option_mac_output_dir>~/GameMaker-Studio/SonicTimeTwisted</option_mac_output_dir>
<option_mac_output_dir>~/GameMaker-Studio/STT</option_mac_output_dir>
<option_mac_scale>-1</option_mac_scale>
<option_mac_screenkey>0</option_mac_screenkey>
<option_mac_screenkey>-1</option_mac_screenkey>
<option_mac_showcursor>0</option_mac_showcursor>
<option_mac_signing_identity>Apple Development: [email protected] (GKJ63CR7Y5)</option_mac_signing_identity>
<option_mac_sizeable>0</option_mac_sizeable>
<option_mac_sizeable>-1</option_mac_sizeable>
<option_mac_splash_png>Configs\MacOS\mac\splash.png</option_mac_splash_png>
<option_mac_steam_app_id>0</option_mac_steam_app_id>
<option_mac_sync>1</option_mac_sync>
Expand Down
18 changes: 9 additions & 9 deletions SonicTimeTwisted.gmx/SonicTimeTwisted.project.gmx
Original file line number Diff line number Diff line change
Expand Up @@ -1859,19 +1859,19 @@
<CopyToMask>2097160</CopyToMask>
</Config>
<Config name="AndroidSmartphone">
<CopyToMask>9223372036854775807</CopyToMask>
<CopyToMask>2097160</CopyToMask>
</Config>
<Config name="AndroidConsole">
<CopyToMask>9223372036854775807</CopyToMask>
<CopyToMask>2097160</CopyToMask>
</Config>
<Config name="MacOS">
<CopyToMask>9223372036854775807</CopyToMask>
<CopyToMask>2097160</CopyToMask>
</Config>
<Config name="Linux">
<CopyToMask>2097160</CopyToMask>
</Config>
<Config name="PlayStation">
<CopyToMask>9223372036854775807</CopyToMask>
<CopyToMask>2097160</CopyToMask>
</Config>
<Config name="Browser">
<CopyToMask>2097160</CopyToMask>
Expand All @@ -1894,19 +1894,19 @@
<CopyToMask>2097160</CopyToMask>
</Config>
<Config name="AndroidSmartphone">
<CopyToMask>9223372036854775807</CopyToMask>
<CopyToMask>2097160</CopyToMask>
</Config>
<Config name="AndroidConsole">
<CopyToMask>9223372036854775807</CopyToMask>
<CopyToMask>2097160</CopyToMask>
</Config>
<Config name="MacOS">
<CopyToMask>9223372036854775807</CopyToMask>
<CopyToMask>2097160</CopyToMask>
</Config>
<Config name="Linux">
<CopyToMask>2097160</CopyToMask>
</Config>
<Config name="PlayStation">
<CopyToMask>9223372036854775807</CopyToMask>
<CopyToMask>2097160</CopyToMask>
</Config>
<Config name="Browser">
<CopyToMask>2097160</CopyToMask>
Expand Down Expand Up @@ -5837,7 +5837,7 @@
</rooms>
</rooms>
<constants number="90">
<constant name="VERSION">"v1.1.2"</constant>
<constant name="VERSION">"v1.1.2.1"</constant>
<constant name="GAMEPAD_POV_Y">7</constant>
<constant name="GAMEPAD_POV_X">6</constant>
<constant name="GAMEPAD_AXIS_V">5</constant>
Expand Down
32 changes: 32 additions & 0 deletions SonicTimeTwisted.gmx/objects/objScreen.object.gmx
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,38 @@ show_debug_message("video_mode = " + string(video_mode));
<argument>
<kind>1</kind>
<string>///Detect alt-enter or enter-alt presses.

// macOS special begin, this does nothing on any target that's not macOS!
if (DEVICE_INFO &amp; DEVICE_OS_MACOS) {
var _iswindowfs = window_get_fullscreen();
var _isgamefs = video_mode == 0;
// check if the window state does not match game's expected state.
if (_iswindowfs &amp;&amp; !_isgamefs) {
// window is now fullscreen, update video_mode accordingly
prev_video_mode = video_mode;
video_mode = 0; // fs
window_scale = 0; // fs
show_debug_message("osx: wnd -&gt; fs: prevscale=" + string(prev_video_mode));
save_options();
}
else if (!_iswindowfs &amp;&amp; _isgamefs) {
// fetch max_scale from display:
event_user(3);
// fun:
var _scalebyX = clamp(window_get_width() div width, 1, max_scale);
var _scalebyY = clamp(window_get_height() div height, 1, max_scale);
// pick the minimum scale (so it fits)
var _scaleguess = min(_scalebyX, _scalebyY);
video_mode = _scaleguess;
window_scale = _scaleguess;
show_debug_message("osx: fs -&gt; wnd: scale=" + string(video_mode));
save_options();
}
// do not execute the code below please, we can't do that.
exit;
}
// macOS special end

// Since we can never trust GameMaker, let's handle Alt-Enter manually.
// oh and Alt-Enter can be pressed in various ways, Alt-Enter, Enter-Alt, weird!
// PS: This user event can technically be called from any object.
Expand Down

0 comments on commit 501e029

Please sign in to comment.