Hello,
I am having trouble getting separate image files to animate smoothley. When I run the program, the image shows up and flickers alot, it also stutters some. I'll post some of my code and see if anyone can help me.
SDL_RenderClear(MainRend);
SDL_RenderCopy(MainRend,BackdropTex,NULL,&BackdropRect);
gAidan.CurrentFrame++;
if(gAidan.CurrentFrame == 1)
{
SDL_RenderCopy(MainRend,gAidan.StandTex[0],NULL,&gAidan.StandDstRect[0]);
}
else if(gAidan.CurrentFrame == 2)
{
SDL_RenderCopy(MainRend,gAidan.StandTex[1],NULL,&gAidan.StandDstRect[1]);
}
else if(gAidan.CurrentFrame == 3)
{
SDL_RenderCopy(MainRend,gAidan.StandTex[2],NULL,&gAidan.StandDstRect[2]);
}
else if(gAidan.CurrentFrame == 4)
{
SDL_RenderCopy(MainRend,gAidan.StandTex[3],NULL,&gAidan.StandDstRect[3]);
}
else if(gAidan.CurrentFrame == 5)
{
SDL_RenderCopy(MainRend,gAidan.StandTex[4],NULL,&gAidan.StandDstRect[4]);
}
else if(gAidan.CurrentFrame == 6)
{
SDL_RenderCopy(MainRend,gAidan.StandTex[5],NULL,&gAidan.StandDstRect[5]);
}
else if(gAidan.CurrentFrame == 7)
{
gAidan.CurrentFrame = 0;
}
SDL_RenderPresent(MainRend);
I can post more code if it is needed.