MCPcopy Create free account
hub / github.com/aardappel/treesheets / MakeDPIAware

Function MakeDPIAware

lobster/src/platform.cpp:461–497  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

459}
460
461void MakeDPIAware() {
462 #ifdef _WIN32
463 // Without this, Windows scales the GL window if scaling is set in display settings.
464 #ifndef DPI_ENUMS_DECLARED
465 typedef enum PROCESS_DPI_AWARENESS
466 {
467 PROCESS_DPI_UNAWARE = 0,
468 PROCESS_SYSTEM_DPI_AWARE = 1,
469 PROCESS_PER_MONITOR_DPI_AWARE = 2
470 } PROCESS_DPI_AWARENESS;
471 #endif
472
473 typedef BOOL (WINAPI * SETPROCESSDPIAWARE_T)(void);
474 typedef HRESULT (WINAPI * SETPROCESSDPIAWARENESS_T)(PROCESS_DPI_AWARENESS);
475 HMODULE shcore = LoadLibraryA("Shcore.dll");
476 SETPROCESSDPIAWARENESS_T SetProcessDpiAwareness = NULL;
477 if (shcore) {
478 SetProcessDpiAwareness =
479 (SETPROCESSDPIAWARENESS_T)GetProcAddress(shcore, "SetProcessDpiAwareness");
480 }
481 HMODULE user32 = LoadLibraryA("User32.dll");
482 SETPROCESSDPIAWARE_T SetProcessDPIAware = NULL;
483 if (user32) {
484 SetProcessDPIAware =
485 (SETPROCESSDPIAWARE_T)GetProcAddress(user32, "SetProcessDPIAware");
486 }
487
488 if (SetProcessDpiAwareness) {
489 SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE);
490 } else if (SetProcessDPIAware) {
491 SetProcessDPIAware();
492 }
493
494 if (user32) FreeLibrary(user32);
495 if (shcore) FreeLibrary(shcore);
496 #endif
497}
498
499string GetDateTime() {
500 time_t t;

Callers 1

SDLInitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected