Skip to content

Commit

Permalink
Fix build. And modified updateWindowProps for convenience of debuggin…
Browse files Browse the repository at this point in the history
…g and similarity to other renderers.

Xottab_DUTY: this commit was squashed with my compilation fix commit.
  • Loading branch information
intorr authored and Xottab-DUTY committed Jan 29, 2018
1 parent 7a9e2c3 commit 3dd786b
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 72 deletions.
118 changes: 47 additions & 71 deletions src/Layers/xrRenderGL/glHW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,78 +193,54 @@ void CHW::Reset (HWND hwnd)

void CHW::updateWindowProps(HWND m_hWnd)
{
// BOOL bWindowed = strstr(Core.Params,"-dedicated") ? TRUE : !psDeviceFlags.is (rsFullscreen);
BOOL bWindowed = !psDeviceFlags.is(rsFullscreen);

u32 dwWindowStyle = 0;
// Set window properties depending on what mode were in.
if (bWindowed) {
if (strstr(Core.Params, "-no_dialog_header"))
SetWindowLong(m_hWnd, GWL_STYLE, dwWindowStyle = (WS_BORDER | WS_VISIBLE));
else
SetWindowLong(m_hWnd, GWL_STYLE, dwWindowStyle = (WS_BORDER | WS_DLGFRAME | WS_VISIBLE | WS_SYSMENU | WS_MINIMIZEBOX));

// Change to default resolution
ChangeDisplaySettings(nullptr, CDS_FULLSCREEN);
}
else {
SetWindowLong(m_hWnd, GWL_STYLE, dwWindowStyle = (WS_POPUP | WS_VISIBLE));

DEVMODE dmScreenSettings;
memset(&dmScreenSettings, 0, sizeof(dmScreenSettings));
dmScreenSettings.dmSize = sizeof(dmScreenSettings);
dmScreenSettings.dmPelsWidth = psCurrentVidMode[0];
dmScreenSettings.dmPelsHeight = psCurrentVidMode[1];
dmScreenSettings.dmBitsPerPel = 32;
dmScreenSettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;

// Try To Set Selected Mode And Get Results. NOTE: CDS_FULLSCREEN Gets Rid Of Start Bar.
ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN);
}
bool bWindowed = true;
#ifndef _EDITOR
if (!GEnv.isDedicatedServer)
bWindowed = !psDeviceFlags.is(rsFullscreen);
#endif

if (m_move_window) {
// When moving from fullscreen to windowed mode, it is important to
// adjust the window size after recreating the device rather than
// beforehand to ensure that you get the window size you want. For
// example, when switching from 640x480 fullscreen to windowed with
// a 1000x600 window on a 1024x768 desktop, it is impossible to set
// the window size to 1000x600 until after the display mode has
// changed to 1024x768, because windows cannot be larger than the
// desktop.

RECT m_rcWindowBounds;
BOOL bCenter = FALSE;
if (strstr(Core.Params, "-center_screen")) bCenter = TRUE;

if (bCenter) {
RECT DesktopRect;

GetClientRect(GetDesktopWindow(), &DesktopRect);

SetRect(&m_rcWindowBounds,
(DesktopRect.right - psCurrentVidMode[0]) / 2,
(DesktopRect.bottom - psCurrentVidMode[1]) / 2,
(DesktopRect.right + psCurrentVidMode[0]) / 2,
(DesktopRect.bottom + psCurrentVidMode[1]) / 2);
}
else {
SetRect(&m_rcWindowBounds,
0,
0,
psCurrentVidMode[0],
psCurrentVidMode[1]);
}

AdjustWindowRect(&m_rcWindowBounds, dwWindowStyle, FALSE);

SetWindowPos(m_hWnd,
HWND_TOP,
m_rcWindowBounds.left,
m_rcWindowBounds.top,
(m_rcWindowBounds.right - m_rcWindowBounds.left),
(m_rcWindowBounds.bottom - m_rcWindowBounds.top),
SWP_SHOWWINDOW | SWP_NOCOPYBITS | SWP_DRAWFRAME);
}
u32 dwWindowStyle = 0;
// Set window properties depending on what mode were in.
if (bWindowed)
{
if (m_move_window)
{
dwWindowStyle = WS_BORDER | WS_VISIBLE;
if (!strstr(Core.Params, "-no_dialog_header"))
dwWindowStyle |= WS_DLGFRAME | WS_SYSMENU | WS_MINIMIZEBOX;
SetWindowLong(m_hWnd, GWL_STYLE, dwWindowStyle);
// When moving from fullscreen to windowed mode, it is important to
// adjust the window size after recreating the device rather than
// beforehand to ensure that you get the window size you want. For
// example, when switching from 640x480 fullscreen to windowed with
// a 1000x600 window on a 1024x768 desktop, it is impossible to set
// the window size to 1000x600 until after the display mode has
// changed to 1024x768, because windows cannot be larger than the
// desktop.

RECT m_rcWindowBounds;
RECT DesktopRect;

GetClientRect(GetDesktopWindow(), &DesktopRect);

SetRect(&m_rcWindowBounds,
(DesktopRect.right - psCurrentVidMode[0]) / 2,
(DesktopRect.bottom - psCurrentVidMode[1]) / 2,
(DesktopRect.right + psCurrentVidMode[0]) / 2,
(DesktopRect.bottom + psCurrentVidMode[1]) / 2);

AdjustWindowRect(&m_rcWindowBounds, dwWindowStyle, FALSE);

SetWindowPos(m_hWnd, HWND_NOTOPMOST, m_rcWindowBounds.left, m_rcWindowBounds.top,
(m_rcWindowBounds.right - m_rcWindowBounds.left),
(m_rcWindowBounds.bottom - m_rcWindowBounds.top),
SWP_SHOWWINDOW | SWP_NOCOPYBITS | SWP_DRAWFRAME);
}
}
else
{
SetWindowLong(m_hWnd, GWL_STYLE, dwWindowStyle = (WS_POPUP | WS_VISIBLE));
}

ShowCursor(FALSE);
SetForegroundWindow(m_hWnd);
Expand Down
1 change: 0 additions & 1 deletion src/Layers/xrRenderPC_GL/gl_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ void CRender::level_Load(IReader* fs)
pApp->LoadEnd ();

// sanity-clear
lstLODs.clear ();
lstLODgroups.clear ();
mapLOD.clear ();

Expand Down
2 changes: 2 additions & 0 deletions src/utils/xrAI/StdAfx.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include "Common/Common.hpp"
#include "xrCore/xrCore.h"

#include <memory>

#include <d3dx9.h>
#include "Common/_d3d_extensions.h"

Expand Down
1 change: 1 addition & 0 deletions src/utils/xrAI/game_graph_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "stdafx.h"
#include "game_graph_builder.h"
#include "xrServerEntities/xrServer_Objects_ALife.h"
#include "xrServerEntities/xrMessages.h"
#include "factory_api.h"
#include "guid_generator.h"

Expand Down
1 change: 1 addition & 0 deletions src/utils/xrAI/level_spawn_constructor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "level_spawn_constructor.h"
#include "xrServerEntities/restriction_space.h"
#include "xrServerEntities/clsid_game.h"
#include "xrServerEntities/xrMessages.h"
#include "factory_api.h"

#define IGNORE_ZERO_SPAWN_POSITIONS
Expand Down
3 changes: 3 additions & 0 deletions src/xrCore/xrstring.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#pragma once

#include <cstdio>

#include "_types.h"
#include "xrCommon/inlining_macros.h"
#include "xrMemory.h"

#define BREAK_AT_STRCMP
#ifndef DEBUG
Expand Down

0 comments on commit 3dd786b

Please sign in to comment.