update about screen

This commit is contained in:
Sebastian Krzyszkowiak 2012-04-03 21:17:56 +02:00
parent 37f879c297
commit 26ecdcb532
2 changed files with 50 additions and 18 deletions

View file

@ -22,6 +22,18 @@
#include "about.h"
void About_Draw(struct Game *game) {
//PrintConsole(game, "%d", al_get_sample_instance_position(game->about.music));
if (al_get_sample_instance_position(game->about.music)<700000) { al_clear_to_color(al_map_rgba(0,0,0,0)); return; }
if (game->about.fadeloop>=0) {
al_draw_tinted_bitmap(game->about.fade_bitmap,al_map_rgba_f(game->about.fadeloop/255.0,game->about.fadeloop/255.0,game->about.fadeloop/255.0,1),0,0,0);
game->about.fadeloop+=tps(game, 300);
if (game->about.fadeloop>=256) {
al_destroy_bitmap(game->about.fade_bitmap);
game->about.fadeloop=-1;
}
return;
}
al_draw_scaled_bitmap(game->about.image,0,0,al_get_bitmap_width(game->about.image),al_get_bitmap_height(game->about.image),0,0,al_get_display_width(game->display), al_get_display_height(game->display),0);
al_draw_scaled_bitmap(game->about.letter,0,0,al_get_bitmap_width(game->about.letter),al_get_bitmap_height(game->about.letter),0,0,al_get_display_width(game->display), al_get_display_height(game->display),0);
float x = game->about.x;
@ -37,15 +49,7 @@ void About_Draw(struct Game *game) {
void About_Load(struct Game *game) {
al_play_sample_instance(game->about.music);
ALLEGRO_EVENT ev;
int fadeloop;
for(fadeloop=0; fadeloop<256; fadeloop+=tps(game, 600)){
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);
game->about.fadeloop = 0;
About_Draw(game);
}
@ -67,6 +71,7 @@ void About_Preload(struct Game *game) {
game->about.music = al_create_sample_instance(game->about.sample);
al_attach_sample_instance_to_mixer(game->about.music, game->audio.music);
al_set_sample_instance_playmode(game->about.music, ALLEGRO_PLAYMODE_LOOP);
al_set_sample_instance_position(game->about.music, game->music ? 420000 : 700000);
game->about.font = al_load_ttf_font("data/ShadowsIntoLight.ttf",al_get_display_height(game->display)*0.035,0 );
game->about.x = -0.1;
@ -74,7 +79,7 @@ void About_Preload(struct Game *game) {
fprintf(stderr, "Audio clip sample not loaded!\n" );
exit(-1);
}
game->about.text_bitmap = al_create_bitmap(al_get_display_width(game->display)*0.4, al_get_display_height(game->display)*2.35);
game->about.text_bitmap = al_create_bitmap(al_get_display_width(game->display)*0.4, al_get_display_height(game->display)*3.5);
al_set_target_bitmap(game->about.text_bitmap);
al_clear_to_color(al_map_rgba(0,0,0,0));
al_draw_text(game->about.font, al_map_rgb(255,255,255), 0.5*al_get_bitmap_width(game->about.text_bitmap), 0.015*al_get_bitmap_height(game->about.text_bitmap), ALLEGRO_ALIGN_CENTRE, "Super Derpy: Muffin Attack");
@ -83,24 +88,42 @@ void About_Preload(struct Game *game) {
float y=0.07;
void draw_text(char* text) {
al_draw_text(game->about.font, al_map_rgb(255,255,255), 0, y*al_get_bitmap_height(game->about.text_bitmap), ALLEGRO_ALIGN_LEFT, text);
y+=0.020;
y+=0.0128;
}
draw_text("Written by:");
draw_text(" - Sebastian Krzyszkowiak");
draw_text(" http://dosowisko.net/");
draw_text("");
draw_text("Graphics:");
draw_text(" - hombre0");
draw_text(" http://hombre0.deviantart.com/");
draw_text(" - Siobhan Brewer");
draw_text(" http://boxdrink.deviantart.com/");
draw_text(" - CptOfTheFriendship");
draw_text(" http://cptofthefriendship.deviantart.com/");
draw_text("Animations:");
draw_text(" - Yudhaikeledai");
draw_text(" http://yudhaikeledai.deviantart.com/");
draw_text("");
draw_text("Voices:");
draw_text(" - BaldDumboRat");
draw_text(" Derpy Hooves");
draw_text(" - Meredith Sims");
draw_text(" Twilight Sparkle");
draw_text(" Fluttershy");
draw_text(" - Hnilmik");
draw_text(" Rarity");
draw_text(" - Karen VO");
draw_text(" Applejack");
draw_text(" - MEMJ0123");
draw_text(" Princess Celestia");
draw_text(" - Erica Mendez");
draw_text(" Rainbow Dash");
draw_text(" - Emily Fajardo");
draw_text(" Pinkie Pie");
draw_text("");
draw_text("Original graphics:");
draw_text(" - Anna Karlik");
draw_text("");
draw_text("Music:");
draw_text(" - Dr Dissonance (\"Don Discord\")");
draw_text(" http://dr-dissonance.tumblr.com/");
draw_text(" - Claire Anne Carr (\"A bubbles paradise\")");
draw_text(" http://claireannecarr.bandcamp.com/");
draw_text(" - Dan O'Connor");
draw_text(" http://www.danosongs.com/");
draw_text(" - Kevin MacLeod");
@ -110,6 +133,14 @@ void About_Preload(struct Game *game) {
draw_text(" - Sound Jay");
draw_text(" http://www.soundjay.com/");
draw_text("");
draw_text("Other graphics:");
draw_text(" - hombre0");
draw_text(" http://hombre0.deviantart.com/");
draw_text(" - Siobhan Brewer");
draw_text(" http://boxdrink.deviantart.com/");
draw_text(" - CptOfTheFriendship");
draw_text(" http://cptofthefriendship.deviantart.com/");
draw_text("");
draw_text("Super Derpy: Muffin Attack comes");
draw_text("with ABSOLUTELY NO WARRANTY.");
draw_text("You may redistribute copies of this");

View file

@ -125,6 +125,7 @@ struct About {
ALLEGRO_SAMPLE_INSTANCE *music; /*!< Sample instance with background music. */
ALLEGRO_FONT *font;
float x;
int fadeloop;
};
/*! \brief Resources used by Map state. */