Adding SDL_GetWindowSizeInPixels for window size in pixels (#6112)
This commit is contained in:
parent
70c781c803
commit
00452e47fa
32 changed files with 122 additions and 142 deletions
|
@ -47,6 +47,7 @@ static int Emscripten_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * d
|
|||
|
||||
static int Emscripten_CreateWindow(_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_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen);
|
||||
static void Emscripten_PumpEvents(_THIS);
|
||||
|
@ -101,6 +102,7 @@ Emscripten_CreateDevice(void)
|
|||
device->MinimizeWindow = Emscripten_MinimizeWindow;
|
||||
device->RestoreWindow = Emscripten_RestoreWindow;
|
||||
device->SetWindowMouseGrab = Emscripten_SetWindowMouseGrab;*/
|
||||
device->GetWindowSizeInPixels = Emscripten_GetWindowSizeInPixels;
|
||||
device->DestroyWindow = Emscripten_DestroyWindow;
|
||||
device->SetWindowFullscreen = Emscripten_SetWindowFullscreen;
|
||||
|
||||
|
@ -118,7 +120,6 @@ Emscripten_CreateDevice(void)
|
|||
device->GL_GetSwapInterval = Emscripten_GLES_GetSwapInterval;
|
||||
device->GL_SwapWindow = Emscripten_GLES_SwapWindow;
|
||||
device->GL_DeleteContext = Emscripten_GLES_DeleteContext;
|
||||
device->GL_GetDrawableSize = Emscripten_GLES_GetDrawableSize;
|
||||
#endif
|
||||
|
||||
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
|
||||
Emscripten_DestroyWindow(_THIS, SDL_Window * window)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue