2012-02-19 20:18:28 +01:00
|
|
|
#include <stdio.h>
|
2012-02-17 00:19:21 +01:00
|
|
|
#include "about.h"
|
|
|
|
|
|
|
|
void About_Draw(struct Game *game) {
|
2012-02-18 07:47:24 +01:00
|
|
|
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);
|
2012-02-24 23:58:18 +01:00
|
|
|
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);
|
2012-02-22 13:38:56 +01:00
|
|
|
float x = game->about.x;
|
|
|
|
if (x<0) x=0;
|
|
|
|
al_draw_bitmap_region(game->about.text_bitmap, 0, x*al_get_bitmap_height(game->about.text_bitmap), al_get_bitmap_width(game->about.text_bitmap), al_get_display_height(game->display)*0.8, al_get_display_width(game->display)*0.5, al_get_display_height(game->display)*0.1, 0);
|
2012-02-22 14:55:21 +01:00
|
|
|
game->about.x+=0.00025;
|
2012-02-25 22:26:31 +01:00
|
|
|
if (game->about.x>1) {
|
2012-02-22 14:55:21 +01:00
|
|
|
UnloadGameState(game);
|
|
|
|
game->gamestate = GAMESTATE_LOADING;
|
|
|
|
game->loadstate = GAMESTATE_MENU;
|
|
|
|
}
|
2012-02-17 00:19:21 +01:00
|
|
|
}
|
|
|
|
|
2012-02-18 06:26:58 +01:00
|
|
|
void About_Load(struct Game *game) {
|
2012-02-19 20:18:28 +01:00
|
|
|
al_play_sample(game->about.sample, 1.0, 0.0, 1.0, ALLEGRO_PLAYMODE_LOOP, NULL);
|
2012-02-18 06:26:58 +01:00
|
|
|
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);
|
2012-02-19 22:20:05 +01:00
|
|
|
About_Draw(game);
|
2012-02-18 06:26:58 +01:00
|
|
|
}
|
2012-02-25 22:26:31 +01:00
|
|
|
|
2012-02-18 06:26:58 +01:00
|
|
|
int About_Keydown(struct Game *game, ALLEGRO_EVENT *ev) {
|
2012-02-22 14:55:21 +01:00
|
|
|
if (ev->keyboard.keycode == ALLEGRO_KEY_ESCAPE) {
|
2012-02-18 06:26:58 +01:00
|
|
|
UnloadGameState(game);
|
|
|
|
game->gamestate = GAMESTATE_LOADING;
|
|
|
|
game->loadstate = GAMESTATE_MENU;
|
2012-02-22 14:55:21 +01:00
|
|
|
}
|
2012-02-22 15:21:28 +01:00
|
|
|
return 0;
|
2012-02-18 06:26:58 +01:00
|
|
|
}
|
2012-02-25 22:26:31 +01:00
|
|
|
|
2012-02-18 06:26:58 +01:00
|
|
|
void About_Preload(struct Game *game) {
|
2012-02-19 18:10:08 +01:00
|
|
|
game->about.image = al_load_bitmap( "data/table.png" );
|
2012-02-22 14:55:21 +01:00
|
|
|
game->about.letter = al_load_bitmap( "data/letter.png" );
|
2012-02-19 20:18:28 +01:00
|
|
|
game->about.sample = al_load_sample( "data/about.flac" );
|
2012-02-22 13:38:56 +01:00
|
|
|
game->about.font = al_load_ttf_font("data/ShadowsIntoLight.ttf",al_get_display_height(game->display)*0.04,0 );
|
2012-02-22 14:55:21 +01:00
|
|
|
game->about.x = -0.1;
|
2012-02-19 20:18:28 +01:00
|
|
|
if (!game->about.sample){
|
|
|
|
fprintf(stderr, "Audio clip sample not loaded!\n" );
|
|
|
|
exit(-1);
|
|
|
|
}
|
2012-02-22 14:55:21 +01:00
|
|
|
game->about.text_bitmap = al_create_bitmap(al_get_display_width(game->display)*0.4, al_get_display_height(game->display)*2.3);
|
2012-02-22 13:38:56 +01:00
|
|
|
al_set_target_bitmap(game->about.text_bitmap);
|
2012-02-22 15:30:17 +01:00
|
|
|
al_clear_to_color(al_map_rgba(0,0,0,0));
|
2012-02-22 14:55:21 +01:00
|
|
|
al_draw_text(game->about.font, al_map_rgb(255,255,255), 0.5*al_get_bitmap_width(game->about.text_bitmap), 0.02*al_get_bitmap_height(game->about.text_bitmap), ALLEGRO_ALIGN_CENTRE, "Super Derpy: Muffin Attack");
|
|
|
|
al_draw_text(game->about.font, al_map_rgb(255,255,255), 0.5*al_get_bitmap_width(game->about.text_bitmap), 0.05*al_get_bitmap_height(game->about.text_bitmap), ALLEGRO_ALIGN_CENTRE, "Version 0.1");
|
|
|
|
|
|
|
|
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.022;
|
|
|
|
}
|
|
|
|
|
|
|
|
draw_text("Written by:");
|
|
|
|
draw_text(" - Sebastian Krzyszkowiak");
|
|
|
|
draw_text(" http://dosowisko.net/");
|
|
|
|
draw_text("");
|
|
|
|
draw_text("Graphics:");
|
|
|
|
draw_text(" - hombre0 (menu background)");
|
|
|
|
draw_text(" http://hombre0.deviantart.com/");
|
|
|
|
draw_text(" - Siobhan Brewer (cloud shapes)");
|
|
|
|
draw_text(" http://boxdrink.deviantart.com/");
|
|
|
|
draw_text("");
|
|
|
|
draw_text("Music:");
|
|
|
|
draw_text(" - Dr Dissonance (\"Don Discord\")");
|
|
|
|
draw_text(" http://dr-dissonance.tumblr.com/");
|
|
|
|
draw_text(" - Dan O'Connor");
|
|
|
|
draw_text(" http://www.danosongs.com/");
|
|
|
|
draw_text(" - Kevin MacLeod");
|
|
|
|
draw_text(" http://incompetech.com/");
|
|
|
|
draw_text("");
|
|
|
|
draw_text("Sounds:");
|
|
|
|
draw_text(" - Sound Jay");
|
|
|
|
draw_text(" http://www.soundjay.com/");
|
|
|
|
draw_text("");
|
|
|
|
draw_text("Super Derpy: Muffin Attack comes");
|
|
|
|
draw_text("with ABSOLUTELY NO WARRANTY.");
|
|
|
|
draw_text("You may redistribute copies of this");
|
|
|
|
draw_text("game under the terms of");
|
|
|
|
draw_text("GNU General Public License.");
|
|
|
|
draw_text("For more information, see the file");
|
|
|
|
draw_text("named COPYING.");
|
|
|
|
draw_text("");
|
2012-02-23 12:04:51 +01:00
|
|
|
draw_text("Super Derpy: Muffin Attack is a");
|
|
|
|
draw_text("fan-made game with no profit intended.");
|
2012-02-22 14:55:21 +01:00
|
|
|
draw_text("Its author is unpaid volunteer and");
|
|
|
|
draw_text("doesn't receive any economical profit");
|
|
|
|
draw_text("from it.");
|
|
|
|
draw_text("");
|
|
|
|
draw_text("My Little Pony: Friendship is Magic™");
|
|
|
|
draw_text("is copyrighted trademark owned");
|
|
|
|
draw_text("by Hasbro.");
|
|
|
|
draw_text("");
|
|
|
|
draw_text("Author of Super Derpy is not affiliated");
|
|
|
|
draw_text("to Hasbro, The Hub or its associates.");
|
2012-02-22 13:38:56 +01:00
|
|
|
|
2012-02-18 06:26:58 +01:00
|
|
|
game->about.fade_bitmap = al_create_bitmap(al_get_display_width(game->display), al_get_display_height(game->display));
|
2012-02-22 13:38:56 +01:00
|
|
|
|
2012-02-18 06:26:58 +01:00
|
|
|
al_set_target_bitmap(game->about.fade_bitmap);
|
2012-02-18 07:47:24 +01:00
|
|
|
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);
|
2012-02-24 23:58:18 +01:00
|
|
|
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);
|
2012-02-22 13:38:56 +01:00
|
|
|
al_draw_bitmap_region(game->about.text_bitmap, 0, 0, al_get_bitmap_width(game->about.text_bitmap), al_get_display_height(game->display)*0.8, al_get_display_width(game->display)*0.5, al_get_display_height(game->display)*0.1, 0);
|
|
|
|
|
2012-02-18 06:26:58 +01:00
|
|
|
al_set_target_bitmap(al_get_backbuffer(game->display));
|
|
|
|
}
|
2012-02-25 22:26:31 +01:00
|
|
|
|
2012-02-18 06:26:58 +01:00
|
|
|
void About_Unload(struct Game *game) {
|
2012-02-22 14:55:21 +01:00
|
|
|
if (game->about.x<0) game->about.x=0;
|
2012-02-18 06:26:58 +01:00
|
|
|
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);
|
2012-02-18 07:47:24 +01:00
|
|
|
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);
|
2012-02-24 23:58:18 +01:00
|
|
|
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);
|
2012-02-22 13:38:56 +01:00
|
|
|
al_draw_bitmap_region(game->about.text_bitmap, 0, game->about.x*al_get_bitmap_height(game->about.text_bitmap), al_get_bitmap_width(game->about.text_bitmap), al_get_display_height(game->display)*0.8, al_get_display_width(game->display)*0.5, al_get_display_height(game->display)*0.1, 0);
|
2012-02-18 06:26:58 +01:00
|
|
|
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);
|
2012-02-22 14:55:21 +01:00
|
|
|
al_destroy_bitmap(game->about.letter);
|
2012-02-18 06:26:58 +01:00
|
|
|
al_destroy_bitmap(game->about.fade_bitmap);
|
2012-02-22 13:38:56 +01:00
|
|
|
al_destroy_bitmap(game->about.text_bitmap);
|
2012-02-19 20:18:28 +01:00
|
|
|
al_destroy_sample(game->about.sample);
|
2012-02-22 13:38:56 +01:00
|
|
|
al_destroy_font(game->about.font);
|
2012-02-18 06:26:58 +01:00
|
|
|
}
|