mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-17 23:31:45 +00:00
Adding SDL_GetWindowSizeInPixels for window size in pixels (#6112)
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
Reference in New Issue
Block a user