FrameCounter++;
}
+void DrawGlobalAnim()
+{
+}
+
void FreeGadgets()
{
FreeLevelEditorGadgets();
graphic_info[i].bitmap = graphic_info[i].bitmaps[IMG_BITMAP_STANDARD];
}
+static void InitGlobalAnimImages()
+{
+ int i, j, k;
+
+ for (i = 0; i < NUM_GLOBAL_ANIMS; i++)
+ {
+ for (j = 0; j < NUM_GLOBAL_ANIM_PARTS; j++)
+ {
+ for (k = 0; k < NUM_SPECIAL_GFX_ARGS; k++)
+ {
+ int graphic = global_anim_info[i].graphic[j][k];
+
+ if (graphic == IMG_UNDEFINED)
+ continue;
+
+ // create textures from images for fast GPU blitting, if possible
+ CreateImageTextures(graphic);
+ }
+ }
+ }
+}
+
#if 1
/* !!! FIX THIS (CHANGE TO USING NORMAL ELEMENT GRAPHIC DEFINITIONS) !!! */
void SetBitmaps_EM(Bitmap **em_bitmap)
print_timestamp_time("InitBitmapPointers");
InitFontGraphicInfo(); /* initialize text drawing functions */
print_timestamp_time("InitFontGraphicInfo");
- InitGlobalAnimGraphicInfo(); /* initialize global animations */
+ InitGlobalAnimGraphicInfo(); /* initialize global animation config */
print_timestamp_time("InitGlobalAnimGraphicInfo");
+ InitGlobalAnimImages(); /* initialize global animation images */
+ print_timestamp_time("InitGlobalAnimImages");
InitGraphicInfo_EM(); /* graphic mapping for EM engine */
print_timestamp_time("InitGraphicInfo_EM");
init.busy.height = anim_initial.height;
InitMenuDesignSettings_Static();
+
InitGfxDrawBusyAnimFunction(DrawInitAnim);
+ InitGfxDrawGlobalAnimFunction(DrawGlobalAnim);
/* use copy of busy animation to prevent change while reloading artwork */
init_last = init;
int original_height; /* original image file height */
boolean contains_small_images; /* set after adding small images */
+ boolean contains_textures; /* set after adding GPU textures */
boolean scaled_up; /* set after scaling up */
int conf_tile_size; /* tile size as defined in config */
img_info->original_height = img_info->bitmaps[IMG_BITMAP_STANDARD]->height;
img_info->contains_small_images = FALSE;
+ img_info->contains_textures = FALSE;
img_info->scaled_up = FALSE;
img_info->conf_tile_size = 0; // will be set later
setString(&img_info->leveldir, leveldir_current->identifier);
}
+void CreateImageTextures(int pos)
+{
+ ImageInfo *img_info = getImageInfoEntryFromImageID(pos);
+
+ if (img_info == NULL || img_info->contains_textures)
+ return;
+
+ CreateBitmapTextures(img_info->bitmaps);
+
+ img_info->contains_textures = TRUE;
+}
+
void ScaleImage(int pos, int zoom_factor)
{
ImageInfo *img_info = getImageInfoEntryFromImageID(pos);
void ReloadCustomImages();
void CreateImageWithSmallImages(int, int, int);
+void CreateImageTextures(int);
void ScaleImage(int, int);
void FreeAllImages();
#endif
+#if defined(TARGET_SDL2)
+static SDL_Texture *SDLCreateTextureFromSurface(SDL_Surface *surface)
+{
+ SDL_Texture *texture = SDL_CreateTextureFromSurface(sdl_renderer, surface);
+
+ if (texture == NULL)
+ Error(ERR_EXIT, "SDL_CreateTextureFromSurface() failed: %s",
+ SDL_GetError());
+
+ return texture;
+}
+#endif
+
+void SDLCreateBitmapTextures(Bitmap *bitmap)
+{
+#if defined(TARGET_SDL2)
+ if (bitmap == NULL)
+ return;
+
+ bitmap->texture = SDLCreateTextureFromSurface(bitmap->surface);
+ bitmap->texture_masked = SDLCreateTextureFromSurface(bitmap->surface_masked);
+#endif
+}
+
void SDLInitVideoDisplay(void)
{
#if !defined(TARGET_SDL2)
SDL_FreeSurface(bitmap->surface);
if (bitmap->surface_masked)
SDL_FreeSurface(bitmap->surface_masked);
+
bitmap->surface = NULL;
bitmap->surface_masked = NULL;
+
+#if defined(TARGET_SDL2)
+ if (bitmap->texture)
+ SDL_DestroyTexture(bitmap->texture);
+ if (bitmap->texture_masked)
+ SDL_DestroyTexture(bitmap->texture_masked);
+
+ bitmap->texture = NULL;
+ bitmap->texture_masked = NULL;
+#endif
}
void SDLCopyArea(Bitmap *src_bitmap, Bitmap *dst_bitmap,
int width, height;
SDL_Surface *surface;
SDL_Surface *surface_masked;
+#if defined(TARGET_SDL2)
+ SDL_Texture *texture;
+ SDL_Texture *texture_masked;
+#endif
};
struct MouseCursorInfo
boolean SDLSetNativeSurface(SDL_Surface **);
SDL_Surface *SDLGetNativeSurface(SDL_Surface *);
+void SDLCreateBitmapTextures(Bitmap *);
#if defined(TARGET_SDL2)
SDL_Surface *SDL_DisplayFormat(SDL_Surface *);
gfx.draw_busy_anim_function = draw_busy_anim_function;
}
+void InitGfxDrawGlobalAnimFunction(void (*draw_global_anim_function)(void))
+{
+ gfx.draw_global_anim_function = draw_global_anim_function;
+}
+
void InitGfxCustomArtworkInfo()
{
gfx.override_level_graphics = FALSE;
CreateScaledBitmaps(bitmaps, zoom_factor, tile_size, TRUE);
}
+void CreateBitmapTextures(Bitmap **bitmaps)
+{
+ SDLCreateBitmapTextures(bitmaps[IMG_BITMAP_STANDARD]);
+}
+
void ScaleBitmap(Bitmap **bitmaps, int zoom_factor)
{
CreateScaledBitmaps(bitmaps, zoom_factor, 0, FALSE);
int anim_random_frame;
void (*draw_busy_anim_function)(void);
+ void (*draw_global_anim_function)(void);
int cursor_mode;
};
void InitGfxScrollbufferInfo(int, int);
void InitGfxClipRegion(boolean, int, int, int, int);
void InitGfxDrawBusyAnimFunction(void (*draw_busy_anim_function)(void));
+void InitGfxDrawGlobalAnimFunction(void (*draw_global_anim_function)(void));
void InitGfxCustomArtworkInfo();
void InitGfxOtherSettings();
void SetDrawDeactivationMask(int);
Bitmap *ZoomBitmap(Bitmap *, int, int);
void ReCreateGameTileSizeBitmap(Bitmap **);
void CreateBitmapWithSmallBitmaps(Bitmap **, int, int);
+void CreateBitmapTextures(Bitmap **);
void ScaleBitmap(Bitmap **, int);
void SetMouseCursor(int);