diff --git a/sdl1/pdcscrn.c b/sdl1/pdcscrn.c index 76d9d4e9..96535c28 100644 --- a/sdl1/pdcscrn.c +++ b/sdl1/pdcscrn.c @@ -384,6 +384,8 @@ int PDC_color_content(short color, short *red, short *green, short *blue) int PDC_init_color(short color, short red, short green, short blue) { + pdc_dirty = TRUE; + pdc_color[color].r = DIVROUND(red * 255, 1000); pdc_color[color].g = DIVROUND(green * 255, 1000); pdc_color[color].b = DIVROUND(blue * 255, 1000); @@ -391,7 +393,5 @@ int PDC_init_color(short color, short red, short green, short blue) pdc_mapped[color] = SDL_MapRGB(pdc_screen->format, pdc_color[color].r, pdc_color[color].g, pdc_color[color].b); - wrefresh(curscr); - return OK; } diff --git a/sdl1/pdcsdl.h b/sdl1/pdcsdl.h index 25209275..7371532b 100644 --- a/sdl1/pdcsdl.h +++ b/sdl1/pdcsdl.h @@ -28,6 +28,7 @@ extern bool pdc_own_screen; /* if pdc_screen was not set before initscr(), PDCurses is responsible for (owns) it */ extern Uint32 pdc_lastupdate; /* time of last update, in ticks */ +extern bool pdc_dirty; /* redraw on napms() after init_color() */ PDCEX void PDC_update_rects(void); PDCEX void PDC_retile(void); diff --git a/sdl1/pdcutil.c b/sdl1/pdcutil.c index 78b06ad4..0f3138dd 100644 --- a/sdl1/pdcutil.c +++ b/sdl1/pdcutil.c @@ -2,6 +2,8 @@ #include "pdcsdl.h" +bool pdc_dirty = FALSE; + void PDC_beep(void) { PDC_LOG(("PDC_beep() - called\n")); @@ -11,6 +13,12 @@ void PDC_napms(int ms) { PDC_LOG(("PDC_napms() - called: ms=%d\n", ms)); + if (pdc_dirty) + { + pdc_dirty = FALSE; + wrefresh(curscr); + } + PDC_update_rects(); SDL_PumpEvents(); SDL_Delay(ms); diff --git a/sdl2/pdcscrn.c b/sdl2/pdcscrn.c index 15c9e808..13ea1f4d 100644 --- a/sdl2/pdcscrn.c +++ b/sdl2/pdcscrn.c @@ -418,6 +418,8 @@ int PDC_color_content(short color, short *red, short *green, short *blue) int PDC_init_color(short color, short red, short green, short blue) { + pdc_dirty = TRUE; + pdc_color[color].r = DIVROUND(red * 255, 1000); pdc_color[color].g = DIVROUND(green * 255, 1000); pdc_color[color].b = DIVROUND(blue * 255, 1000); @@ -425,7 +427,5 @@ int PDC_init_color(short color, short red, short green, short blue) pdc_mapped[color] = SDL_MapRGB(pdc_screen->format, pdc_color[color].r, pdc_color[color].g, pdc_color[color].b); - wrefresh(curscr); - return OK; } diff --git a/sdl2/pdcsdl.h b/sdl2/pdcsdl.h index 357b4429..0eac62f7 100644 --- a/sdl2/pdcsdl.h +++ b/sdl2/pdcsdl.h @@ -29,6 +29,7 @@ extern bool pdc_own_window; /* if pdc_window was not set before initscr(), PDCurses is responsible for (owns) it */ extern Uint32 pdc_lastupdate; /* time of last update, in ticks */ +extern bool pdc_dirty; /* redraw on napms() after init_color() */ PDCEX void PDC_update_rects(void); PDCEX void PDC_retile(void); diff --git a/sdl2/pdcutil.c b/sdl2/pdcutil.c index 3f0e9dc3..0df45fef 100644 --- a/sdl2/pdcutil.c +++ b/sdl2/pdcutil.c @@ -2,6 +2,8 @@ #include "pdcsdl.h" +bool pdc_dirty = FALSE; + void PDC_beep(void) { PDC_LOG(("PDC_beep() - called\n")); @@ -11,6 +13,12 @@ void PDC_napms(int ms) { PDC_LOG(("PDC_napms() - called: ms=%d\n", ms)); + if (pdc_dirty) + { + pdc_dirty = FALSE; + wrefresh(curscr); + } + PDC_update_rects(); SDL_PumpEvents(); SDL_Delay(ms);