Confusion About Screen Coordinates

I don’t think I understand what is a screen coordinate. From what I have read, it is a logical unit that is converted to pixels when rendering the window. Does it mean if I have a a window with 512x512 pixels and a buffer sized 256x256 “screen coordinates”, then SDL will automatically handle the conversion to pixels when rendering? All my functions calls to SDL should always be in screen coordinates?

No, in logical size coordinates. See the SDL_RenderSetLogicalSize function description:

This function uses the viewport and scaling functionality to allow a fixed logical resolution for rendering, regardless of the actual output resolution. If the actual output resolution doesn’t have the same aspect ratio the output rendering will be centered within the output display.

If the output display is a window, mouse and touch events in the window will be filtered and scaled so they seem to arrive within the logical resolution.

Just create a simple test program and try it. :wink:

Thanks, I am new to graphics programming and still getting used to all terminology. If you don’t mind, I have another question regarding pixel manipulation. What is the right/safe way to change pixels directly? I have seen that you would need SDL_PixelFormat and SDL_Surface, but I get lost when coming across words like pitch, bitsPerPixel, bytePerPixel. I would appreciate any source to understand what all these mean.