mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2025-02-01 11:06:44 +01:00
little bit of work on about screen
This commit is contained in:
parent
1f8250972d
commit
ba0ebf83fa
2 changed files with 48 additions and 10 deletions
53
about.c
53
about.c
|
@ -4,16 +4,49 @@
|
|||
|
||||
void About_Draw(struct Game *game) {
|
||||
al_clear_to_color(al_map_rgb(0,0,0));
|
||||
al_draw_bitmap(game->about.image, 0, 0, 0);
|
||||
al_draw_text(game->font, al_map_rgb(255,255,255), al_get_display_width(game->display)/2, al_get_display_height(game->display)/2, ALLEGRO_ALIGN_CENTRE, "Not implemented yet!");
|
||||
DrawConsole(game);
|
||||
al_flip_display();
|
||||
al_rest(5.0);
|
||||
UnloadGameState(game);
|
||||
game->gamestate = GAMESTATE_LOADING;
|
||||
game->loadstate = GAMESTATE_MENU;
|
||||
}
|
||||
|
||||
void About_Load(struct Game *game) {}
|
||||
int About_Keydown(struct Game *game, ALLEGRO_EVENT *ev) { return 0; }
|
||||
void About_Preload(struct Game *game) {}
|
||||
void About_Unload(struct Game *game) {}
|
||||
void About_Load(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->about.fade_bitmap,al_map_rgba_f(fadeloop/255.0,fadeloop/255.0,fadeloop/255.0,1),0,0,0);
|
||||
DrawConsole(game);
|
||||
al_flip_display();
|
||||
}
|
||||
al_destroy_bitmap(game->about.fade_bitmap);
|
||||
}
|
||||
int About_Keydown(struct Game *game, ALLEGRO_EVENT *ev) {
|
||||
if (ev->keyboard.keycode == ALLEGRO_KEY_ESCAPE) {
|
||||
UnloadGameState(game);
|
||||
game->gamestate = GAMESTATE_LOADING;
|
||||
game->loadstate = GAMESTATE_MENU;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
void About_Preload(struct Game *game) {
|
||||
game->about.image = al_load_bitmap( "table.png" );
|
||||
game->about.fade_bitmap = al_create_bitmap(al_get_display_width(game->display), al_get_display_height(game->display));
|
||||
al_set_target_bitmap(game->about.fade_bitmap);
|
||||
al_draw_bitmap(game->about.image,0,0,0);
|
||||
al_draw_text(game->font, al_map_rgb(255,255,255), al_get_display_width(game->display)/2, al_get_display_height(game->display)/2, ALLEGRO_ALIGN_CENTRE, "Not implemented yet!");
|
||||
al_set_target_bitmap(al_get_backbuffer(game->display));
|
||||
}
|
||||
void About_Unload(struct Game *game) {
|
||||
ALLEGRO_EVENT ev;
|
||||
game->about.fade_bitmap = al_create_bitmap(al_get_display_width(game->display), al_get_display_height(game->display));
|
||||
al_set_target_bitmap(game->about.fade_bitmap);
|
||||
al_draw_bitmap(game->about.image,0,0,0);
|
||||
al_draw_text(game->font, al_map_rgb(255,255,255), al_get_display_width(game->display)/2, al_get_display_height(game->display)/2, ALLEGRO_ALIGN_CENTRE, "Not implemented yet!");
|
||||
al_set_target_bitmap(al_get_backbuffer(game->display));
|
||||
for(int fadeloop=255; fadeloop>=0; fadeloop-=10){
|
||||
al_wait_for_event(game->event_queue, &ev);
|
||||
al_draw_tinted_bitmap(game->about.fade_bitmap, al_map_rgba_f(fadeloop/255.0,fadeloop/255.0,fadeloop/255.0,1), 0, 0, 0);
|
||||
DrawConsole(game);
|
||||
al_flip_display();
|
||||
}
|
||||
al_destroy_bitmap(game->about.image);
|
||||
al_destroy_bitmap(game->about.fade_bitmap);
|
||||
}
|
||||
|
|
5
main.h
5
main.h
|
@ -33,6 +33,10 @@ struct Loading {
|
|||
ALLEGRO_BITMAP *loading_bitmap, *image;
|
||||
};
|
||||
|
||||
struct About {
|
||||
ALLEGRO_BITMAP *fade_bitmap, *image;
|
||||
};
|
||||
|
||||
struct Intro {
|
||||
int position;
|
||||
int page;
|
||||
|
@ -53,6 +57,7 @@ struct Game {
|
|||
struct Menu menu;
|
||||
struct Loading loading;
|
||||
struct Intro intro;
|
||||
struct About about;
|
||||
};
|
||||
|
||||
void PreloadGameState(struct Game *game);
|
||||
|
|
Loading…
Reference in a new issue