Adding SDL_GetWindowSizeInPixels for window size in pixels (#6112)

This commit is contained in:
Noel Berry
2022-08-24 11:25:13 -07:00
committed by GitHub
parent 70c781c803
commit 00452e47fa
32 changed files with 122 additions and 142 deletions

View File

@@ -773,6 +773,22 @@ WIN_GetWindowBordersSize(_THIS, SDL_Window * window, int *top, int *left, int *b
#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/
}
void
WIN_GetWindowSizeInPixels(_THIS, SDL_Window * window, int *w, int *h)
{
const SDL_WindowData *data = ((SDL_WindowData *)window->driverdata);
HWND hwnd = data->hwnd;
RECT rect;
if (GetClientRect(hwnd, &rect)) {
*w = rect.right;
*h = rect.bottom;
} else {
*w = 0;
*h = 0;
}
}
void
WIN_ShowWindow(_THIS, SDL_Window * window)
{
@@ -1402,25 +1418,6 @@ WIN_SetWindowOpacity(_THIS, SDL_Window * window, float opacity)
#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/
}
/**
* Returns the drawable size in pixels (GetClientRect).
*/
void
WIN_GetDrawableSize(const SDL_Window *window, int *w, int *h)
{
const SDL_WindowData *data = ((SDL_WindowData *)window->driverdata);
HWND hwnd = data->hwnd;
RECT rect;
if (GetClientRect(hwnd, &rect)) {
*w = rect.right;
*h = rect.bottom;
} else {
*w = 0;
*h = 0;
}
}
/**
* Convert a point in the client area from pixels to DPI-scaled points.
*