Android touch event and resolution problem

I’ve been trying to get the pixel coordinates from the SDL_FINGERDOWN event, but I seem to need the screen resolution for this to work.

I created my window using
SDL_CreateWindowAndRenderer(0, 0, 0, &window, &renderer) < 0)

And everything I’ve tried to get a resolution from my window or renderer.

SDL_GetWindowSize(window, windowWidth, windowHeight);
SDL_GetRendererOutputSize(renderer, windowWidth, windowHeight);
SDL_GL_GetDrawableSize(window, windowWidth, windowHeight);

Those just seem to return a 0x0 resolution.



Just crashes my app when I try to get the width or height from the surface.

Does anyone have any other ideas on how to get it to work?

After trying some other things to work around this and failing horribly, I read around in the code a little bit and found out about DisplayMode in SDL_AndroidVideo.c.

I’ve managed to get the resolution with

SDL_DisplayMode display;
SDL_GetCurrentDisplayMode(0, &display);
windowWidth = display.w;
windowHeight = display.h;