mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2025-02-08 06:06:43 +01:00
use pregenerated bitmap in loading screen
This commit is contained in:
parent
e5dda46b31
commit
5895e206dc
1 changed files with 35 additions and 24 deletions
|
@ -41,13 +41,14 @@ void Loading_Load(struct Game *game) {
|
||||||
DrawConsole(game);
|
DrawConsole(game);
|
||||||
al_flip_display();
|
al_flip_display();
|
||||||
|
|
||||||
|
game->loading.loading_bitmap = al_create_bitmap(al_get_display_width(game->display), al_get_display_height(game->display));
|
||||||
|
al_set_target_bitmap(game->loading.loading_bitmap);
|
||||||
|
|
||||||
|
void GenerateLoadingBitmap() {
|
||||||
al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP);
|
al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP);
|
||||||
game->loading.image = al_load_bitmap( "data/loading.png" );
|
game->loading.image = al_load_bitmap( "data/loading.png" );
|
||||||
al_set_new_bitmap_flags(ALLEGRO_MAG_LINEAR | ALLEGRO_MIN_LINEAR);
|
al_set_new_bitmap_flags(ALLEGRO_MAG_LINEAR | ALLEGRO_MIN_LINEAR);
|
||||||
|
|
||||||
game->loading.loading_bitmap = al_create_bitmap(al_get_display_width(game->display), al_get_display_height(game->display));
|
|
||||||
al_set_target_bitmap(game->loading.loading_bitmap);
|
|
||||||
|
|
||||||
int width = al_get_display_width(game->display);
|
int width = al_get_display_width(game->display);
|
||||||
int height = al_get_display_height(game->display);
|
int height = al_get_display_height(game->display);
|
||||||
int x, y;
|
int x, y;
|
||||||
|
@ -68,6 +69,16 @@ void Loading_Load(struct Game *game) {
|
||||||
al_put_pixel(x, y, result);
|
al_put_pixel(x, y, result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
al_save_bitmap("data/cache/loading.png", game->loading.loading_bitmap);
|
||||||
|
PrintConsole(game, "Cache bitmap generated.");
|
||||||
|
}
|
||||||
|
|
||||||
|
game->loading.image = al_load_bitmap( "data/cache/loading.png");
|
||||||
|
if (game->loading.image) {
|
||||||
|
if ((al_get_bitmap_width(game->loading.image)!=al_get_display_width(game->display)) || (al_get_bitmap_height(game->loading.image)!=al_get_display_height(game->display)))
|
||||||
|
GenerateLoadingBitmap();
|
||||||
|
else al_draw_bitmap(game->loading.image, 0, 0, 0);
|
||||||
|
} else GenerateLoadingBitmap();
|
||||||
|
|
||||||
// Scale "Loading" bitmap
|
// Scale "Loading" bitmap
|
||||||
//al_draw_scaled_bitmap(game->loading.image,0, 0, al_get_bitmap_width(game->loading.image), al_get_bitmap_height(game->loading.image), 0, 0, al_get_display_width(game->display), al_get_display_height(game->display),0);
|
//al_draw_scaled_bitmap(game->loading.image,0, 0, al_get_bitmap_width(game->loading.image), al_get_bitmap_height(game->loading.image), 0, 0, al_get_display_width(game->display), al_get_display_height(game->display),0);
|
||||||
|
|
Loading…
Reference in a new issue