Controlling scale/window size in SDL2?

  c++, screen-resolution, sdl, sdl-2

I’m trying to write an ASCII game in C++ using SDL2, but the scaling won’t cooperate. As a test, I want to blit 16×16 a tile from a bmp into a 16×16 square, but SDL adjusts the scaling and stretches out the tile so it isn’t square.

I can fix it by using SDL_RenderSetLogicalSize to make the renderer scale things square, but I want my project to be rectangular in the window, so that’s not a great solution. I could also set the renderer size every time I want to swap between square and non-square text, but that seems impractical.

Is there a way I can tweak SDL’s automatic scaling so width and height options refer to screen pixels? Alternately, could I have a seperate renderer with a square logical size in the same window as a regular renderer?

Thanks!

Source: Windows Questions C++

LEAVE A COMMENT