mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-23 14:53:52 +00:00
Center windows when over max resolution
This commit is contained in:
@@ -11,7 +11,9 @@
|
||||
#include "Externs.h"
|
||||
#include "Environ.h"
|
||||
#include "FontFamily.h"
|
||||
#include "HostDisplayDriver.h"
|
||||
#include "House.h"
|
||||
#include "IGpDisplayDriver.h"
|
||||
#include "InputManager.h"
|
||||
#include "MenuManager.h"
|
||||
#include "QDPixMap.h"
|
||||
@@ -181,6 +183,8 @@ void OpenMainWindow (void)
|
||||
|
||||
if (theMode == kEditMode)
|
||||
{
|
||||
PortabilityLayer::HostDisplayDriver::GetInstance()->SetBackgroundColor(51, 51, 102, 255);
|
||||
|
||||
QSetRect(&mainWindowRect, 0, 0, 512, 322);
|
||||
mainWindow = GetNewCWindow(kEditWindowID, nil, kPutInFront);
|
||||
SizeWindow(mainWindow, mainWindowRect.right,
|
||||
@@ -206,6 +210,12 @@ void OpenMainWindow (void)
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef NDEBUG
|
||||
PortabilityLayer::HostDisplayDriver::GetInstance()->SetBackgroundColor(0, 0, 0, 255);
|
||||
#else
|
||||
PortabilityLayer::HostDisplayDriver::GetInstance()->SetBackgroundColor(51, 0, 0, 255);
|
||||
#endif
|
||||
|
||||
if (boardWindow == nil)
|
||||
{
|
||||
PortabilityLayer::WindowManager *windowManager = PortabilityLayer::WindowManager::GetInstance();
|
||||
@@ -222,12 +232,16 @@ void OpenMainWindow (void)
|
||||
}
|
||||
mainWindowRect = thisMac.constrainedScreen;
|
||||
ZeroRectCorner(&mainWindowRect);
|
||||
mainWindowRect.bottom -= 20; // thisMac.menuHigh
|
||||
mainWindowRect.bottom -= kScoreboardTall; // thisMac.menuHigh
|
||||
mainWindow = GetNewCWindow(kMainWindowID, nil, kPutInFront);
|
||||
SizeWindow(mainWindow, mainWindowRect.right - mainWindowRect.left,
|
||||
mainWindowRect.bottom - mainWindowRect.top, false);
|
||||
MoveWindow(mainWindow, thisMac.constrainedScreen.left,
|
||||
thisMac.constrainedScreen.top + 20, true); // thisMac.menuHigh
|
||||
|
||||
const short mainWindowLeft = (thisMac.fullScreen.left + thisMac.fullScreen.right + thisMac.constrainedScreen.left - thisMac.constrainedScreen.right) / 2;
|
||||
const short mainWindowTop = (thisMac.fullScreen.top + thisMac.fullScreen.bottom + thisMac.constrainedScreen.top - thisMac.constrainedScreen.bottom) / 2 + kScoreboardTall;
|
||||
|
||||
MoveWindow(boardWindow, mainWindowLeft, 0, true);
|
||||
MoveWindow(mainWindow, mainWindowLeft, mainWindowTop, true); // thisMac.menuHigh
|
||||
ShowWindow(mainWindow);
|
||||
SetPortWindowPort(mainWindow);
|
||||
|
||||
@@ -247,7 +261,6 @@ void OpenMainWindow (void)
|
||||
splashOriginV = 0;
|
||||
|
||||
workSrcMap->FillRect(workSrcRect);
|
||||
LoadGraphic(workSrcMap, kSplash8BitPICT);
|
||||
|
||||
// if ((fadeGraysOut) && (isDoColorFade))
|
||||
// {
|
||||
@@ -260,6 +273,7 @@ void OpenMainWindow (void)
|
||||
// }
|
||||
|
||||
SetPortWindowPort(mainWindow);
|
||||
UpdateMainWindow();
|
||||
}
|
||||
|
||||
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
|
||||
|
@@ -23,4 +23,6 @@ public:
|
||||
virtual void SetStandardCursor(EGpStandardCursor_t standardCursor) = 0;
|
||||
|
||||
virtual void UpdatePalette(const void *paletteData) = 0;
|
||||
|
||||
virtual void SetBackgroundColor(uint8_t r, uint8_t g, uint8_t b, uint8_t a) = 0;
|
||||
};
|
||||
|
@@ -399,9 +399,7 @@ GpDisplayDriverTickStatus_t GpDisplayDriverD3D11::PresentFrameAndSync()
|
||||
{
|
||||
SynchronizeCursors();
|
||||
|
||||
float clearColor[4] = { 0.2f, 0.2f, 0.4f, 1.0f };
|
||||
|
||||
m_deviceContext->ClearRenderTargetView(m_backBufferRTV, clearColor);
|
||||
m_deviceContext->ClearRenderTargetView(m_backBufferRTV, m_bgColor);
|
||||
|
||||
ID3D11RenderTargetView *const rtv = m_backBufferRTV;
|
||||
m_deviceContext->OMSetRenderTargets(1, &rtv, nullptr);
|
||||
@@ -894,6 +892,13 @@ void GpDisplayDriverD3D11::UpdatePalette(const void *paletteData)
|
||||
m_deviceContext->Unmap(m_paletteTexture, 0);
|
||||
}
|
||||
}
|
||||
void GpDisplayDriverD3D11::SetBackgroundColor(uint8_t r, uint8_t g, uint8_t b, uint8_t a)
|
||||
{
|
||||
m_bgColor[0] = static_cast<float>(r) / 255.0f;
|
||||
m_bgColor[1] = static_cast<float>(g) / 255.0f;
|
||||
m_bgColor[2] = static_cast<float>(b) / 255.0f;
|
||||
m_bgColor[3] = static_cast<float>(a) / 255.0f;
|
||||
}
|
||||
|
||||
GpDisplayDriverD3D11 *GpDisplayDriverD3D11::Create(const GpDisplayDriverProperties &properties)
|
||||
{
|
||||
@@ -926,6 +931,11 @@ GpDisplayDriverD3D11::GpDisplayDriverD3D11(const GpDisplayDriverProperties &prop
|
||||
m_arrowCursor = reinterpret_cast<HCURSOR>(LoadImageW(nullptr, MAKEINTRESOURCEW(OCR_NORMAL), IMAGE_CURSOR, 0, 0, LR_SHARED));
|
||||
m_ibeamCursor = reinterpret_cast<HCURSOR>(LoadImageW(nullptr, MAKEINTRESOURCEW(OCR_IBEAM), IMAGE_CURSOR, 0, 0, LR_SHARED));
|
||||
m_waitCursor = reinterpret_cast<HCURSOR>(LoadImageW(nullptr, MAKEINTRESOURCEW(OCR_WAIT), IMAGE_CURSOR, 0, 0, LR_SHARED));
|
||||
|
||||
m_bgColor[0] = 0;
|
||||
m_bgColor[1] = 0;
|
||||
m_bgColor[2] = 0;
|
||||
m_bgColor[3] = 255;
|
||||
}
|
||||
|
||||
GpDisplayDriverD3D11::~GpDisplayDriverD3D11()
|
||||
|
@@ -46,6 +46,8 @@ public:
|
||||
|
||||
void UpdatePalette(const void *paletteData) override;
|
||||
|
||||
void SetBackgroundColor(uint8_t r, uint8_t g, uint8_t b, uint8_t a) override;
|
||||
|
||||
static GpDisplayDriverD3D11 *Create(const GpDisplayDriverProperties &properties);
|
||||
|
||||
private:
|
||||
@@ -125,4 +127,6 @@ private:
|
||||
HCURSOR m_waitCursor;
|
||||
HCURSOR m_ibeamCursor;
|
||||
HWND m_hwnd;
|
||||
|
||||
float m_bgColor[4];
|
||||
};
|
||||
|
Reference in New Issue
Block a user