@@ -41,12 +41,23 @@ class Preferences
4141 {
4242 #if web
4343 return 60 ;
44+ #elseif mobile
45+ var refreshRate : Int = FlxG .stage .window .displayMode .refreshRate ;
46+
47+ if (refreshRate < 60 ) refreshRate = 60 ;
48+
49+ return refreshRate ;
4450 #else
4551 var save : Save = Save .instance ;
4652 save .options .framerate = value ;
4753 Save .system .flush ();
48- FlxG .updateFramerate = value ;
49- FlxG .drawFramerate = value ;
54+
55+ if (! unlockedFramerate )
56+ {
57+ FlxG .updateFramerate = value ;
58+ FlxG .drawFramerate = value ;
59+ }
60+
5061 return value ;
5162 #end
5263 }
@@ -69,13 +80,13 @@ class Preferences
6980 static function set_naughtyness (value : Bool ): Bool
7081 {
7182 #if NO_FEATURE_NAUGHTYNESS
72- value = false ;
73- #end
74-
83+ return false ;
84+ #else
7585 var save : Save = Save .instance ;
7686 save .options .naughtyness = value ;
7787 Save .system .flush ();
7888 return value ;
89+ #end
7990 }
8091
8192 /**
@@ -146,8 +157,7 @@ class Preferences
146157 {
147158 #if NO_FEATURE_DEBUG_DISPLAY
148159 return DebugDisplayMode . Off ;
149- #end
150-
160+ #else
151161 #if hl
152162 // Account for when debugDisplay used to be a boolean
153163 var options : Null <SaveDataOptions > = Save .instance ?. options ;
@@ -158,18 +168,22 @@ class Preferences
158168 Save .system .flush ();
159169 }
160170 #end
161-
162171 return Save ?. instance ?. options ?. debugDisplay ?? ' Off' ;
172+ #end
163173 }
164174
165175 static function set_debugDisplay (value : DebugDisplayMode ): DebugDisplayMode
166176 {
177+ #if NO_FEATURE_DEBUG_DISPLAY
178+ return DebugDisplayMode . Off ;
179+ #else
167180 if (value != Save .instance .options .debugDisplay ) setDebugDisplayMode (value );
168181
169182 var save = Save .instance ;
170183 save .options .debugDisplay = value ;
171184 Save .system .flush ();
172185 return value ;
186+ #end
173187 }
174188
175189 /**
@@ -264,18 +278,23 @@ class Preferences
264278 {
265279 #if mobile
266280 return false ;
267- #end
281+ #else
268282 return Save ?. instance ?. options ?. autoPause ?? true ;
283+ #end
269284 }
270285
271286 static function set_autoPause (value : Bool ): Bool
272287 {
288+ #if mobile
289+ return false ;
290+ #else
273291 if (value != Save .instance .options .autoPause ) FlxG .autoPause = value ;
274292
275293 var save : Save = Save .instance ;
276294 save .options .autoPause = value ;
277295 Save .system .flush ();
278296 return value ;
297+ #end
279298 }
280299
281300 /**
@@ -325,6 +344,9 @@ class Preferences
325344
326345 static function get_vsyncMode (): lime.ui. WindowVSyncMode
327346 {
347+ #if mobile
348+ return lime.ui. WindowVSyncMode .OFF ;
349+ #else
328350 var value = Save ?. instance ?. options ?. vsyncMode ?? " Off" ;
329351
330352 return switch (value )
@@ -338,10 +360,14 @@ class Preferences
338360 default :
339361 lime.ui. WindowVSyncMode .OFF ;
340362 };
363+ #end
341364 }
342365
343366 static function set_vsyncMode (value : lime.ui. WindowVSyncMode ): lime.ui. WindowVSyncMode
344367 {
368+ #if mobile
369+ return lime.ui. WindowVSyncMode .OFF ;
370+ #else
345371 var string ;
346372
347373 switch (value )
@@ -362,28 +388,35 @@ class Preferences
362388 save .options .vsyncMode = string ;
363389 Save .system .flush ();
364390 return value ;
391+ #end
365392 }
366393
367394 public static var unlockedFramerate (get , set ): Bool ;
368395
369396 static function get_unlockedFramerate (): Bool
370397 {
398+ #if mobile
399+ return false ;
400+ #else
371401 return Save ?. instance ?. options ?. unlockedFramerate ?? false ;
402+ #end
372403 }
373404
374405 static function set_unlockedFramerate (value : Bool ): Bool
375406 {
407+ #if mobile
408+ return false ;
409+ #else
376410 if (value != Save .instance .options .unlockedFramerate )
377411 {
378- #if web
379412 toggleFramerateCap (value );
380- #end
381413 }
382414
383415 var save : Save = Save .instance ;
384416 save .options .unlockedFramerate = value ;
385417 Save .system .flush ();
386418 return value ;
419+ #end
387420 }
388421
389422 #if web
@@ -496,9 +529,7 @@ class Preferences
496529 setDebugDisplayMode (Preferences .debugDisplay );
497530 setDebugDisplayBGOpacity (Preferences .debugDisplayBGOpacity / 100 );
498531
499- #if web
500532 toggleFramerateCap (Preferences .unlockedFramerate );
501- #end
502533
503534 #if mobile
504535 // Apply the allowScreenTimeout setting.
@@ -511,6 +542,9 @@ class Preferences
511542 #if web
512543 var framerateFunction = unlocked ? unlockedFramerateFunction : lockedFramerateFunction ;
513544 untyped js. Syntax .code (" window.requestAnimationFrame = framerateFunction;" );
545+ #else
546+ FlxG .drawFramerate = unlocked ? 0 : framerate ;
547+ FlxG .updateFramerate = unlocked ? 0 : framerate ;
514548 #end
515549 }
516550
0 commit comments