From the issue tracker:
https://github.com/TheDarklingWolf/Cataclysm-DDA/pull/750
I get the feeling that LazyCat doesn't understand why frequent full-window repaints are a Bad Thing.
I don’t understand? Hah! Go on then, tell us what is it you were trying to say, what is bad, how is it bad, and what’s better?
Maybe we can fix the flicker by figuring out how to specify an update region that isn't the entire window? It looks like the third argument can be used to specify a set of rectangles to update, maybe we should look into using that.
No, that is irrelevant to flickering and is already handled in the code. The only purpose of it is to optimise back buffer drawings, but screen blit or double buffering flip updates whole screen and there is nothing you can do about it. That’s how video cards work, all you have there is option to wait or not wait for vertical refresh.
However you problem is even more trivial, and as I explained in another thread you simply need to look into those menus which are flickering. Crafting and options menu are the only ones I could find that are flickering with my original bugfix proposal, but if there is something else that doesn’t work simply tell me about it and I’ll fix it. Just ask, there is no reason to guess or assume.
1.) catacurse.cpp (enable animations & optimise)
void DrawWindow(WINDOW *win)
{
.
.
win->draw=false; //We drew the window, mark it as so
//CAT:
RedrawWindow(WindowHandle, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW);
};
int getch(void)
{
// standards note: getch is sometimes required to call refresh
// see, e.g., http://linux.die.net/man/3/getch
// so although it's non-obvious, that refresh() call (and maybe InvalidateRect?) IS supposed to be there
//CAT:
// refresh();
// InvalidateRect(WindowHandle,NULL,true);
.
.
//CAT:
// Sleep(2);
}
while (endtime<(starttime+inputdelay));
}
else
{
CheckMessages();
};
//CAT:
// Sleep(25);
return lastchar;
};
int werase(WINDOW *win)
{
.
.
//CAT:
// wrefresh(win);
return 1;
};
2.) map.cpp (lets make driving not be slower than walking)
bool map::vehproceed(game* g)
{
.
.
//CAT:
/*
if (pl_ctrl && veh->velocity) {
// a bit of delay for animation
// total delay is roughly one third of a second.
int ns_per_frame = abs ( (BILLION/3) / ( (float)veh->velocity / 1000) );
if (ns_per_frame > BILLION/15)
ns_per_frame = BILLION/15;
timespec ts; // Timespec for the animation
ts.tv_sec = 0;
ts.tv_nsec = ns_per_frame;
nanosleep (&ts, 0);
}
*/
3.) options. cpp (remove flickering in options menu)
void game::show_options()
{
WINDOW* w_options_border = newwin(25, 80, (TERMY > 25) ? (TERMY-25)/2 : 0, (TERMX > 80) ? (TERMX-80)/2 : 0);
WINDOW* w_options = newwin(23, 78, 1 + ((TERMY > 25) ? (TERMY-25)/2 : 0), 1 + ((TERMX > 80) ? (TERMX-80)/2 : 0));
//CAT: move here from below
wborder(w_options_border, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX,
LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX);
mvwprintz(w_options_border, 0, 36, c_ltred, " OPTIONS ");
wrefresh(w_options_border);
//CAT: *** ^^^
int offset = 1;
const int MAX_LINE = 22;
int line = 0;
char ch = ' ';
bool changed_options = false;
bool needs_refresh = true;
do {
//CAT: move above, outside do-loop
/*
wborder(w_options_border, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX,
LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX);
mvwprintz(w_options_border, 0, 36, c_ltred, " OPTIONS ");
wrefresh(w_options_border);
*/
//CAT: *** ^^^
.
.
wrefresh(w_options);
//CAT:
// refresh();
ch = input();
needs_refresh = true;
//CAT:
// refresh();
switch (ch) {
// move up and down
.
.
3.) crafting.cpp (remove flickering in crafting menu)
recipe* game::select_crafting_recipe()
{
.
.
mvwputch(w_data, 21, 0, c_ltgray, LINE_XXOO); // _|
mvwputch(w_data, 21, 79, c_ltgray, LINE_XOOX); // |_
//CAT:
// wrefresh(w_data);
int recmin = 0, recmax = current.size();
if(recmax > MAX_DISPLAYED_RECIPES)
{
.
.