Merge remote-tracking branch 'upstream/main'
This commit is contained in:
@@ -3,6 +3,7 @@ package funkin.backend.utils;
|
||||
import funkin.backend.utils.native.*;
|
||||
import flixel.util.typeLimit.OneOfTwo;
|
||||
import flixel.util.typeLimit.OneOfThree;
|
||||
import flixel.util.FlxColor;
|
||||
|
||||
/**
|
||||
* Class for functions that talk to a lower level than haxe, such as message boxes, and more.
|
||||
@@ -84,12 +85,86 @@ class NativeAPI {
|
||||
#end
|
||||
}
|
||||
|
||||
/**
|
||||
* WINDOW COLOR MODE FUNCTIONS.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Switch the window's color mode to dark or light mode.
|
||||
*/
|
||||
public static function setDarkMode(title:String, enable:Bool) {
|
||||
#if windows
|
||||
if(title == null) title = lime.app.Application.current.window.title;
|
||||
Windows.setDarkMode(title, enable);
|
||||
#end
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch the window's color to any color.
|
||||
*
|
||||
* WARNING: This is exclusive to windows 11 users, unfortunately.
|
||||
*
|
||||
* NOTE: Setting the color to 0x00000000 (FlxColor.TRANSPARENT) will set the border (must have setBorder on) invisible.
|
||||
*/
|
||||
public static function setWindowBorderColor(title:String, color:FlxColor, setHeader:Bool = true, setBorder:Bool = true) {
|
||||
#if windows
|
||||
if(title == null) title = lime.app.Application.current.window.title;
|
||||
Windows.setWindowBorderColor(title, [color.red, color.green, color.blue, color.alpha], setHeader, setBorder);
|
||||
#end
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the window's border color to the default one.
|
||||
*
|
||||
* WARNING: This is exclusive to windows 11 users, unfortunately.
|
||||
**/
|
||||
public static function resetWindowBorderColor(title:String, setHeader:Bool = true, setBorder:Bool = true) {
|
||||
#if windows
|
||||
if(title == null) title = lime.app.Application.current.window.title;
|
||||
Windows.setWindowBorderColor(title, [-1, -1, -1, -1], setHeader, setBorder);
|
||||
#end
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch the window's title text to any color.
|
||||
*
|
||||
* WARNING: This is exclusive to windows 11 users, unfortunately.
|
||||
*/
|
||||
public static function setWindowTitleColor(title:String, color:FlxColor) {
|
||||
#if windows
|
||||
if(title == null) title = lime.app.Application.current.window.title;
|
||||
Windows.setWindowTitleColor(title, [color.red, color.green, color.blue, color.alpha]);
|
||||
#end
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the window's title color to the default one.
|
||||
*
|
||||
* WARNING: This is exclusive to windows 11 users, unfortunately.
|
||||
**/
|
||||
public static function resetWindowTitleColor(title:String) {
|
||||
#if windows
|
||||
if(title == null) title = lime.app.Application.current.window.title;
|
||||
Windows.setWindowTitleColor(title, [-1, -1, -1, -1]);
|
||||
#end
|
||||
}
|
||||
|
||||
/**
|
||||
* Forces the window header to redraw, causes a small visual jitter so use it sparingly.
|
||||
*/
|
||||
public static function redrawWindowHeader() {
|
||||
#if windows
|
||||
flixel.FlxG.stage.window.borderless = true;
|
||||
flixel.FlxG.stage.window.borderless = false;
|
||||
#end
|
||||
}
|
||||
|
||||
/**
|
||||
* Can be used to check if your using a specific version of an OS (or if your using a certain OS).
|
||||
*/
|
||||
public static function hasVersion(vers:String)
|
||||
return lime.system.System.platformLabel.toLowerCase().indexOf(vers.toLowerCase()) != -1;
|
||||
|
||||
/**
|
||||
* Shows a message box
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user