summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2016-03-12 17:40:56 +0100
committerRémi Verschelde <remi@verschelde.fr>2016-03-12 17:40:56 +0100
commit082092267a1ee41600b6d21a42f2d0cfc63e4b3e (patch)
tree507901307887e4fb93d86917d79a552e264af042 /platform
parent8b1dcbfe4d92f9d7273bbd2f1eb805e5c508961a (diff)
parent6eb4812317bc5207444ddbfe887d06969969b669 (diff)
Merge pull request #3215 from SaracenOne/borderless_windows
Borderless windows
Diffstat (limited to 'platform')
-rw-r--r--platform/windows/os_windows.cpp13
-rw-r--r--platform/windows/os_windows.h4
2 files changed, 15 insertions, 2 deletions
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index cad14430e6..9def8d4f9c 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);
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index 28bb30b370..3116847daa 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -179,6 +179,7 @@ protected:
Vector<MonitorInfo> monitor_info;
bool maximized;
bool minimized;
+ bool borderless;
static BOOL CALLBACK MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData);
@@ -223,6 +224,9 @@ public:
virtual void set_window_maximized(bool p_enabled);
virtual bool is_window_maximized() const;
+ virtual void set_borderless_window(int p_borderless);
+ virtual bool get_borderless_window();
+
virtual MainLoop *get_main_loop() const;
virtual String get_name();