Yeah, it’s just refresh call for any and all of the (sub)windows within the game.
What I did is to isolate that swap buffer call, I actually piggy back it within the original function: wrefresh(), so when I call the same function but with “bool really= true”, then it means it should refresh the whole screen (flip screen), while for other times the function will retain its original functionally, like this:
int wrefresh(WINDOW *win, bool really)
{
if(really)
{
-----> SWAP BUFFER/FLIP SCREEN HERE: *** vvv
MsgWaitForMultipleObjects(0, NULL, FALSE, 1, QS_PAINT); //QS_ALLEVENTS
UpdateWindow(WindowHandle);
-----> SWAP BUFFER/FLIP SCREEN HERE: *** ^^^
return 1;
}
if(win==0)
win=mainwin;
if(win->draw)
DrawWindow(win);
return 1;
}
Then I simply placed one of those calls: wrefresh(0, true), at the end of draw() function in game.cpp, two more in explosion() function, for explosion animation and shrapnel animation, also in game.cpp. And one more in ranged.cpp for bullets animation. If you search for “nanosleep()” function you will find those places where you need to additionally refresh the screen beside the one in the main draw() function in game.cpp.