For a school project, we are asked to use the graphics module SDL2 and I'm trying to learn the basic concepts of it. I can add texts and images, create rectangles and move them, but ,because I have never written the condition to reappear from the other side of the window, the object get lost. So, now I'm trying to figure out a way to write this condition in C ,but I cannot figure it out. What can I do or where should I start?
I tried to make if statement when the coordinate of the upper-lest corner passes the limit. Obviously, it solves half of the problem, the object stays inside the window but also the whole object teleports directly to the 0 or the end.