|
|
@@ -405,7 +405,7 @@ static gameplay::Keyboard::Key getKey(WPARAM win32KeyCode, bool shiftDown)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void UpdateCapture(LPARAM lParam)
|
|
|
+static void UpdateCapture(LPARAM lParam)
|
|
|
{
|
|
|
if ((lParam & MK_LBUTTON) || (lParam & MK_MBUTTON) || (lParam & MK_RBUTTON))
|
|
|
SetCapture(__hwnd);
|
|
|
@@ -413,13 +413,27 @@ void UpdateCapture(LPARAM lParam)
|
|
|
ReleaseCapture();
|
|
|
}
|
|
|
|
|
|
-void WarpMouse(int clientX, int clientY)
|
|
|
+static void WarpMouse(int clientX, int clientY)
|
|
|
{
|
|
|
POINT p = { clientX, clientY };
|
|
|
ClientToScreen(__hwnd, &p);
|
|
|
SetCursorPos(p.x, p.y);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+/**
|
|
|
+ * Gets the width and height of the screen in pixels.
|
|
|
+ */
|
|
|
+static void getDesktopResolution(int& width, int& height)
|
|
|
+{
|
|
|
+ RECT desktop;
|
|
|
+ const HWND hDesktop = GetDesktopWindow();
|
|
|
+ // Get the size of screen to the variable desktop
|
|
|
+ GetWindowRect(hDesktop, &desktop);
|
|
|
+ width = desktop.right;
|
|
|
+ height = desktop.bottom;
|
|
|
+}
|
|
|
+
|
|
|
LRESULT CALLBACK __WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|
|
{
|
|
|
static gameplay::Game* game = gameplay::Game::getInstance();
|
|
|
@@ -872,6 +886,11 @@ Platform* Platform::create(Game* game, void* attachToWindow)
|
|
|
SAFE_DELETE_ARRAY(wtitle);
|
|
|
}
|
|
|
|
|
|
+ // Read fullscreen state.
|
|
|
+ params.fullscreen = config->getBool("fullscreen");
|
|
|
+ // Read multisampling state.
|
|
|
+ params.samples = config->getInt("samples");
|
|
|
+
|
|
|
// Read window rect.
|
|
|
int x = config->getInt("x");
|
|
|
if (x != 0)
|
|
|
@@ -880,17 +899,15 @@ Platform* Platform::create(Game* game, void* attachToWindow)
|
|
|
if (y != 0)
|
|
|
params.rect.top = y;
|
|
|
int width = config->getInt("width");
|
|
|
+ int height = config->getInt("height");
|
|
|
+
|
|
|
+ if (width == 0 && height == 0 && params.fullscreen)
|
|
|
+ getDesktopResolution(width, height);
|
|
|
+
|
|
|
if (width != 0)
|
|
|
params.rect.right = params.rect.left + width;
|
|
|
- int height = config->getInt("height");
|
|
|
if (height != 0)
|
|
|
params.rect.bottom = params.rect.top + height;
|
|
|
-
|
|
|
- // Read fullscreen state.
|
|
|
- params.fullscreen = config->getBool("fullscreen");
|
|
|
-
|
|
|
- // Read multisampling state.
|
|
|
- params.samples = config->getInt("samples");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -961,9 +978,9 @@ Platform* Platform::create(Game* game, void* attachToWindow)
|
|
|
DEVMODE dm;
|
|
|
memset(&dm, 0, sizeof(dm));
|
|
|
dm.dmSize= sizeof(dm);
|
|
|
- dm.dmPelsWidth = width;
|
|
|
- dm.dmPelsHeight = height;
|
|
|
- dm.dmBitsPerPel = DEFAULT_COLOR_BUFFER_SIZE;
|
|
|
+ dm.dmPelsWidth = width;
|
|
|
+ dm.dmPelsHeight = height;
|
|
|
+ dm.dmBitsPerPel = DEFAULT_COLOR_BUFFER_SIZE;
|
|
|
dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
|
|
|
|
|
|
// Try to set selected mode and get results. NOTE: CDS_FULLSCREEN gets rid of start bar.
|