new options
This commit is contained in:
@@ -7,6 +7,7 @@ package native;
|
||||
<lib name="shell32.lib" if="windows" />
|
||||
<lib name="gdi32.lib" if="windows" />
|
||||
<lib name="ole32.lib" if="windows" />
|
||||
<lib name="uxtheme.lib" if="windows" />
|
||||
</target>
|
||||
')
|
||||
|
||||
@@ -15,6 +16,15 @@ package native;
|
||||
#include "mmdeviceapi.h"
|
||||
#include "combaseapi.h"
|
||||
#include <iostream>
|
||||
#include <Windows.h>
|
||||
#include <cstdio>
|
||||
#include <tchar.h>
|
||||
#include <dwmapi.h>
|
||||
#include <winuser.h>
|
||||
#include <Shlobj.h>
|
||||
#include <wingdi.h>
|
||||
#include <shellapi.h>
|
||||
#include <uxtheme.h>
|
||||
|
||||
#define SAFE_RELEASE(punk) \\
|
||||
if ((punk) != NULL) \\
|
||||
@@ -116,5 +126,47 @@ class WinAPI {
|
||||
public static function registerAudio() {
|
||||
funkin.system.Main.audioDisconnected = false;
|
||||
}
|
||||
|
||||
@:functionCode('
|
||||
int darkMode = enable ? 1 : 0;
|
||||
HWND window = GetActiveWindow();
|
||||
if (S_OK != DwmSetWindowAttribute(window, 19, &darkMode, sizeof(darkMode))) {
|
||||
DwmSetWindowAttribute(window, 20, &darkMode, sizeof(darkMode));
|
||||
}
|
||||
')
|
||||
public static function setDarkMode(enable:Bool) {}
|
||||
|
||||
@:functionCode('
|
||||
// https://stackoverflow.com/questions/15543571/allocconsole-not-displaying-cout
|
||||
|
||||
if (!AllocConsole())
|
||||
return;
|
||||
|
||||
FILE* fDummy;
|
||||
freopen_s(&fDummy, "CONOUT$", "w", stdout);
|
||||
freopen_s(&fDummy, "CONOUT$", "w", stderr);
|
||||
freopen_s(&fDummy, "CONIN$", "r", stdin);
|
||||
std::cout.clear();
|
||||
std::clog.clear();
|
||||
std::cerr.clear();
|
||||
std::cin.clear();
|
||||
|
||||
// std::wcout, std::wclog, std::wcerr, std::wcin
|
||||
HANDLE hConOut = CreateFile(_T("CONOUT$"), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
HANDLE hConIn = CreateFile(_T("CONIN$"), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
SetStdHandle(STD_OUTPUT_HANDLE, hConOut);
|
||||
SetStdHandle(STD_ERROR_HANDLE, hConOut);
|
||||
SetStdHandle(STD_INPUT_HANDLE, hConIn);
|
||||
std::wcout.clear();
|
||||
std::wclog.clear();
|
||||
std::wcerr.clear();
|
||||
std::wcin.clear();
|
||||
')
|
||||
public static function allocConsole() {
|
||||
// LogsOverlay.consoleOpened = LogsOverlay.consoleVisible = true;
|
||||
haxe.Log.trace = function(v:Dynamic, ?infos:haxe.PosInfos) {
|
||||
// nothing here so that it keeps shit clean
|
||||
}
|
||||
}
|
||||
}
|
||||
#end
|
||||
Reference in New Issue
Block a user