fixed blur on high dpi systems

This commit is contained in:
Yoshman29
2023-03-18 20:24:00 +01:00
parent f6a11a2472
commit 94518547d2
5 changed files with 31 additions and 7 deletions
+1 -1
View File
@@ -1 +1 @@
2596
2602
+16
View File
@@ -46,4 +46,20 @@ typedef UIContextMenuOption = {
var ?icon:Int;
var ?onSelect:Void->Void;
var ?childs:Array<UIContextMenuOption>;
}
class UIContextMenuOptionSpr extends UISpliceSprite {
public var label:UIText;
public function new(x:Float, y:Float, t:String) {
label = new UIText(20, 2, 0, t);
super(x, y, label.frameWidth + 22, label.frameHeight + 4, 'editors/ui/button');
members.push(label);
}
public override function draw() {
alpha = hovered ? 1 : 0;
label.follow(this, 20, 2);
super.draw();
}
}
+6
View File
@@ -12,6 +12,12 @@ class WindowsAPI {
native.WinAPI.registerAudio();
#end
}
@:dox(hide) public static function registerAsDPICompatible() {
#if windows
native.WinAPI.registerAsDPICompatible();
#end
}
/**
* Allocates a new console. The console will automatically be opened
+1
View File
@@ -529,6 +529,7 @@ class System
// executes first!!
#if sys
funkin.windows.WindowsAPI.registerAsDPICompatible();
funkin.system.CommandLineHandler.parseCommandLine(Sys.args());
#end
+7 -6
View File
@@ -9,6 +9,7 @@ import funkin.windows.WindowsAPI.MessageBoxIcon;
<lib name="gdi32.lib" if="windows" />
<lib name="ole32.lib" if="windows" />
<lib name="uxtheme.lib" if="windows" />
<lib name="Shcore.lib" if="windows" />
</target>
')
@@ -26,6 +27,7 @@ import funkin.windows.WindowsAPI.MessageBoxIcon;
#include <wingdi.h>
#include <shellapi.h>
#include <uxtheme.h>
#include <ShellScalingApi.h>
#define SAFE_RELEASE(punk) \\
if ((punk) != NULL) \\
@@ -150,34 +152,33 @@ class WinAPI {
}
#if windows
@:functionCode('
HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(console, color);
')
#end
public static function setConsoleColors(color:Int) {
}
#if windows
@:functionCode('
system("CLS");
std::cout<< "" <<std::flush;
')
#end
public static function clearScreen() {
}
#if windows
@:functionCode('
MessageBox(GetActiveWindow(), message, caption, icon | MB_SETFOREGROUND);
')
#end
public static function showMessageBox(caption:String, message:String, icon:MessageBoxIcon = MSG_WARNING) {
}
@:functionCode('
SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE);
')
public static function registerAsDPICompatible() {}
}
#end