Implement SDL3

Co-Authored-By: Abnormal <86753001+AbnormalPoof@users.noreply.github.com>
Co-Authored-By: Karim Akra <144803230+KarimAkra@users.noreply.github.com>
This commit is contained in:
MAJigsaw77
2026-03-10 04:54:26 -05:00
committed by AbnormalPoof
co-authored by Abnormal Karim Akra
parent ac3178118c
commit c4e2b900c1
27 changed files with 267 additions and 450 deletions
-67
View File
@@ -11,37 +11,6 @@
#include <stdint.h>
#include <stdio.h>
void WINAPI_ShowError(void* handle, const char *message, const char *title)
{
HWND hwnd = (HWND)handle;
if (!IsWindow(hwnd))
hwnd = nullptr;
MessageBox(hwnd, message, title, MB_OK | MB_ICONERROR);
}
void WINAPI_ShowWarning(void* handle, const char *message, const char *title)
{
HWND hwnd = (HWND)handle;
if (!IsWindow(hwnd))
hwnd = nullptr;
MessageBox(hwnd, message, title, MB_OK | MB_ICONWARNING);
}
void WINAPI_ShowInformation(void* handle, const char *message, const char *title)
{
HWND hwnd = (HWND)handle;
if (!IsWindow(hwnd))
hwnd = nullptr;
MessageBox(hwnd, message, title, MB_OK | MB_ICONINFORMATION);
}
void WINAPI_DisableErrorReporting()
{
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
@@ -61,39 +30,3 @@ size_t WINAPI_GetProcessMemoryWorkingSetSize()
return 0;
}
void WINAPI_SetDarkMode(void* handle, bool enable)
{
HWND hwnd = (HWND)handle;
if (!IsWindow(hwnd))
return;
int darkMode = enable ? 1 : 0;
if (DwmSetWindowAttribute(hwnd, 20, &darkMode, sizeof(darkMode)) != S_OK)
DwmSetWindowAttribute(hwnd, 19, &darkMode, sizeof(darkMode));
UpdateWindow(hwnd);
}
bool WINAPI_IsSystemDarkMode()
{
HKEY hKey;
DWORD dwValue = 0;
DWORD dwSize = sizeof(DWORD);
DWORD dwType = REG_DWORD;
if (RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
{
if (RegQueryValueEx(hKey, "AppsUseLightTheme", NULL, &dwType, (LPBYTE)&dwValue, &dwSize) == ERROR_SUCCESS)
{
RegCloseKey(hKey);
return dwValue == 0;
}
RegCloseKey(hKey);
}
return false;
}