Message box error maybe bug on Android

Hi, I recently had an error with SDL2 2.0.12 on Android. I fixed the error but I got really curious about the message box rendering, it seems that the last (fourth) option should be “ignore” but it renders as a squishy button on my phone. Any idea if this is a bug on my code or it’s a known behavior? (the last button being rendered wrongly) I was using the SDL Renderer in my code when I got the error.

1 Like

Also I have a code with SDL Renderer that runs fine on desktop systems but on Android the game is rendered at it’s native size in a small little box (the game is 320x180) instead of getting into the size of the screen (I am using SDL_WINDOW_FULLSCREEN_DESKTOP). I am trying to see if there’s something else wrong on my code or if it’s a problem on Android. Looking on the internet there’s a lot referencing a certain SetLogicalSize function but I can’t understand what it should do and why I don’t need it on desktop.

Apparently on Android I need to use SDL_RenderSetLogicalSize for proper fullscreen with SDL Render.

I wanted to let the user choose between being fullscreen preserving aspect ratio or stretching to the screen ignoring Aspect Ratio, but if I use SDL_RenderSetLogicalSize it always preserves Aspect Ratio - doing letterboxing. Is there a way to properly Fullscreen in Android while stretching instead of letterboxing?

You can first render to a target texture and then copy that to the default render target using any scaling you choose. That’s what I do - on every platform, not just Android.

Sorry, but do you do this using SDL Renderer and SDL Renderer instructions or you are talking about OpenGL/Directx/… ? I am really just starting with the SDL Renderer and so far I am unfamiliar with it. I did got my own OpenGL/Directx/… to work with SDL Window and all, but the Renderer has me constantly looking under the hood to try to figure out how it should work.

Also, if you ARE talking about the SDL Renderer, do you know if there’s a version of ImGui for it? It would be super useful if there was one but I couldn’t find.

Ah, I think maybe you mean using this : https://wiki.libsdl.org/SDL_RenderCopy

Yes. All common backends support rendering to a target texture, see for example SDL_SetRenderTarget() for more details.

1 Like