diff options
| author | Aldrik Ramaekers <aldrikboy@gmail.com> | 2024-03-11 22:04:49 +0100 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrikboy@gmail.com> | 2024-03-11 22:04:49 +0100 |
| commit | 089f1d902c1f1c89b5b39fd3cf093313be3ebc7f (patch) | |
| tree | a0c9422d3b2c63416a22d712bc4784d1336c0bc9 /src/windows | |
| parent | 8808c195069e4dcf44218ebf7ca481a4c695fb12 (diff) | |
quick save, show output file in title bar
Diffstat (limited to 'src/windows')
| -rw-r--r-- | src/windows/main_windows.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/windows/main_windows.cpp b/src/windows/main_windows.cpp index af64fc6..f7f2901 100644 --- a/src/windows/main_windows.cpp +++ b/src/windows/main_windows.cpp @@ -41,6 +41,7 @@ static int g_Width; static int g_Height; LARGE_INTEGER Frequency; bool program_running = true; +HWND window_handle; bool CreateDeviceWGL(HWND hWnd, WGL_WindowData* data); void CleanupDeviceWGL(HWND hWnd, WGL_WindowData* data); @@ -97,15 +98,25 @@ static void _ts_platform_draw_frame() { ::SwapBuffers(g_MainWindow.hDC); } +void ts_platform_set_window_title(utf8_int8_t* str) { + // convert utf8 to wchar path. + wchar_t wchar_buffer[MAX_INPUT_LENGTH]; + MultiByteToWideChar(CP_UTF8, 0, str, -1, (wchar_t*)wchar_buffer, MAX_INPUT_LENGTH); + + SetWindowTextW(window_handle, wchar_buffer); +} + int main(int, char**) { CoInitializeEx(0, COINIT_MULTITHREADED|COINIT_DISABLE_OLE1DDE); + ts_init(); // Create application window //ImGui_ImplWin32_EnableDpiAwareness(); WNDCLASSEXW wc = { sizeof(wc), CS_OWNDC, WndProc, 0L, 0L, GetModuleHandle(nullptr), nullptr, nullptr, nullptr, nullptr, L"ImGui Example", nullptr }; ::RegisterClassExW(&wc); HWND hwnd = ::CreateWindowW(wc.lpszClassName, L"Text-Search", WS_OVERLAPPEDWINDOW, 100, 100, 1280, 800, nullptr, nullptr, wc.hInstance, nullptr); + window_handle = hwnd; // Initialize OpenGL if (!CreateDeviceWGL(hwnd, &g_MainWindow)) @@ -143,7 +154,6 @@ int main(int, char**) QueryPerformanceFrequency(&Frequency); - ts_init(); ts_load_images(); ts_load_config(); |
