summaryrefslogtreecommitdiff
path: root/platform/windows
diff options
context:
space:
mode:
Diffstat (limited to 'platform/windows')
-rw-r--r--platform/windows/context_gl_win.cpp16
-rw-r--r--platform/windows/joypad.cpp4
-rw-r--r--platform/windows/os_windows.cpp11
3 files changed, 23 insertions, 8 deletions
diff --git a/platform/windows/context_gl_win.cpp b/platform/windows/context_gl_win.cpp
index 328b987f1f..8640f27699 100644
--- a/platform/windows/context_gl_win.cpp
+++ b/platform/windows/context_gl_win.cpp
@@ -130,24 +130,28 @@ Error ContextGL_Win::initialize() {
0, 0, 0 // Layer Masks Ignored
};
- if (!(hDC = GetDC(hWnd))) {
+ hDC = GetDC(hWnd);
+ if (!hDC) {
MessageBox(NULL, "Can't Create A GL Device Context.", "ERROR", MB_OK | MB_ICONEXCLAMATION);
return ERR_CANT_CREATE; // Return FALSE
}
- if (!(pixel_format = ChoosePixelFormat(hDC, &pfd))) // Did Windows Find A Matching Pixel Format?
+ pixel_format = ChoosePixelFormat(hDC, &pfd);
+ if (!pixel_format) // Did Windows Find A Matching Pixel Format?
{
MessageBox(NULL, "Can't Find A Suitable pixel_format.", "ERROR", MB_OK | MB_ICONEXCLAMATION);
return ERR_CANT_CREATE; // Return FALSE
}
- if (!SetPixelFormat(hDC, pixel_format, &pfd)) // Are We Able To Set The Pixel Format?
+ BOOL ret = SetPixelFormat(hDC, pixel_format, &pfd);
+ if (!ret) // Are We Able To Set The Pixel Format?
{
MessageBox(NULL, "Can't Set The pixel_format.", "ERROR", MB_OK | MB_ICONEXCLAMATION);
return ERR_CANT_CREATE; // Return FALSE
}
- if (!(hRC = wglCreateContext(hDC))) // Are We Able To Get A Rendering Context?
+ hRC = wglCreateContext(hDC);
+ if (!hRC) // Are We Able To Get A Rendering Context?
{
MessageBox(NULL, "Can't Create A Temporary GL Rendering Context.", "ERROR", MB_OK | MB_ICONEXCLAMATION);
return ERR_CANT_CREATE; // Return FALSE
@@ -175,8 +179,8 @@ Error ContextGL_Win::initialize() {
return ERR_CANT_CREATE;
}
- HGLRC new_hRC;
- if (!(new_hRC = wglCreateContextAttribsARB(hDC, 0, attribs))) {
+ HGLRC new_hRC = wglCreateContextAttribsARB(hDC, 0, attribs);
+ if (!new_hRC) {
wglDeleteContext(hRC);
MessageBox(NULL, "Can't Create An OpenGL 3.3 Rendering Context.", "ERROR", MB_OK | MB_ICONEXCLAMATION);
return ERR_CANT_CREATE; // Return false
diff --git a/platform/windows/joypad.cpp b/platform/windows/joypad.cpp
index 00cfa812de..0c7358f499 100644
--- a/platform/windows/joypad.cpp
+++ b/platform/windows/joypad.cpp
@@ -379,7 +379,9 @@ void JoypadWindows::process_joypads() {
IDirectInputDevice8_Acquire(joy->di_joy);
joy->di_joy->Poll();
}
- if (FAILED(hr = joy->di_joy->GetDeviceState(sizeof(DIJOYSTATE2), &js))) {
+
+ hr = joy->di_joy->GetDeviceState(sizeof(DIJOYSTATE2), &js);
+ if (FAILED(hr)) {
//printf("failed to read joy #%d\n", i);
continue;
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index deb9c25576..5814d883cd 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -996,7 +996,16 @@ void OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
video_mode.fullscreen = false;
} else {
- 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))) {
+ 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);
+ if (!hWnd) {
MessageBoxW(NULL, L"Window Creation Error.", L"ERROR", MB_OK | MB_ICONEXCLAMATION);
return; // Return FALSE
}