+2014-01-17
+ * improved speed of displaying progress when loading levels and artwork
+
2014-01-15
* fixed toons stopping on continuous touch events on Mac OS X
-#define COMPILE_DATE_STRING "2014-01-15 20:15"
+#define COMPILE_DATE_STRING "2014-01-17 16:49"
font_height = getFontHeight(FC_RED);
#if 1
- DrawInitText(getWindowTitleString(), 20, FC_YELLOW);
+ DrawInitTextAlways(getWindowTitleString(), 20, FC_YELLOW);
#else
- DrawInitText(getProgramInitString(), 20, FC_YELLOW);
+ DrawInitTextAlways(getProgramInitString(), 20, FC_YELLOW);
#endif
- DrawInitText(PROGRAM_COPYRIGHT_STRING, 50, FC_RED);
- DrawInitText(PROGRAM_WEBSITE_STRING, WIN_YSIZE - 20 - font_height, FC_RED);
+ DrawInitTextAlways(PROGRAM_COPYRIGHT_STRING, 50, FC_RED);
+ DrawInitTextAlways(PROGRAM_WEBSITE_STRING, WIN_YSIZE - 20 - font_height,
+ FC_RED);
- DrawInitText("Loading graphics", 120, FC_GREEN);
+ DrawInitTextAlways("Loading graphics", 120, FC_GREEN);
#if 1
#if 1
#endif
print_timestamp_done("ReloadCustomArtwork");
+
+ LimitScreenUpdates(FALSE);
}
void KeyboardAutoRepeatOffUnlessAutoplay()
static int fullscreen_yoffset;
static int video_xoffset;
static int video_yoffset;
+static boolean limit_screen_updates = FALSE;
+
/* functions from SGE library */
void sge_Line(SDL_Surface *, Sint16, Sint16, Sint16, Sint16, Uint32);
-#if defined(TARGET_SDL2)
+void SDLLimitScreenUpdates(boolean enable)
+{
+ limit_screen_updates = enable;
+}
+
static void UpdateScreen(SDL_Rect *rect)
{
+ static unsigned int update_screen_delay = 0;
+ unsigned int update_screen_delay_value = 100; /* (milliseconds) */
+
+#if 1
+ if (limit_screen_updates &&
+ !DelayReached(&update_screen_delay, update_screen_delay_value))
+ return;
+
+ LimitScreenUpdates(FALSE);
+#endif
+
+#if defined(TARGET_SDL2)
#if USE_RENDERER
SDL_Surface *screen = backbuffer->surface;
else
SDL_UpdateWindowSurface(sdl_window);
#endif
-}
+
+#else // TARGET_SDL
+ if (rect)
+ SDL_UpdateRects(backbuffer->surface, 1, rect);
+ else
+ SDL_UpdateRect(backbuffer->surface, 0, 0, 0, 0);
#endif
+}
static void setFullscreenParameters(char *fullscreen_mode_string)
{
boolean fullscreen)
{
SDL_Surface *new_surface = NULL;
- static boolean fullscreen_enabled = FALSE;
#if defined(TARGET_SDL2)
+ static boolean fullscreen_enabled = FALSE;
int surface_flags_window = SURFACE_FLAGS | SDL_WINDOW_RESIZABLE;
#if USE_DESKTOP_FULLSCREEN
int surface_flags_fullscreen = SURFACE_FLAGS | SDL_WINDOW_FULLSCREEN_DESKTOP;
new_surface = SDL_SetVideoMode(width, height, video.depth, surface_flags);
#endif
+#if defined(TARGET_SDL2)
// store fullscreen state ("video.fullscreen_enabled" may not reflect this!)
if (new_surface != NULL)
fullscreen_enabled = fullscreen;
+#endif
return new_surface;
}
}
#else
if (dst_bitmap == window)
- SDL_UpdateRect(backbuffer->surface, dst_x, dst_y, width, height);
+ {
+ // SDL_UpdateRect(backbuffer->surface, dst_x, dst_y, width, height);
+ UpdateScreen(&dst_rect);
+ }
#endif
}
}
#else
if (dst_bitmap == window)
- SDL_UpdateRect(backbuffer->surface, x, y, width, height);
+ {
+ // SDL_UpdateRect(backbuffer->surface, x, y, width, height);
+ UpdateScreen(&rect);
+ }
#endif
}
SDL_Surface *surface_screen = backbuffer->surface;
SDL_Surface *surface_cross = (bitmap_cross ? bitmap_cross->surface : NULL);
SDL_Rect src_rect, dst_rect;
-#if defined(TARGET_SDL2)
SDL_Rect dst_rect2;
-#endif
int src_x = x, src_y = y;
int dst_x = x, dst_y = y;
unsigned int time_last, time_current;
dst_rect.w = width; /* (ignored) */
dst_rect.h = height; /* (ignored) */
-#if defined(TARGET_SDL2)
dst_rect2 = dst_rect;
-#endif
if (initialization_needed)
{
// SDL_UpdateWindowSurfaceRects(sdl_window, &dst_rect2, 1);
UpdateScreen(&dst_rect2);
#else
- SDL_UpdateRect(surface_screen, dst_x, dst_y, width, height);
+ // SDL_UpdateRect(surface_screen, dst_x, dst_y, width, height);
+ UpdateScreen(&dst_rect2);
#endif
}
}
// SDL_UpdateWindowSurfaceRects(sdl_window, &dst_rect, 1);
UpdateScreen(&dst_rect);
#else
- SDL_UpdateRect(surface_screen, dst_x, dst_y, width, height);
+ // SDL_UpdateRect(surface_screen, dst_x, dst_y, width, height);
+ UpdateScreen(&dst_rect);
#endif
#else
SDL_Flip(surface_screen);
void SDLRedrawWindow();
#endif
+void SDLLimitScreenUpdates(boolean);
void SDLInitVideoDisplay(void);
void SDLInitVideoBuffer(DrawBuffer **, DrawWindow **, boolean);
boolean SDLSetVideoMode(DrawBuffer **, boolean);
#endif
}
+void LimitScreenUpdates(boolean enable)
+{
+#if defined(TARGET_SDL)
+ SDLLimitScreenUpdates(enable);
+#endif
+}
+
void InitVideoDisplay(void)
{
#if defined(TARGET_SDL)
void SetMainBackgroundBitmap(Bitmap *);
void SetDoorBackgroundBitmap(Bitmap *);
+void LimitScreenUpdates(boolean);
+
void InitVideoDisplay(void);
void CloseVideoDisplay(void);
void InitVideoBuffer(int, int, int, boolean);
void DrawInitTextExt(char *text, int ypos, int font_nr, boolean force)
{
+#if 1
+#if 0
static unsigned int progress_delay = 0;
unsigned int progress_delay_value = 100; /* (in milliseconds) */
+#endif
+
+ // LimitScreenUpdates(TRUE); // (ignore "force" for now)
+ // LimitScreenUpdates(!force);
+ LimitScreenUpdates(TRUE);
+
+ UPDATE_BUSY_STATE();
+
+#if 0
+ if (!force && !DelayReached(&progress_delay, progress_delay_value))
+ return;
+#endif
+
+ if (window != NULL &&
+ gfx.draw_init_text &&
+ gfx.num_fonts > 0 &&
+ gfx.font_bitmap_info[font_nr].bitmap != NULL)
+ {
+ int x = (video.width - getTextWidth(text, font_nr)) / 2;
+ int y = ypos;
+ int width = video.width;
+ int height = getFontHeight(font_nr);
+
+ ClearRectangle(drawto, 0, y, width, height);
+ DrawTextExt(drawto, x, y, text, font_nr, BLIT_OPAQUE);
+
+ BlitBitmap(drawto, window, 0, 0, video.width, video.height, 0, 0);
+ }
+#else
+ static unsigned int progress_delay = 0;
+ unsigned int progress_delay_value = 100; /* (in milliseconds) */
+
+ // LimitScreenUpdates(TRUE); // (ignore "force" for now)
+ LimitScreenUpdates(!force);
UPDATE_BUSY_STATE();
/* this makes things significantly faster than directly drawing to window */
BlitBitmap(drawto, window, 0, y, width, height, 0, y);
}
+#endif
}
void DrawInitText(char *text, int ypos, int font_nr)
+{
+ // DrawInitTextExt(text, ypos, font_nr, TRUE);
+ DrawInitTextExt(text, ypos, font_nr, FALSE);
+}
+
+void DrawInitTextAlways(char *text, int ypos, int font_nr)
{
DrawInitTextExt(text, ypos, font_nr, TRUE);
}
int maxWordLengthInString(char *);
void DrawInitText(char *, int, int);
+void DrawInitTextAlways(char *, int, int);
void DrawInitTextIfNeeded(char *, int, int);
void DrawInitTextExt(char *, int, int, boolean);
+
void DrawTextF(int, int, int, char *, ...);
void DrawTextFCentered(int, int, char *, ...);
void DrawTextS(int, int, int, char *);
static LevelDirTree *leveldir_last_valid = NULL;
boolean levelset_has_changed = FALSE;
+ LimitScreenUpdates(FALSE);
+
FadeSetLeaveScreen();
/* do not fade out here -- function may continue and fade on editor screen */