mirror of https://github.com/encounter/SDL.git
Adding SDL_GetWindowSizeInPixels for window size in pixels (#6112)
This commit is contained in:
parent
70c781c803
commit
00452e47fa
|
@ -1046,6 +1046,27 @@ extern DECLSPEC int SDLCALL SDL_GetWindowBordersSize(SDL_Window * window,
|
||||||
int *top, int *left,
|
int *top, int *left,
|
||||||
int *bottom, int *right);
|
int *bottom, int *right);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the size of a window in pixels.
|
||||||
|
*
|
||||||
|
* This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI
|
||||||
|
* drawable, i.e. the window was created with `SDL_WINDOW_ALLOW_HIGHDPI` on a
|
||||||
|
* platform with high-DPI support (Apple calls this "Retina"), and not
|
||||||
|
* disabled by the `SDL_HINT_VIDEO_HIGHDPI_DISABLED` hint.
|
||||||
|
*
|
||||||
|
* \param window the window from which the drawable size should be queried
|
||||||
|
* \param w a pointer to variable for storing the width in pixels, may be NULL
|
||||||
|
* \param h a pointer to variable for storing the height in pixels, may be
|
||||||
|
* NULL
|
||||||
|
*
|
||||||
|
* \since This function is available since SDL 2.26.0.
|
||||||
|
*
|
||||||
|
* \sa SDL_CreateWindow
|
||||||
|
* \sa SDL_GetWindowSize
|
||||||
|
*/
|
||||||
|
extern DECLSPEC void SDLCALL SDL_GetWindowSizeInPixels(SDL_Window * window,
|
||||||
|
int *w, int *h);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the minimum size of a window's client area.
|
* Set the minimum size of a window's client area.
|
||||||
*
|
*
|
||||||
|
|
|
@ -858,3 +858,4 @@
|
||||||
++'_SDL_GetRectDisplayIndex'.'SDL2.dll'.'SDL_GetRectDisplayIndex'
|
++'_SDL_GetRectDisplayIndex'.'SDL2.dll'.'SDL_GetRectDisplayIndex'
|
||||||
++'_SDL_ResetHint'.'SDL2.dll'.'SDL_ResetHint'
|
++'_SDL_ResetHint'.'SDL2.dll'.'SDL_ResetHint'
|
||||||
++'_SDL_crc16'.'SDL2.dll'.'SDL_crc16'
|
++'_SDL_crc16'.'SDL2.dll'.'SDL_crc16'
|
||||||
|
++'_SDL_GetWindowSizeInPixels'.'SDL2.dll'.'SDL_GetWindowSizeInPixels'
|
||||||
|
|
|
@ -884,3 +884,4 @@
|
||||||
#define SDL_GetRectDisplayIndex SDL_GetRectDisplayIndex_REAL
|
#define SDL_GetRectDisplayIndex SDL_GetRectDisplayIndex_REAL
|
||||||
#define SDL_ResetHint SDL_ResetHint_REAL
|
#define SDL_ResetHint SDL_ResetHint_REAL
|
||||||
#define SDL_crc16 SDL_crc16_REAL
|
#define SDL_crc16 SDL_crc16_REAL
|
||||||
|
#define SDL_GetWindowSizeInPixels SDL_GetWindowSizeInPixels_REAL
|
||||||
|
|
|
@ -967,3 +967,4 @@ SDL_DYNAPI_PROC(int,SDL_GetPointDisplayIndex,(const SDL_Point *a),(a),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetRectDisplayIndex,(const SDL_Rect *a),(a),return)
|
SDL_DYNAPI_PROC(int,SDL_GetRectDisplayIndex,(const SDL_Rect *a),(a),return)
|
||||||
SDL_DYNAPI_PROC(SDL_bool,SDL_ResetHint,(const char *a),(a),return)
|
SDL_DYNAPI_PROC(SDL_bool,SDL_ResetHint,(const char *a),(a),return)
|
||||||
SDL_DYNAPI_PROC(Uint16,SDL_crc16,(Uint16 a, const void *b, size_t c),(a,b,c),return)
|
SDL_DYNAPI_PROC(Uint16,SDL_crc16,(Uint16 a, const void *b, size_t c),(a,b,c),return)
|
||||||
|
SDL_DYNAPI_PROC(void,SDL_GetWindowSizeInPixels,(SDL_Window *a, int *b, int *c),(a,b,c),)
|
||||||
|
|
|
@ -308,7 +308,7 @@ D3D_ActivateRenderer(SDL_Renderer * renderer)
|
||||||
int w, h;
|
int w, h;
|
||||||
Uint32 window_flags = SDL_GetWindowFlags(window);
|
Uint32 window_flags = SDL_GetWindowFlags(window);
|
||||||
|
|
||||||
WIN_GetDrawableSize(window, &w, &h);
|
SDL_GetWindowSizeInPixels(window, &w, &h);
|
||||||
data->pparams.BackBufferWidth = w;
|
data->pparams.BackBufferWidth = w;
|
||||||
data->pparams.BackBufferHeight = h;
|
data->pparams.BackBufferHeight = h;
|
||||||
if (window_flags & SDL_WINDOW_FULLSCREEN && (window_flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP) {
|
if (window_flags & SDL_WINDOW_FULLSCREEN && (window_flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP) {
|
||||||
|
@ -357,7 +357,7 @@ D3D_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
|
||||||
static int
|
static int
|
||||||
D3D_GetOutputSize(SDL_Renderer * renderer, int *w, int *h)
|
D3D_GetOutputSize(SDL_Renderer * renderer, int *w, int *h)
|
||||||
{
|
{
|
||||||
WIN_GetDrawableSize(renderer->window, w, h);
|
SDL_GetWindowSizeInPixels(renderer->window, w, h);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1653,7 +1653,7 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags)
|
||||||
SDL_GetWindowWMInfo(window, &windowinfo);
|
SDL_GetWindowWMInfo(window, &windowinfo);
|
||||||
|
|
||||||
window_flags = SDL_GetWindowFlags(window);
|
window_flags = SDL_GetWindowFlags(window);
|
||||||
WIN_GetDrawableSize(window, &w, &h);
|
SDL_GetWindowSizeInPixels(window, &w, &h);
|
||||||
SDL_GetWindowDisplayMode(window, &fullscreen_mode);
|
SDL_GetWindowDisplayMode(window, &fullscreen_mode);
|
||||||
|
|
||||||
SDL_zero(pparams);
|
SDL_zero(pparams);
|
||||||
|
|
|
@ -916,7 +916,7 @@ D3D11_CreateWindowSizeDependentResources(SDL_Renderer * renderer)
|
||||||
#if defined(__WINRT__)
|
#if defined(__WINRT__)
|
||||||
SDL_GetWindowSize(renderer->window, &w, &h);
|
SDL_GetWindowSize(renderer->window, &w, &h);
|
||||||
#else
|
#else
|
||||||
WIN_GetDrawableSize(renderer->window, &w, &h);
|
SDL_GetWindowSizeInPixels(renderer->window, &w, &h);
|
||||||
#endif
|
#endif
|
||||||
data->rotation = D3D11_GetCurrentRotation();
|
data->rotation = D3D11_GetCurrentRotation();
|
||||||
/* SDL_Log("%s: windowSize={%d,%d}, orientation=%d\n", __FUNCTION__, w, h, (int)data->rotation); */
|
/* SDL_Log("%s: windowSize={%d,%d}, orientation=%d\n", __FUNCTION__, w, h, (int)data->rotation); */
|
||||||
|
@ -1062,7 +1062,7 @@ D3D11_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
|
||||||
static int
|
static int
|
||||||
D3D11_GetOutputSize(SDL_Renderer * renderer, int *w, int *h)
|
D3D11_GetOutputSize(SDL_Renderer * renderer, int *w, int *h)
|
||||||
{
|
{
|
||||||
WIN_GetDrawableSize(renderer->window, w, h);
|
SDL_GetWindowSizeInPixels(renderer->window, w, h);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -513,7 +513,7 @@ D3D12_DestroyRenderer(SDL_Renderer * renderer)
|
||||||
static int
|
static int
|
||||||
D3D12_GetOutputSize(SDL_Renderer *renderer, int *w, int *h)
|
D3D12_GetOutputSize(SDL_Renderer *renderer, int *w, int *h)
|
||||||
{
|
{
|
||||||
WIN_GetDrawableSize(renderer->window, w, h);
|
SDL_GetWindowSizeInPixels(renderer->window, w, h);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1267,7 +1267,7 @@ D3D12_CreateWindowSizeDependentResources(SDL_Renderer * renderer)
|
||||||
/* The width and height of the swap chain must be based on the display's
|
/* The width and height of the swap chain must be based on the display's
|
||||||
* non-rotated size.
|
* non-rotated size.
|
||||||
*/
|
*/
|
||||||
WIN_GetDrawableSize(renderer->window, &w, &h);
|
SDL_GetWindowSizeInPixels(renderer->window, &w, &h);
|
||||||
data->rotation = D3D12_GetCurrentRotation();
|
data->rotation = D3D12_GetCurrentRotation();
|
||||||
if (D3D12_IsDisplayRotated90Degrees(data->rotation)) {
|
if (D3D12_IsDisplayRotated90Degrees(data->rotation)) {
|
||||||
int tmp = w;
|
int tmp = w;
|
||||||
|
|
|
@ -227,6 +227,7 @@ struct SDL_VideoDevice
|
||||||
void (*SetWindowMinimumSize) (_THIS, SDL_Window * window);
|
void (*SetWindowMinimumSize) (_THIS, SDL_Window * window);
|
||||||
void (*SetWindowMaximumSize) (_THIS, SDL_Window * window);
|
void (*SetWindowMaximumSize) (_THIS, SDL_Window * window);
|
||||||
int (*GetWindowBordersSize) (_THIS, SDL_Window * window, int *top, int *left, int *bottom, int *right);
|
int (*GetWindowBordersSize) (_THIS, SDL_Window * window, int *top, int *left, int *bottom, int *right);
|
||||||
|
void (*GetWindowSizeInPixels)(_THIS, SDL_Window *window, int *w, int *h);
|
||||||
int (*SetWindowOpacity) (_THIS, SDL_Window * window, float opacity);
|
int (*SetWindowOpacity) (_THIS, SDL_Window * window, float opacity);
|
||||||
int (*SetWindowModalFor) (_THIS, SDL_Window * modal_window, SDL_Window * parent_window);
|
int (*SetWindowModalFor) (_THIS, SDL_Window * modal_window, SDL_Window * parent_window);
|
||||||
int (*SetWindowInputFocus) (_THIS, SDL_Window * window);
|
int (*SetWindowInputFocus) (_THIS, SDL_Window * window);
|
||||||
|
|
|
@ -2366,6 +2366,28 @@ SDL_GetWindowBordersSize(SDL_Window * window, int *top, int *left, int *bottom,
|
||||||
return _this->GetWindowBordersSize(_this, window, top, left, bottom, right);
|
return _this->GetWindowBordersSize(_this, window, top, left, bottom, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SDL_GetWindowSizeInPixels(SDL_Window *window, int *w, int *h)
|
||||||
|
{
|
||||||
|
int filter;
|
||||||
|
|
||||||
|
CHECK_WINDOW_MAGIC(window,);
|
||||||
|
|
||||||
|
if (w == NULL) {
|
||||||
|
w = &filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (h == NULL) {
|
||||||
|
h = &filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_this->GetWindowSizeInPixels) {
|
||||||
|
_this->GetWindowSizeInPixels(_this, window, w, h);
|
||||||
|
} else {
|
||||||
|
SDL_GetWindowSize(window, w, h);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SDL_SetWindowMinimumSize(SDL_Window * window, int min_w, int min_h)
|
SDL_SetWindowMinimumSize(SDL_Window * window, int min_w, int min_h)
|
||||||
{
|
{
|
||||||
|
@ -4096,7 +4118,7 @@ void SDL_GL_GetDrawableSize(SDL_Window * window, int *w, int *h)
|
||||||
if (_this->GL_GetDrawableSize) {
|
if (_this->GL_GetDrawableSize) {
|
||||||
_this->GL_GetDrawableSize(_this, window, w, h);
|
_this->GL_GetDrawableSize(_this, window, w, h);
|
||||||
} else {
|
} else {
|
||||||
SDL_GetWindowSize(window, w, h);
|
SDL_GetWindowSizeInPixels(window, w, h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4791,7 +4813,7 @@ void SDL_Vulkan_GetDrawableSize(SDL_Window * window, int *w, int *h)
|
||||||
if (_this->Vulkan_GetDrawableSize) {
|
if (_this->Vulkan_GetDrawableSize) {
|
||||||
_this->Vulkan_GetDrawableSize(_this, window, w, h);
|
_this->Vulkan_GetDrawableSize(_this, window, w, h);
|
||||||
} else {
|
} else {
|
||||||
SDL_GetWindowSize(window, w, h);
|
SDL_GetWindowSizeInPixels(window, w, h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4844,7 +4866,7 @@ void SDL_Metal_GetDrawableSize(SDL_Window * window, int *w, int *h)
|
||||||
if (_this->Metal_GetDrawableSize) {
|
if (_this->Metal_GetDrawableSize) {
|
||||||
_this->Metal_GetDrawableSize(_this, window, w, h);
|
_this->Metal_GetDrawableSize(_this, window, w, h);
|
||||||
} else {
|
} else {
|
||||||
SDL_GetWindowSize(window, w, h);
|
SDL_GetWindowSizeInPixels(window, w, h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -185,17 +185,7 @@ Cocoa_Metal_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Fall back to the viewport size. */
|
/* Fall back to the viewport size. */
|
||||||
NSRect viewport = [contentView bounds];
|
SDL_GetWindowSizeInPixels(window, w, h);
|
||||||
if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
|
|
||||||
/* This gives us the correct viewport for a Retina-enabled view. */
|
|
||||||
viewport = [contentView convertRectToBacking:viewport];
|
|
||||||
}
|
|
||||||
if (w) {
|
|
||||||
*w = viewport.size.width;
|
|
||||||
}
|
|
||||||
if (h) {
|
|
||||||
*h = viewport.size.height;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
|
|
@ -61,8 +61,6 @@ extern void Cocoa_GL_UnloadLibrary(_THIS);
|
||||||
extern SDL_GLContext Cocoa_GL_CreateContext(_THIS, SDL_Window * window);
|
extern SDL_GLContext Cocoa_GL_CreateContext(_THIS, SDL_Window * window);
|
||||||
extern int Cocoa_GL_MakeCurrent(_THIS, SDL_Window * window,
|
extern int Cocoa_GL_MakeCurrent(_THIS, SDL_Window * window,
|
||||||
SDL_GLContext context);
|
SDL_GLContext context);
|
||||||
extern void Cocoa_GL_GetDrawableSize(_THIS, SDL_Window * window,
|
|
||||||
int * w, int * h);
|
|
||||||
extern int Cocoa_GL_SetSwapInterval(_THIS, int interval);
|
extern int Cocoa_GL_SetSwapInterval(_THIS, int interval);
|
||||||
extern int Cocoa_GL_GetSwapInterval(_THIS);
|
extern int Cocoa_GL_GetSwapInterval(_THIS);
|
||||||
extern int Cocoa_GL_SwapWindow(_THIS, SDL_Window * window);
|
extern int Cocoa_GL_SwapWindow(_THIS, SDL_Window * window);
|
||||||
|
|
|
@ -385,28 +385,6 @@ Cocoa_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
|
||||||
return 0;
|
return 0;
|
||||||
}}
|
}}
|
||||||
|
|
||||||
void
|
|
||||||
Cocoa_GL_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h)
|
|
||||||
{ @autoreleasepool
|
|
||||||
{
|
|
||||||
SDL_WindowData *windata = (__bridge SDL_WindowData *) window->driverdata;
|
|
||||||
NSView *contentView = windata.sdlContentView;
|
|
||||||
NSRect viewport = [contentView bounds];
|
|
||||||
|
|
||||||
if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
|
|
||||||
/* This gives us the correct viewport for a Retina-enabled view. */
|
|
||||||
viewport = [contentView convertRectToBacking:viewport];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (w) {
|
|
||||||
*w = viewport.size.width;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (h) {
|
|
||||||
*h = viewport.size.height;
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
Cocoa_GL_SetSwapInterval(_THIS, int interval)
|
Cocoa_GL_SetSwapInterval(_THIS, int interval)
|
||||||
{ @autoreleasepool
|
{ @autoreleasepool
|
||||||
|
|
|
@ -100,6 +100,7 @@ Cocoa_CreateDevice(void)
|
||||||
device->SetWindowMinimumSize = Cocoa_SetWindowMinimumSize;
|
device->SetWindowMinimumSize = Cocoa_SetWindowMinimumSize;
|
||||||
device->SetWindowMaximumSize = Cocoa_SetWindowMaximumSize;
|
device->SetWindowMaximumSize = Cocoa_SetWindowMaximumSize;
|
||||||
device->SetWindowOpacity = Cocoa_SetWindowOpacity;
|
device->SetWindowOpacity = Cocoa_SetWindowOpacity;
|
||||||
|
device->GetWindowSizeInPixels = Cocoa_GetWindowSizeInPixels;
|
||||||
device->ShowWindow = Cocoa_ShowWindow;
|
device->ShowWindow = Cocoa_ShowWindow;
|
||||||
device->HideWindow = Cocoa_HideWindow;
|
device->HideWindow = Cocoa_HideWindow;
|
||||||
device->RaiseWindow = Cocoa_RaiseWindow;
|
device->RaiseWindow = Cocoa_RaiseWindow;
|
||||||
|
@ -133,7 +134,6 @@ Cocoa_CreateDevice(void)
|
||||||
device->GL_UnloadLibrary = Cocoa_GL_UnloadLibrary;
|
device->GL_UnloadLibrary = Cocoa_GL_UnloadLibrary;
|
||||||
device->GL_CreateContext = Cocoa_GL_CreateContext;
|
device->GL_CreateContext = Cocoa_GL_CreateContext;
|
||||||
device->GL_MakeCurrent = Cocoa_GL_MakeCurrent;
|
device->GL_MakeCurrent = Cocoa_GL_MakeCurrent;
|
||||||
device->GL_GetDrawableSize = Cocoa_GL_GetDrawableSize;
|
|
||||||
device->GL_SetSwapInterval = Cocoa_GL_SetSwapInterval;
|
device->GL_SetSwapInterval = Cocoa_GL_SetSwapInterval;
|
||||||
device->GL_GetSwapInterval = Cocoa_GL_GetSwapInterval;
|
device->GL_GetSwapInterval = Cocoa_GL_GetSwapInterval;
|
||||||
device->GL_SwapWindow = Cocoa_GL_SwapWindow;
|
device->GL_SwapWindow = Cocoa_GL_SwapWindow;
|
||||||
|
|
|
@ -145,6 +145,7 @@ extern void Cocoa_SetWindowPosition(_THIS, SDL_Window * window);
|
||||||
extern void Cocoa_SetWindowSize(_THIS, SDL_Window * window);
|
extern void Cocoa_SetWindowSize(_THIS, SDL_Window * window);
|
||||||
extern void Cocoa_SetWindowMinimumSize(_THIS, SDL_Window * window);
|
extern void Cocoa_SetWindowMinimumSize(_THIS, SDL_Window * window);
|
||||||
extern void Cocoa_SetWindowMaximumSize(_THIS, SDL_Window * window);
|
extern void Cocoa_SetWindowMaximumSize(_THIS, SDL_Window * window);
|
||||||
|
extern void Cocoa_GetWindowSizeInPixels(_THIS, SDL_Window * window, int *w, int *h);
|
||||||
extern int Cocoa_SetWindowOpacity(_THIS, SDL_Window * window, float opacity);
|
extern int Cocoa_SetWindowOpacity(_THIS, SDL_Window * window, float opacity);
|
||||||
extern void Cocoa_ShowWindow(_THIS, SDL_Window * window);
|
extern void Cocoa_ShowWindow(_THIS, SDL_Window * window);
|
||||||
extern void Cocoa_HideWindow(_THIS, SDL_Window * window);
|
extern void Cocoa_HideWindow(_THIS, SDL_Window * window);
|
||||||
|
|
|
@ -1941,6 +1941,24 @@ Cocoa_SetWindowMaximumSize(_THIS, SDL_Window * window)
|
||||||
[windata.nswindow setContentMaxSize:maxSize];
|
[windata.nswindow setContentMaxSize:maxSize];
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
void
|
||||||
|
Cocoa_GetWindowSizeInPixels(_THIS, SDL_Window * window, int *w, int *h)
|
||||||
|
{ @autoreleasepool
|
||||||
|
{
|
||||||
|
SDL_WindowData *windata = (__bridge SDL_WindowData *) window->driverdata;
|
||||||
|
NSView *contentView = windata.sdlContentView;
|
||||||
|
NSRect viewport = [contentView bounds];
|
||||||
|
|
||||||
|
if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
|
||||||
|
/* This gives us the correct viewport for a Retina-enabled view. */
|
||||||
|
viewport = [contentView convertRectToBacking:viewport];
|
||||||
|
}
|
||||||
|
|
||||||
|
*w = viewport.size.width;
|
||||||
|
*h = viewport.size.height;
|
||||||
|
}}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Cocoa_ShowWindow(_THIS, SDL_Window * window)
|
Cocoa_ShowWindow(_THIS, SDL_Window * window)
|
||||||
{ @autoreleasepool
|
{ @autoreleasepool
|
||||||
|
|
|
@ -96,23 +96,6 @@ Emscripten_GLES_SwapWindow(_THIS, SDL_Window * window)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
Emscripten_GLES_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h)
|
|
||||||
{
|
|
||||||
SDL_WindowData *data;
|
|
||||||
if (window->driverdata) {
|
|
||||||
data = (SDL_WindowData *) window->driverdata;
|
|
||||||
|
|
||||||
if (w) {
|
|
||||||
*w = window->w * data->pixel_ratio;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (h) {
|
|
||||||
*h = window->h * data->pixel_ratio;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* SDL_VIDEO_DRIVER_EMSCRIPTEN && SDL_VIDEO_OPENGL_EGL */
|
#endif /* SDL_VIDEO_DRIVER_EMSCRIPTEN && SDL_VIDEO_OPENGL_EGL */
|
||||||
|
|
||||||
/* vi: set ts=4 sw=4 expandtab: */
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
|
|
|
@ -40,7 +40,6 @@ extern int Emscripten_GLES_LoadLibrary(_THIS, const char *path);
|
||||||
extern SDL_GLContext Emscripten_GLES_CreateContext(_THIS, SDL_Window * window);
|
extern SDL_GLContext Emscripten_GLES_CreateContext(_THIS, SDL_Window * window);
|
||||||
extern int Emscripten_GLES_SwapWindow(_THIS, SDL_Window * window);
|
extern int Emscripten_GLES_SwapWindow(_THIS, SDL_Window * window);
|
||||||
extern int Emscripten_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
|
extern int Emscripten_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
|
||||||
extern void Emscripten_GLES_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h);
|
|
||||||
|
|
||||||
#endif /* SDL_VIDEO_DRIVER_EMSCRIPTEN && SDL_VIDEO_OPENGL_EGL */
|
#endif /* SDL_VIDEO_DRIVER_EMSCRIPTEN && SDL_VIDEO_OPENGL_EGL */
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,7 @@ static int Emscripten_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * d
|
||||||
|
|
||||||
static int Emscripten_CreateWindow(_THIS, SDL_Window * window);
|
static int Emscripten_CreateWindow(_THIS, SDL_Window * window);
|
||||||
static void Emscripten_SetWindowSize(_THIS, SDL_Window * window);
|
static void Emscripten_SetWindowSize(_THIS, SDL_Window * window);
|
||||||
|
static void Emscripten_GetWindowSizeInPixels(_THIS, SDL_Window * window, int *w, int *h);
|
||||||
static void Emscripten_DestroyWindow(_THIS, SDL_Window * window);
|
static void Emscripten_DestroyWindow(_THIS, SDL_Window * window);
|
||||||
static void Emscripten_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen);
|
static void Emscripten_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen);
|
||||||
static void Emscripten_PumpEvents(_THIS);
|
static void Emscripten_PumpEvents(_THIS);
|
||||||
|
@ -101,6 +102,7 @@ Emscripten_CreateDevice(void)
|
||||||
device->MinimizeWindow = Emscripten_MinimizeWindow;
|
device->MinimizeWindow = Emscripten_MinimizeWindow;
|
||||||
device->RestoreWindow = Emscripten_RestoreWindow;
|
device->RestoreWindow = Emscripten_RestoreWindow;
|
||||||
device->SetWindowMouseGrab = Emscripten_SetWindowMouseGrab;*/
|
device->SetWindowMouseGrab = Emscripten_SetWindowMouseGrab;*/
|
||||||
|
device->GetWindowSizeInPixels = Emscripten_GetWindowSizeInPixels;
|
||||||
device->DestroyWindow = Emscripten_DestroyWindow;
|
device->DestroyWindow = Emscripten_DestroyWindow;
|
||||||
device->SetWindowFullscreen = Emscripten_SetWindowFullscreen;
|
device->SetWindowFullscreen = Emscripten_SetWindowFullscreen;
|
||||||
|
|
||||||
|
@ -118,7 +120,6 @@ Emscripten_CreateDevice(void)
|
||||||
device->GL_GetSwapInterval = Emscripten_GLES_GetSwapInterval;
|
device->GL_GetSwapInterval = Emscripten_GLES_GetSwapInterval;
|
||||||
device->GL_SwapWindow = Emscripten_GLES_SwapWindow;
|
device->GL_SwapWindow = Emscripten_GLES_SwapWindow;
|
||||||
device->GL_DeleteContext = Emscripten_GLES_DeleteContext;
|
device->GL_DeleteContext = Emscripten_GLES_DeleteContext;
|
||||||
device->GL_GetDrawableSize = Emscripten_GLES_GetDrawableSize;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
device->free = Emscripten_DeleteDevice;
|
device->free = Emscripten_DeleteDevice;
|
||||||
|
@ -307,6 +308,18 @@ static void Emscripten_SetWindowSize(_THIS, SDL_Window * window)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
Emscripten_GetWindowSizeInPixels(_THIS, SDL_Window * window, int *w, int *h)
|
||||||
|
{
|
||||||
|
SDL_WindowData *data;
|
||||||
|
if (window->driverdata) {
|
||||||
|
data = (SDL_WindowData *) window->driverdata;
|
||||||
|
*w = window->w * data->pixel_ratio;
|
||||||
|
*h = window->h * data->pixel_ratio;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Emscripten_DestroyWindow(_THIS, SDL_Window * window)
|
Emscripten_DestroyWindow(_THIS, SDL_Window * window)
|
||||||
{
|
{
|
||||||
|
|
|
@ -197,23 +197,6 @@ Wayland_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
Wayland_GLES_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h)
|
|
||||||
{
|
|
||||||
SDL_WindowData *data;
|
|
||||||
if (window->driverdata) {
|
|
||||||
data = (SDL_WindowData *) window->driverdata;
|
|
||||||
|
|
||||||
if (w) {
|
|
||||||
*w = data->drawable_width;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (h) {
|
|
||||||
*h = data->drawable_height;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Wayland_GLES_DeleteContext(_THIS, SDL_GLContext context)
|
Wayland_GLES_DeleteContext(_THIS, SDL_GLContext context)
|
||||||
{
|
{
|
||||||
|
|
|
@ -42,7 +42,6 @@ extern int Wayland_GLES_SetSwapInterval(_THIS, int interval);
|
||||||
extern int Wayland_GLES_GetSwapInterval(_THIS);
|
extern int Wayland_GLES_GetSwapInterval(_THIS);
|
||||||
extern int Wayland_GLES_SwapWindow(_THIS, SDL_Window * window);
|
extern int Wayland_GLES_SwapWindow(_THIS, SDL_Window * window);
|
||||||
extern int Wayland_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
|
extern int Wayland_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
|
||||||
extern void Wayland_GLES_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h);
|
|
||||||
extern void Wayland_GLES_DeleteContext(_THIS, SDL_GLContext context);
|
extern void Wayland_GLES_DeleteContext(_THIS, SDL_GLContext context);
|
||||||
|
|
||||||
#endif /* SDL_waylandopengles_h_ */
|
#endif /* SDL_waylandopengles_h_ */
|
||||||
|
|
|
@ -230,7 +230,6 @@ Wayland_CreateDevice(void)
|
||||||
device->GL_SwapWindow = Wayland_GLES_SwapWindow;
|
device->GL_SwapWindow = Wayland_GLES_SwapWindow;
|
||||||
device->GL_GetSwapInterval = Wayland_GLES_GetSwapInterval;
|
device->GL_GetSwapInterval = Wayland_GLES_GetSwapInterval;
|
||||||
device->GL_SetSwapInterval = Wayland_GLES_SetSwapInterval;
|
device->GL_SetSwapInterval = Wayland_GLES_SetSwapInterval;
|
||||||
device->GL_GetDrawableSize = Wayland_GLES_GetDrawableSize;
|
|
||||||
device->GL_MakeCurrent = Wayland_GLES_MakeCurrent;
|
device->GL_MakeCurrent = Wayland_GLES_MakeCurrent;
|
||||||
device->GL_CreateContext = Wayland_GLES_CreateContext;
|
device->GL_CreateContext = Wayland_GLES_CreateContext;
|
||||||
device->GL_LoadLibrary = Wayland_GLES_LoadLibrary;
|
device->GL_LoadLibrary = Wayland_GLES_LoadLibrary;
|
||||||
|
@ -257,6 +256,7 @@ Wayland_CreateDevice(void)
|
||||||
device->SetWindowMaximumSize = Wayland_SetWindowMaximumSize;
|
device->SetWindowMaximumSize = Wayland_SetWindowMaximumSize;
|
||||||
device->SetWindowModalFor = Wayland_SetWindowModalFor;
|
device->SetWindowModalFor = Wayland_SetWindowModalFor;
|
||||||
device->SetWindowTitle = Wayland_SetWindowTitle;
|
device->SetWindowTitle = Wayland_SetWindowTitle;
|
||||||
|
device->GetWindowSizeInPixels = Wayland_GetWindowSizeInPixels;
|
||||||
device->DestroyWindow = Wayland_DestroyWindow;
|
device->DestroyWindow = Wayland_DestroyWindow;
|
||||||
device->SetWindowHitTest = Wayland_SetWindowHitTest;
|
device->SetWindowHitTest = Wayland_SetWindowHitTest;
|
||||||
device->FlashWindow = Wayland_FlashWindow;
|
device->FlashWindow = Wayland_FlashWindow;
|
||||||
|
@ -274,7 +274,6 @@ Wayland_CreateDevice(void)
|
||||||
device->Vulkan_UnloadLibrary = Wayland_Vulkan_UnloadLibrary;
|
device->Vulkan_UnloadLibrary = Wayland_Vulkan_UnloadLibrary;
|
||||||
device->Vulkan_GetInstanceExtensions = Wayland_Vulkan_GetInstanceExtensions;
|
device->Vulkan_GetInstanceExtensions = Wayland_Vulkan_GetInstanceExtensions;
|
||||||
device->Vulkan_CreateSurface = Wayland_Vulkan_CreateSurface;
|
device->Vulkan_CreateSurface = Wayland_Vulkan_CreateSurface;
|
||||||
device->Vulkan_GetDrawableSize = Wayland_Vulkan_GetDrawableSize;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
device->free = Wayland_DeleteDevice;
|
device->free = Wayland_DeleteDevice;
|
||||||
|
|
|
@ -132,22 +132,6 @@ SDL_bool Wayland_Vulkan_GetInstanceExtensions(_THIS,
|
||||||
extensionsForWayland);
|
extensionsForWayland);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Wayland_Vulkan_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h)
|
|
||||||
{
|
|
||||||
SDL_WindowData *data;
|
|
||||||
if (window->driverdata) {
|
|
||||||
data = (SDL_WindowData *) window->driverdata;
|
|
||||||
|
|
||||||
if (w) {
|
|
||||||
*w = data->drawable_width;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (h) {
|
|
||||||
*h = data->drawable_height;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_bool Wayland_Vulkan_CreateSurface(_THIS,
|
SDL_bool Wayland_Vulkan_CreateSurface(_THIS,
|
||||||
SDL_Window *window,
|
SDL_Window *window,
|
||||||
VkInstance instance,
|
VkInstance instance,
|
||||||
|
|
|
@ -40,7 +40,6 @@ SDL_bool Wayland_Vulkan_GetInstanceExtensions(_THIS,
|
||||||
SDL_Window *window,
|
SDL_Window *window,
|
||||||
unsigned *count,
|
unsigned *count,
|
||||||
const char **names);
|
const char **names);
|
||||||
void Wayland_Vulkan_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h);
|
|
||||||
SDL_bool Wayland_Vulkan_CreateSurface(_THIS,
|
SDL_bool Wayland_Vulkan_CreateSurface(_THIS,
|
||||||
SDL_Window *window,
|
SDL_Window *window,
|
||||||
VkInstance instance,
|
VkInstance instance,
|
||||||
|
|
|
@ -2067,6 +2067,16 @@ void Wayland_SetWindowSize(_THIS, SDL_Window * window)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Wayland_GetWindowSizeInPixels(_THIS, SDL_Window * window, int *w, int *h)
|
||||||
|
{
|
||||||
|
SDL_WindowData *data;
|
||||||
|
if (window->driverdata) {
|
||||||
|
data = (SDL_WindowData *) window->driverdata;
|
||||||
|
*w = data->drawable_width;
|
||||||
|
*h = data->drawable_height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Wayland_SetWindowTitle(_THIS, SDL_Window * window)
|
void Wayland_SetWindowTitle(_THIS, SDL_Window * window)
|
||||||
{
|
{
|
||||||
SDL_WindowData *wind = window->driverdata;
|
SDL_WindowData *wind = window->driverdata;
|
||||||
|
|
|
@ -127,6 +127,7 @@ extern int Wayland_CreateWindow(_THIS, SDL_Window *window);
|
||||||
extern void Wayland_SetWindowSize(_THIS, SDL_Window * window);
|
extern void Wayland_SetWindowSize(_THIS, SDL_Window * window);
|
||||||
extern void Wayland_SetWindowMinimumSize(_THIS, SDL_Window * window);
|
extern void Wayland_SetWindowMinimumSize(_THIS, SDL_Window * window);
|
||||||
extern void Wayland_SetWindowMaximumSize(_THIS, SDL_Window * window);
|
extern void Wayland_SetWindowMaximumSize(_THIS, SDL_Window * window);
|
||||||
|
extern void Wayland_GetWindowSizeInPixels(_THIS, SDL_Window * window, int *w, int *h);
|
||||||
extern int Wayland_SetWindowModalFor(_THIS, SDL_Window * modal_window, SDL_Window * parent_window);
|
extern int Wayland_SetWindowModalFor(_THIS, SDL_Window * modal_window, SDL_Window * parent_window);
|
||||||
extern void Wayland_SetWindowTitle(_THIS, SDL_Window * window);
|
extern void Wayland_SetWindowTitle(_THIS, SDL_Window * window);
|
||||||
extern void Wayland_DestroyWindow(_THIS, SDL_Window *window);
|
extern void Wayland_DestroyWindow(_THIS, SDL_Window *window);
|
||||||
|
|
|
@ -685,7 +685,6 @@ WIN_GL_CreateContext(_THIS, SDL_Window * window)
|
||||||
_this->GL_UnloadLibrary = WIN_GLES_UnloadLibrary;
|
_this->GL_UnloadLibrary = WIN_GLES_UnloadLibrary;
|
||||||
_this->GL_CreateContext = WIN_GLES_CreateContext;
|
_this->GL_CreateContext = WIN_GLES_CreateContext;
|
||||||
_this->GL_MakeCurrent = WIN_GLES_MakeCurrent;
|
_this->GL_MakeCurrent = WIN_GLES_MakeCurrent;
|
||||||
_this->GL_GetDrawableSize = WIN_GLES_GetDrawableSize;
|
|
||||||
_this->GL_SetSwapInterval = WIN_GLES_SetSwapInterval;
|
_this->GL_SetSwapInterval = WIN_GLES_SetSwapInterval;
|
||||||
_this->GL_GetSwapInterval = WIN_GLES_GetSwapInterval;
|
_this->GL_GetSwapInterval = WIN_GLES_GetSwapInterval;
|
||||||
_this->GL_SwapWindow = WIN_GLES_SwapWindow;
|
_this->GL_SwapWindow = WIN_GLES_SwapWindow;
|
||||||
|
@ -832,12 +831,6 @@ WIN_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
WIN_GL_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h)
|
|
||||||
{
|
|
||||||
WIN_GetDrawableSize(window, w, h);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
WIN_GL_SetSwapInterval(_THIS, int interval)
|
WIN_GL_SetSwapInterval(_THIS, int interval)
|
||||||
{
|
{
|
||||||
|
|
|
@ -71,7 +71,6 @@ extern int WIN_GL_SetupWindow(_THIS, SDL_Window * window);
|
||||||
extern SDL_GLContext WIN_GL_CreateContext(_THIS, SDL_Window * window);
|
extern SDL_GLContext WIN_GL_CreateContext(_THIS, SDL_Window * window);
|
||||||
extern int WIN_GL_MakeCurrent(_THIS, SDL_Window * window,
|
extern int WIN_GL_MakeCurrent(_THIS, SDL_Window * window,
|
||||||
SDL_GLContext context);
|
SDL_GLContext context);
|
||||||
extern void WIN_GL_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h);
|
|
||||||
extern int WIN_GL_SetSwapInterval(_THIS, int interval);
|
extern int WIN_GL_SetSwapInterval(_THIS, int interval);
|
||||||
extern int WIN_GL_GetSwapInterval(_THIS);
|
extern int WIN_GL_GetSwapInterval(_THIS);
|
||||||
extern int WIN_GL_SwapWindow(_THIS, SDL_Window * window);
|
extern int WIN_GL_SwapWindow(_THIS, SDL_Window * window);
|
||||||
|
|
|
@ -41,7 +41,6 @@ WIN_GLES_LoadLibrary(_THIS, const char *path) {
|
||||||
_this->GL_UnloadLibrary = WIN_GL_UnloadLibrary;
|
_this->GL_UnloadLibrary = WIN_GL_UnloadLibrary;
|
||||||
_this->GL_CreateContext = WIN_GL_CreateContext;
|
_this->GL_CreateContext = WIN_GL_CreateContext;
|
||||||
_this->GL_MakeCurrent = WIN_GL_MakeCurrent;
|
_this->GL_MakeCurrent = WIN_GL_MakeCurrent;
|
||||||
_this->GL_GetDrawableSize = WIN_GL_GetDrawableSize;
|
|
||||||
_this->GL_SetSwapInterval = WIN_GL_SetSwapInterval;
|
_this->GL_SetSwapInterval = WIN_GL_SetSwapInterval;
|
||||||
_this->GL_GetSwapInterval = WIN_GL_GetSwapInterval;
|
_this->GL_GetSwapInterval = WIN_GL_GetSwapInterval;
|
||||||
_this->GL_SwapWindow = WIN_GL_SwapWindow;
|
_this->GL_SwapWindow = WIN_GL_SwapWindow;
|
||||||
|
@ -74,7 +73,6 @@ WIN_GLES_CreateContext(_THIS, SDL_Window * window)
|
||||||
_this->GL_UnloadLibrary = WIN_GL_UnloadLibrary;
|
_this->GL_UnloadLibrary = WIN_GL_UnloadLibrary;
|
||||||
_this->GL_CreateContext = WIN_GL_CreateContext;
|
_this->GL_CreateContext = WIN_GL_CreateContext;
|
||||||
_this->GL_MakeCurrent = WIN_GL_MakeCurrent;
|
_this->GL_MakeCurrent = WIN_GL_MakeCurrent;
|
||||||
_this->GL_GetDrawableSize = WIN_GL_GetDrawableSize;
|
|
||||||
_this->GL_SetSwapInterval = WIN_GL_SetSwapInterval;
|
_this->GL_SetSwapInterval = WIN_GL_SetSwapInterval;
|
||||||
_this->GL_GetSwapInterval = WIN_GL_GetSwapInterval;
|
_this->GL_GetSwapInterval = WIN_GL_GetSwapInterval;
|
||||||
_this->GL_SwapWindow = WIN_GL_SwapWindow;
|
_this->GL_SwapWindow = WIN_GL_SwapWindow;
|
||||||
|
@ -102,12 +100,6 @@ WIN_GLES_DeleteContext(_THIS, SDL_GLContext context)
|
||||||
SDL_EGL_SwapWindow_impl(WIN)
|
SDL_EGL_SwapWindow_impl(WIN)
|
||||||
SDL_EGL_MakeCurrent_impl(WIN)
|
SDL_EGL_MakeCurrent_impl(WIN)
|
||||||
|
|
||||||
void
|
|
||||||
WIN_GLES_GetDrawableSize(_THIS, SDL_Window* window, int* w, int* h)
|
|
||||||
{
|
|
||||||
WIN_GetDrawableSize(window, w, h);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
WIN_GLES_SetupWindow(_THIS, SDL_Window * window)
|
WIN_GLES_SetupWindow(_THIS, SDL_Window * window)
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,7 +39,6 @@ extern int WIN_GLES_LoadLibrary(_THIS, const char *path);
|
||||||
extern SDL_GLContext WIN_GLES_CreateContext(_THIS, SDL_Window * window);
|
extern SDL_GLContext WIN_GLES_CreateContext(_THIS, SDL_Window * window);
|
||||||
extern int WIN_GLES_SwapWindow(_THIS, SDL_Window * window);
|
extern int WIN_GLES_SwapWindow(_THIS, SDL_Window * window);
|
||||||
extern int WIN_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
|
extern int WIN_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context);
|
||||||
extern void WIN_GLES_GetDrawableSize(_THIS, SDL_Window* window, int* w, int* h);
|
|
||||||
extern void WIN_GLES_DeleteContext(_THIS, SDL_GLContext context);
|
extern void WIN_GLES_DeleteContext(_THIS, SDL_GLContext context);
|
||||||
extern int WIN_GLES_SetupWindow(_THIS, SDL_Window * window);
|
extern int WIN_GLES_SetupWindow(_THIS, SDL_Window * window);
|
||||||
|
|
||||||
|
|
|
@ -180,6 +180,7 @@ WIN_CreateDevice(void)
|
||||||
device->SetWindowPosition = WIN_SetWindowPosition;
|
device->SetWindowPosition = WIN_SetWindowPosition;
|
||||||
device->SetWindowSize = WIN_SetWindowSize;
|
device->SetWindowSize = WIN_SetWindowSize;
|
||||||
device->GetWindowBordersSize = WIN_GetWindowBordersSize;
|
device->GetWindowBordersSize = WIN_GetWindowBordersSize;
|
||||||
|
device->GetWindowSizeInPixels = WIN_GetWindowSizeInPixels;
|
||||||
device->SetWindowOpacity = WIN_SetWindowOpacity;
|
device->SetWindowOpacity = WIN_SetWindowOpacity;
|
||||||
device->ShowWindow = WIN_ShowWindow;
|
device->ShowWindow = WIN_ShowWindow;
|
||||||
device->HideWindow = WIN_HideWindow;
|
device->HideWindow = WIN_HideWindow;
|
||||||
|
@ -221,7 +222,6 @@ WIN_CreateDevice(void)
|
||||||
device->GL_UnloadLibrary = WIN_GL_UnloadLibrary;
|
device->GL_UnloadLibrary = WIN_GL_UnloadLibrary;
|
||||||
device->GL_CreateContext = WIN_GL_CreateContext;
|
device->GL_CreateContext = WIN_GL_CreateContext;
|
||||||
device->GL_MakeCurrent = WIN_GL_MakeCurrent;
|
device->GL_MakeCurrent = WIN_GL_MakeCurrent;
|
||||||
device->GL_GetDrawableSize = WIN_GL_GetDrawableSize;
|
|
||||||
device->GL_SetSwapInterval = WIN_GL_SetSwapInterval;
|
device->GL_SetSwapInterval = WIN_GL_SetSwapInterval;
|
||||||
device->GL_GetSwapInterval = WIN_GL_GetSwapInterval;
|
device->GL_GetSwapInterval = WIN_GL_GetSwapInterval;
|
||||||
device->GL_SwapWindow = WIN_GL_SwapWindow;
|
device->GL_SwapWindow = WIN_GL_SwapWindow;
|
||||||
|
@ -233,7 +233,6 @@ WIN_CreateDevice(void)
|
||||||
device->GL_UnloadLibrary = WIN_GLES_UnloadLibrary;
|
device->GL_UnloadLibrary = WIN_GLES_UnloadLibrary;
|
||||||
device->GL_CreateContext = WIN_GLES_CreateContext;
|
device->GL_CreateContext = WIN_GLES_CreateContext;
|
||||||
device->GL_MakeCurrent = WIN_GLES_MakeCurrent;
|
device->GL_MakeCurrent = WIN_GLES_MakeCurrent;
|
||||||
device->GL_GetDrawableSize = WIN_GLES_GetDrawableSize;
|
|
||||||
device->GL_SetSwapInterval = WIN_GLES_SetSwapInterval;
|
device->GL_SetSwapInterval = WIN_GLES_SetSwapInterval;
|
||||||
device->GL_GetSwapInterval = WIN_GLES_GetSwapInterval;
|
device->GL_GetSwapInterval = WIN_GLES_GetSwapInterval;
|
||||||
device->GL_SwapWindow = WIN_GLES_SwapWindow;
|
device->GL_SwapWindow = WIN_GLES_SwapWindow;
|
||||||
|
@ -244,7 +243,6 @@ WIN_CreateDevice(void)
|
||||||
device->Vulkan_UnloadLibrary = WIN_Vulkan_UnloadLibrary;
|
device->Vulkan_UnloadLibrary = WIN_Vulkan_UnloadLibrary;
|
||||||
device->Vulkan_GetInstanceExtensions = WIN_Vulkan_GetInstanceExtensions;
|
device->Vulkan_GetInstanceExtensions = WIN_Vulkan_GetInstanceExtensions;
|
||||||
device->Vulkan_CreateSurface = WIN_Vulkan_CreateSurface;
|
device->Vulkan_CreateSurface = WIN_Vulkan_CreateSurface;
|
||||||
device->Vulkan_GetDrawableSize = WIN_GL_GetDrawableSize;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
|
#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
|
||||||
|
|
|
@ -773,6 +773,22 @@ WIN_GetWindowBordersSize(_THIS, SDL_Window * window, int *top, int *left, int *b
|
||||||
#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/
|
#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
|
void
|
||||||
WIN_ShowWindow(_THIS, SDL_Window * window)
|
WIN_ShowWindow(_THIS, SDL_Window * window)
|
||||||
{
|
{
|
||||||
|
@ -1402,25 +1418,6 @@ WIN_SetWindowOpacity(_THIS, SDL_Window * window, float opacity)
|
||||||
#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/
|
#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.
|
* Convert a point in the client area from pixels to DPI-scaled points.
|
||||||
*
|
*
|
||||||
|
|
|
@ -81,6 +81,7 @@ extern void WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon);
|
||||||
extern void WIN_SetWindowPosition(_THIS, SDL_Window * window);
|
extern void WIN_SetWindowPosition(_THIS, SDL_Window * window);
|
||||||
extern void WIN_SetWindowSize(_THIS, SDL_Window * window);
|
extern void WIN_SetWindowSize(_THIS, SDL_Window * window);
|
||||||
extern int WIN_GetWindowBordersSize(_THIS, SDL_Window * window, int *top, int *left, int *bottom, int *right);
|
extern int WIN_GetWindowBordersSize(_THIS, SDL_Window * window, int *top, int *left, int *bottom, int *right);
|
||||||
|
extern void WIN_GetWindowSizeInPixels(_THIS, SDL_Window * window, int *width, int *height);
|
||||||
extern int WIN_SetWindowOpacity(_THIS, SDL_Window * window, float opacity);
|
extern int WIN_SetWindowOpacity(_THIS, SDL_Window * window, float opacity);
|
||||||
extern void WIN_ShowWindow(_THIS, SDL_Window * window);
|
extern void WIN_ShowWindow(_THIS, SDL_Window * window);
|
||||||
extern void WIN_HideWindow(_THIS, SDL_Window * window);
|
extern void WIN_HideWindow(_THIS, SDL_Window * window);
|
||||||
|
@ -105,7 +106,6 @@ extern SDL_bool WIN_GetWindowWMInfo(_THIS, SDL_Window * window,
|
||||||
extern void WIN_OnWindowEnter(_THIS, SDL_Window * window);
|
extern void WIN_OnWindowEnter(_THIS, SDL_Window * window);
|
||||||
extern void WIN_UpdateClipCursor(SDL_Window *window);
|
extern void WIN_UpdateClipCursor(SDL_Window *window);
|
||||||
extern int WIN_SetWindowHitTest(SDL_Window *window, SDL_bool enabled);
|
extern int WIN_SetWindowHitTest(SDL_Window *window, SDL_bool enabled);
|
||||||
extern void WIN_GetDrawableSize(const SDL_Window *window, int *w, int *h);
|
|
||||||
extern void WIN_ClientPointToSDL(const SDL_Window *window, int *w, int *h);
|
extern void WIN_ClientPointToSDL(const SDL_Window *window, int *w, int *h);
|
||||||
extern void WIN_ClientPointFromSDL(const SDL_Window *window, int *w, int *h);
|
extern void WIN_ClientPointFromSDL(const SDL_Window *window, int *w, int *h);
|
||||||
extern void WIN_AcceptDragAndDrop(SDL_Window * window, SDL_bool accept);
|
extern void WIN_AcceptDragAndDrop(SDL_Window * window, SDL_bool accept);
|
||||||
|
|
Loading…
Reference in New Issue