Skip to main content

The renderer cannot accept SDL_Surface*'s so you will have to convert them to textures by

SDL_Texture* texture = SDL_CreateTextureFromSurface(render, surface)

The renderer is basically an SDL_Window* that is hidden from the user where the graphics are rendered at first, then the rendered data gets switched with the window's data

To do this you must use SDL_RenderPresent(render)

To clear the window data, you must use SDL_RenderClear(render)

To copy the texture to the render, you must use

SDL_RenderCopy(render, &srctexture, texture&src, &dst)

where src is the SDL_Rect area that you want to extract from an image, if you pass NULL, the whole image will be copied

and dst is where you want the image to be rendered at, if you pass NULL, it will be rendered at 0,0

there is a function called SDL_RenderCopyEx() which is the same as the other one but can rotate a sprite rendered

The renderer cannot accept SDL_Surface*'s so you will have to convert them to textures by

SDL_Texture* texture = SDL_CreateTextureFromSurface(render, surface)

The renderer is basically an SDL_Window* that is hidden from the user where the graphics are rendered at first, then the rendered data gets switched with the window's data

To do this you must use SDL_RenderPresent(render)

To clear the window data, you must use SDL_RenderClear(render)

To copy the texture to the render, you must use

SDL_RenderCopy(render, &src, texture, &dst)

where src is the SDL_Rect area that you want to extract from an image, if you pass NULL, the whole image will be copied

and dst is where you want the image to be rendered at, if you pass NULL, it will be rendered at 0,0

there is a function called SDL_RenderCopyEx() which is the same as the other one but can rotate a sprite rendered

The renderer cannot accept SDL_Surface*'s so you will have to convert them to textures by

SDL_Texture* texture = SDL_CreateTextureFromSurface(render, surface)

The renderer is basically an SDL_Window* that is hidden from the user where the graphics are rendered at first, then the rendered data gets switched with the window's data

To do this you must use SDL_RenderPresent(render)

To clear the window data, you must use SDL_RenderClear(render)

To copy the texture to the render, you must use

SDL_RenderCopy(render, texture, &src, &dst)

where src is the SDL_Rect area that you want to extract from an image, if you pass NULL, the whole image will be copied

and dst is where you want the image to be rendered at, if you pass NULL, it will be rendered at 0,0

there is a function called SDL_RenderCopyEx() which is the same as the other one but can rotate a sprite rendered

Source Link
saloomi2012
  • 257
  • 2
  • 13

The renderer cannot accept SDL_Surface*'s so you will have to convert them to textures by

SDL_Texture* texture = SDL_CreateTextureFromSurface(render, surface)

The renderer is basically an SDL_Window* that is hidden from the user where the graphics are rendered at first, then the rendered data gets switched with the window's data

To do this you must use SDL_RenderPresent(render)

To clear the window data, you must use SDL_RenderClear(render)

To copy the texture to the render, you must use

SDL_RenderCopy(render, &src, texture, &dst)

where src is the SDL_Rect area that you want to extract from an image, if you pass NULL, the whole image will be copied

and dst is where you want the image to be rendered at, if you pass NULL, it will be rendered at 0,0

there is a function called SDL_RenderCopyEx() which is the same as the other one but can rotate a sprite rendered