mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2024-12-05 00:38:00 +01:00
limit fade-in/out to framerate
This commit is contained in:
parent
371ae9d642
commit
9195ef10d3
2 changed files with 7 additions and 0 deletions
|
@ -3,7 +3,9 @@
|
|||
#include "loading.h"
|
||||
|
||||
void Loading_Draw(struct Game *game) {
|
||||
ALLEGRO_EVENT ev;
|
||||
for(int fadeloop=0; fadeloop<256; fadeloop+=10){
|
||||
al_wait_for_event(game->event_queue, &ev);
|
||||
al_draw_tinted_bitmap(game->loading.loading_bitmap,al_map_rgba_f(fadeloop/255.0,fadeloop/255.0,fadeloop/255.0,1),0,0,0);
|
||||
al_flip_display();
|
||||
}
|
||||
|
@ -13,6 +15,7 @@ void Loading_Draw(struct Game *game) {
|
|||
|
||||
PreloadGameState(game);
|
||||
for(int fadeloop=255; fadeloop>0; fadeloop-=10){
|
||||
al_wait_for_event(game->event_queue, &ev);
|
||||
al_draw_tinted_bitmap(game->loading.loading_bitmap,al_map_rgba_f(fadeloop/255.0,fadeloop/255.0,fadeloop/255.0,1),0,0,0);
|
||||
al_flip_display();
|
||||
}
|
||||
|
|
4
menu.c
4
menu.c
|
@ -62,7 +62,9 @@ void Menu_Preload(struct Game *game) {
|
|||
|
||||
void Menu_Unload(struct Game *game) {
|
||||
al_destroy_sample(game->menu.sample);
|
||||
ALLEGRO_EVENT ev;
|
||||
for(int fadeloop=255; fadeloop>=0; fadeloop-=10){
|
||||
al_wait_for_event(game->event_queue, &ev);
|
||||
al_draw_tinted_bitmap(game->menu.menu_fade_bitmap,al_map_rgba_f(fadeloop/255.0,fadeloop/255.0,fadeloop/255.0,1),0,0,0);
|
||||
al_flip_display();
|
||||
}
|
||||
|
@ -71,7 +73,9 @@ void Menu_Unload(struct Game *game) {
|
|||
|
||||
void Menu_Load(struct Game *game) {
|
||||
al_play_sample(game->menu.sample, 1.0, 0.0, 1.0, ALLEGRO_PLAYMODE_LOOP, NULL);
|
||||
ALLEGRO_EVENT ev;
|
||||
for(int fadeloop=0; fadeloop<256; fadeloop+=10){
|
||||
al_wait_for_event(game->event_queue, &ev);
|
||||
al_draw_tinted_bitmap(game->menu.menu_fade_bitmap,al_map_rgba_f(fadeloop/255.0,fadeloop/255.0,fadeloop/255.0,1),0,0,0);
|
||||
al_flip_display();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue