I am trying to make a paint program and there is a sdl function called IMG_SavePNG() which requires a surface and destination file. How can I turn what I see in the window to a surface?
To achieve this in SDL, you need to use the SDL_GetWindowSurface() funcion. This function will return the surface associated with the window. You can then pass the surface to the
IMG_SavePNG function to take a screenshot.