SDL Snake Clone has troubles rendering the snake

Hi everyone!

I rencently discovered the SDL library, and when I tought I was ready for it, I started making a Snake Clone. For now, I just control the snake using standard Input. When running the program, the window and the snake are created, and the snake renders fine. When I input a first move, the snake moves how it should. But when I input a second move, the whole screen gets filled with snake blocks.

I hope anyone can help me with this.

I'll just put the code on pastebin as it is way too large to post here

https://pastebin.com/Qd3LLsba
Last edited on
In your GameManager::mainLoop you need to call SDL_SetRenderDrawColor before SDL_RenderClear otherwise you are clearing the background with the color of your snake each loop.
That makes sense, thanks alot
Topic archived. No new replies allowed.