Decreasing a static image progress bar horizontally in SDL In my project, I have a decreasing timer progress bar PNG image on display. This image and its background can be found at the below link: https://s3.eksiup.com/df7dd38f781.png My goal is to make the bar decrease starting from the upper green side to the lower red side. My code for this is the following: void EntityTimer::OnRender(SDL_Renderer *ren) { SDL_Rect currRect,dstRect; double rem=0.0; memcpy(&currRect,&origRect,sizeof (SDL_Rect)); memcpy(&dstRect,&origRect,sizeof (SDL_Rect)); if (timerObjPtr->remainingDuration>timerObjPtr->durationInMilisec) timerObjPtr->durationInMilisec=timerObjPtr->remainingDuration; rem=((double)timerObjPtr->remainingDuration/timerObjPtr->durationInMilisec); currRect.h=(origRect.h)*rem; currRect.h = currRect.h; dstRect.x=0; dstRect.y=0; dstRect.h=currRect.h...
You should ask a specific question for a particular problem. Since Stack Overflow hides the Close reason from you: "Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question."
– jww
Jul 1 at 1:03