platform code refactor (#242)

This commit is contained in:
Turánszki János
2021-02-23 00:29:29 +01:00
committed by GitHub
parent bf10893bc7
commit 666dd4ff03
20 changed files with 266 additions and 305 deletions
+2 -2
View File
@@ -90,7 +90,7 @@ public:
m_logicalWidth = window.Bounds().Width;
m_logicalHeight = window.Bounds().Height;
main.SetWindow(&window);
main.SetWindow(window);
}
void Load(winrt::hstring const&) noexcept
@@ -145,7 +145,7 @@ protected:
m_logicalWidth = sender.Bounds().Width;
m_logicalHeight = sender.Bounds().Height;
float dpiscale = wiPlatform::GetDPIScaling();
float dpiscale = wiRenderer::GetDevice()->GetDPIScaling();
uint64_t data = 0;
data |= int(m_logicalWidth * dpiscale);
data |= int(m_logicalHeight * dpiscale) << 16;
+3 -2
View File
@@ -58,6 +58,7 @@ int main(int argc, char *argv[])
//TODO read config.ini
int x = 1920, y = 0, w = 1080, h = 0;
bool fullscreen = false;
bool borderless = false;
string voidStr = "";
@@ -68,7 +69,7 @@ int main(int argc, char *argv[])
file >> voidStr >> enabled;
if (enabled != 0)
{
file >> voidStr >> x >> voidStr >> y >> voidStr >> w >> voidStr >> h >> voidStr >> editor.fullscreen >> voidStr >> borderless;
file >> voidStr >> x >> voidStr >> y >> voidStr >> w >> voidStr >> h >> voidStr >> fullscreen >> voidStr >> borderless;
}
}
file.close();
@@ -82,7 +83,7 @@ int main(int argc, char *argv[])
throw sdl2::SDLError("Error creating window");
}
if(editor.fullscreen) SDL_SetWindowFullscreen(window.get(), SDL_TRUE);
if(fullscreen) SDL_SetWindowFullscreen(window.get(), SDL_TRUE);
editor.SetWindow(window.get());
+9 -2
View File
@@ -117,6 +117,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
hInst = hInstance; // Store instance handle in our global variable
int x = CW_USEDEFAULT, y = 0, w = CW_USEDEFAULT, h = 0;
bool fullscreen = false;
bool borderless = false;
string voidStr = "";
@@ -127,7 +128,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
file >> voidStr >> enabled;
if (enabled != 0)
{
file >> voidStr >> x >> voidStr >> y >> voidStr >> w >> voidStr >> h >> voidStr >> editor.fullscreen >> voidStr >> borderless;
file >> voidStr >> x >> voidStr >> y >> voidStr >> w >> voidStr >> h >> voidStr >> fullscreen >> voidStr >> borderless;
}
}
file.close();
@@ -158,7 +159,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
return FALSE;
}
editor.SetWindow(hWnd);
editor.SetWindow(hWnd, fullscreen);
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
@@ -242,6 +243,12 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_INPUT:
wiRawInput::ParseMessage((void*)lParam);
break;
case WM_KILLFOCUS:
editor.is_window_active = false;
break;
case WM_SETFOCUS:
editor.is_window_active = true;
break;
case WM_PAINT:
{
PAINTSTRUCT ps;