implement progress bar on fulscreen toggling

This commit is contained in:
Sebastian Krzyszkowiak 2012-09-28 03:11:45 +02:00
parent e67ffb821c
commit 8c24ebd982
2 changed files with 12 additions and 4 deletions

View file

@ -331,7 +331,6 @@ void Level_PreloadBitmaps(struct Game *game, void (*progress)(struct Game*, floa
game->level.derpy = al_create_bitmap(al_get_bitmap_width(*(game->level.derpy_sheet))/game->level.sheet_cols, al_get_bitmap_height(*(game->level.derpy_sheet))/game->level.sheet_rows);
//TODO: load proper bitmap files for each level
//TODO: maybe handle strange display aspects
game->level.clouds = LoadScaledBitmap("levels/1/clouds.png", game->viewportHeight*4.73307291666666666667, game->viewportHeight);
PROGRESS;
game->level.foreground = LoadScaledBitmap("levels/1/foreground.png", game->viewportHeight*4.73307291666666666667, game->viewportHeight);

View file

@ -44,14 +44,23 @@ int Pause_Keydown(struct Game *game, ALLEGRO_EVENT *ev) {
al_flip_display();
SetupViewport(game);
Shared_Load(game);
al_draw_text_with_shadow(game->font, al_map_rgb(255,255,255), game->viewportWidth*0.0234, game->viewportHeight*0.85, ALLEGRO_ALIGN_LEFT, "Loading...");
al_flip_display();
void Progress(struct Game *game, float p) {
al_set_target_bitmap(al_get_backbuffer(game->display));
al_clear_to_color(al_map_rgb(0,0,0));
al_draw_text_with_shadow(game->font, al_map_rgb(255,255,255), game->viewportWidth*0.0234, game->viewportHeight*0.84, ALLEGRO_ALIGN_LEFT, "Loading...");
al_draw_filled_rectangle(0, game->viewportHeight*0.985, game->viewportWidth, game->viewportHeight, al_map_rgba(128,128,128,128));
al_draw_filled_rectangle(0, game->viewportHeight*0.985, p*game->viewportWidth, game->viewportHeight, al_map_rgba(255,255,255,255));
al_flip_display();
}
Progress(game, 0);
Loading_Unload(game);
Loading_Load(game);
Menu_Unload(game);
Menu_Preload(game, NULL);
Level_UnloadBitmaps(game);
Level_PreloadBitmaps(game, NULL);
Level_PreloadBitmaps(game, &Progress);
Pause_Unload_Real(game);
Pause_Preload(game);
Pause_Load(game);