File tree Expand file tree Collapse file tree
source/funkin/backend/utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,8 +2,8 @@ package funkin.backend.utils;
22
33import lime .graphics .Image ;
44import openfl .Lib ;
5- import openfl .system .Capabilities ;
65#if windows
6+ import openfl .system .Capabilities ;
77import funkin .backend .utils .native .Windows ;
88#end
99
@@ -75,20 +75,25 @@ final class WindowUtils {
7575 * @param height The window's resolution height (Defaults to 720).
7676 * @param changeSize Should it also update the window size.
7777 **/
78- public static function setResolution (? width : Int , ? height : Int , changeSize = #if windows true #else false #end ) {
78+ public static function setResolution (? width : Int , ? height : Int , changeSize = true ) {
7979
8080 var w = width == null ? Flags .GAME_WIDTH : width ;
8181 var h = height == null ? Flags .GAME_HEIGHT : height ;
8282
83+ if (FlxG .width == w && FlxG .height == h )
84+ return ;
85+
8386 var win = Lib .application .window ;
8487
8588 @:privateAccess {
86- if (changeSize ){
87- win .resize (w , h );
88-
89- win .x = Std .int ((Capabilities .screenResolutionX / 2 ) - (w / 2 ));
90- win .y = Std .int ((Capabilities .screenResolutionY / 2 ) - (h / 2 ));
91- }
89+ #if windows
90+ if (changeSize ){
91+ win .resize (w , h );
92+
93+ win .x = Std .int ((Capabilities .screenResolutionX / 2 ) - (w / 2 ));
94+ win .y = Std .int ((Capabilities .screenResolutionY / 2 ) - (h / 2 ));
95+ }
96+ #end
9297
9398 FlxG .width = FlxG .initialWidth = w ; FlxG .height = FlxG .initialHeight = h ;
9499 }
You can’t perform that action at this time.
0 commit comments