diff options
| author | Saracen | 2016-01-03 04:18:28 +0000 |
|---|---|---|
| committer | Saracen | 2016-03-12 16:38:12 +0000 |
| commit | 6eb4812317bc5207444ddbfe887d06969969b669 (patch) | |
| tree | 507901307887e4fb93d86917d79a552e264af042 /platform/windows/os_windows.cpp | |
| parent | 8b1dcbfe4d92f9d7273bbd2f1eb805e5c508961a (diff) | |
| download | godot-6eb4812.tar.gz godot-6eb4812.tar.zst godot-6eb4812.zip | |
Borderless window support for the Win32 build. Default window position is now also centred.
Diffstat (limited to 'platform/windows/os_windows.cpp')
| -rw-r--r-- | platform/windows/os_windows.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index cad14430e..9def8d4f9 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -177,6 +177,7 @@ void OS_Windows::initialize_core() { //RedirectIOToConsole(); maximized=false; minimized=false; + borderless=false; ThreadWindows::make_default(); SemaphoreWindows::make_default(); @@ -884,7 +885,7 @@ void OS_Windows::initialize(const VideoMode& p_desired,int p_video_driver,int p_ DWORD dwExStyle; DWORD dwStyle; - if (video_mode.fullscreen) { + if (video_mode.fullscreen||video_mode.borderless_window) { dwExStyle=WS_EX_APPWINDOW; dwStyle=WS_POPUP; @@ -930,7 +931,7 @@ void OS_Windows::initialize(const VideoMode& p_desired,int p_video_driver,int p_ video_mode.fullscreen = false; } else { - if (!(hWnd=CreateWindowExW(dwExStyle,L"Engine",L"", dwStyle|WS_CLIPSIBLINGS|WS_CLIPCHILDREN, 0, 0,WindowRect.right-WindowRect.left,WindowRect.bottom-WindowRect.top, NULL,NULL, hInstance,NULL))) { + if (!(hWnd=CreateWindowExW(dwExStyle,L"Engine",L"", dwStyle|WS_CLIPSIBLINGS|WS_CLIPCHILDREN, (GetSystemMetrics(SM_CXSCREEN)-WindowRect.right)/2, (GetSystemMetrics(SM_CYSCREEN)-WindowRect.bottom)/2, WindowRect.right-WindowRect.left,WindowRect.bottom-WindowRect.top, NULL,NULL, hInstance,NULL))) { MessageBoxW(NULL,L"Window Creation Error.",L"ERROR",MB_OK|MB_ICONEXCLAMATION); return; // Return FALSE } @@ -1528,6 +1529,14 @@ bool OS_Windows::is_window_maximized() const{ } +void OS_Windows::set_borderless_window(int p_borderless) { + video_mode.borderless_window = p_borderless; +} + +bool OS_Windows::get_borderless_window() { + return video_mode.borderless_window; +} + void OS_Windows::print_error(const char* p_function, const char* p_file, int p_line, const char* p_code, const char* p_rationale, ErrorType p_type) { HANDLE hCon = GetStdHandle(STD_OUTPUT_HANDLE); |
