mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2025-02-01 11:06:44 +01:00
add proper text in about view (and optimize png images)
This commit is contained in:
parent
5ce44c0e4e
commit
5b19d2bfbf
4 changed files with 71 additions and 15 deletions
80
src/about.c
80
src/about.c
|
@ -5,11 +5,16 @@
|
||||||
|
|
||||||
void About_Draw(struct Game *game) {
|
void About_Draw(struct Game *game) {
|
||||||
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.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.image),al_get_bitmap_height(game->about.image),0,0,al_get_display_width(game->display), al_get_display_height(game->display),0);
|
||||||
float x = game->about.x;
|
float x = game->about.x;
|
||||||
if (x<0) x=0;
|
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);
|
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);
|
||||||
game->about.x+=0.0005;
|
game->about.x+=0.00025;
|
||||||
if (game->about.x>1) game->about.x=0;
|
if (game->about.x>1) {
|
||||||
|
UnloadGameState(game);
|
||||||
|
game->gamestate = GAMESTATE_LOADING;
|
||||||
|
game->loadstate = GAMESTATE_MENU;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void About_Load(struct Game *game) {
|
void About_Load(struct Game *game) {
|
||||||
|
@ -25,44 +30,94 @@ void About_Load(struct Game *game) {
|
||||||
About_Draw(game);
|
About_Draw(game);
|
||||||
}
|
}
|
||||||
int About_Keydown(struct Game *game, ALLEGRO_EVENT *ev) {
|
int About_Keydown(struct Game *game, ALLEGRO_EVENT *ev) {
|
||||||
//if (ev->keyboard.keycode == ALLEGRO_KEY_ESCAPE) {
|
if (ev->keyboard.keycode == ALLEGRO_KEY_ESCAPE) {
|
||||||
UnloadGameState(game);
|
UnloadGameState(game);
|
||||||
game->gamestate = GAMESTATE_LOADING;
|
game->gamestate = GAMESTATE_LOADING;
|
||||||
game->loadstate = GAMESTATE_MENU;
|
game->loadstate = GAMESTATE_MENU;
|
||||||
return 0;
|
return 0;
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
void About_Preload(struct Game *game) {
|
void About_Preload(struct Game *game) {
|
||||||
game->about.image = al_load_bitmap( "data/table.png" );
|
game->about.image = al_load_bitmap( "data/table.png" );
|
||||||
|
game->about.letter = al_load_bitmap( "data/letter.png" );
|
||||||
game->about.sample = al_load_sample( "data/about.flac" );
|
game->about.sample = al_load_sample( "data/about.flac" );
|
||||||
game->about.font = al_load_ttf_font("data/ShadowsIntoLight.ttf",al_get_display_height(game->display)*0.04,0 );
|
game->about.font = al_load_ttf_font("data/ShadowsIntoLight.ttf",al_get_display_height(game->display)*0.04,0 );
|
||||||
game->about.x = -0.05;
|
game->about.x = -0.1;
|
||||||
if (!game->about.sample){
|
if (!game->about.sample){
|
||||||
fprintf(stderr, "Audio clip sample not loaded!\n" );
|
fprintf(stderr, "Audio clip sample not loaded!\n" );
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
game->about.text_bitmap = al_create_bitmap(al_get_display_width(game->display)*0.4, al_get_display_height(game->display)*2);
|
game->about.text_bitmap = al_create_bitmap(al_get_display_width(game->display)*0.4, al_get_display_height(game->display)*2.3);
|
||||||
al_set_target_bitmap(game->about.text_bitmap);
|
al_set_target_bitmap(game->about.text_bitmap);
|
||||||
al_clear_to_color(al_map_rgba(255,0,0,0.5));
|
//al_clear_to_color(al_map_rgba(255,0,0,0.5));
|
||||||
al_draw_text(game->about.font, al_map_rgb(255,255,255), 0, 0, ALLEGRO_ALIGN_LEFT, "Not implemented yet!");
|
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, 0.2*al_get_bitmap_height(game->about.text_bitmap), ALLEGRO_ALIGN_LEFT, "Still not implemented!");
|
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");
|
||||||
al_draw_text(game->about.font, al_map_rgb(255,255,255), 0, 0.4*al_get_bitmap_height(game->about.text_bitmap), ALLEGRO_ALIGN_LEFT, "Please... leave me alone...");
|
|
||||||
al_draw_text(game->about.font, al_map_rgb(255,255,255), 0, 0.6*al_get_bitmap_height(game->about.text_bitmap), ALLEGRO_ALIGN_LEFT, "I won't be implemented soon!");
|
float y=0.07;
|
||||||
al_draw_text(game->about.font, al_map_rgb(255,255,255), 0, 0.8*al_get_bitmap_height(game->about.text_bitmap), ALLEGRO_ALIGN_LEFT, "Nope, still not implemented!");
|
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("");
|
||||||
|
draw_text("Super Derpy: Muffin Attack is");
|
||||||
|
draw_text("a fan-game, with no-profit intended.");
|
||||||
|
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.");
|
||||||
|
|
||||||
game->about.fade_bitmap = al_create_bitmap(al_get_display_width(game->display), al_get_display_height(game->display));
|
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_set_target_bitmap(game->about.fade_bitmap);
|
||||||
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.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.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_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);
|
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);
|
||||||
|
|
||||||
al_set_target_bitmap(al_get_backbuffer(game->display));
|
al_set_target_bitmap(al_get_backbuffer(game->display));
|
||||||
}
|
}
|
||||||
void About_Unload(struct Game *game) {
|
void About_Unload(struct Game *game) {
|
||||||
|
if (game->about.x<0) game->about.x=0;
|
||||||
ALLEGRO_EVENT ev;
|
ALLEGRO_EVENT ev;
|
||||||
game->about.fade_bitmap = al_create_bitmap(al_get_display_width(game->display), al_get_display_height(game->display));
|
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_set_target_bitmap(game->about.fade_bitmap);
|
||||||
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.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.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_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);
|
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);
|
||||||
al_set_target_bitmap(al_get_backbuffer(game->display));
|
al_set_target_bitmap(al_get_backbuffer(game->display));
|
||||||
for(int fadeloop=255; fadeloop>=0; fadeloop-=10){
|
for(int fadeloop=255; fadeloop>=0; fadeloop-=10){
|
||||||
|
@ -72,6 +127,7 @@ void About_Unload(struct Game *game) {
|
||||||
al_flip_display();
|
al_flip_display();
|
||||||
}
|
}
|
||||||
al_destroy_bitmap(game->about.image);
|
al_destroy_bitmap(game->about.image);
|
||||||
|
al_destroy_bitmap(game->about.letter);
|
||||||
al_destroy_bitmap(game->about.fade_bitmap);
|
al_destroy_bitmap(game->about.fade_bitmap);
|
||||||
al_destroy_bitmap(game->about.text_bitmap);
|
al_destroy_bitmap(game->about.text_bitmap);
|
||||||
al_destroy_sample(game->about.sample);
|
al_destroy_sample(game->about.sample);
|
||||||
|
|
|
@ -9,7 +9,7 @@ void Intro_Draw(struct Game *game) {
|
||||||
al_clear_to_color(al_map_rgb(0,0,0));
|
al_clear_to_color(al_map_rgb(0,0,0));
|
||||||
//printf("%f\n", ((-1*((game->intro.position)%al_get_display_width(game->display)))/(float)al_get_display_width(game->display)));
|
//printf("%f\n", ((-1*((game->intro.position)%al_get_display_width(game->display)))/(float)al_get_display_width(game->display)));
|
||||||
if (game->intro.in_animation)
|
if (game->intro.in_animation)
|
||||||
al_draw_bitmap(game->intro.table, -1*(game->intro.page)*al_get_display_width(game->display) + (cos(((-1*((game->intro.position)%al_get_display_width(game->display)))/(float)al_get_display_width(game->display))*(3.1415))/2.0)*al_get_display_width(game->display) + al_get_display_width(game->display)/2.0, 0, 0);//al_get_display_height(game->display)*((game->intro.position/3.0)/(float)al_get_display_width(game->display)), 0);
|
al_draw_bitmap(game->intro.table, -1*(game->intro.page)*al_get_display_width(game->display) + (cos(((-1*((game->intro.position)%al_get_display_width(game->display)))/(float)al_get_display_width(game->display))*(ALLEGRO_PI))/2.0)*al_get_display_width(game->display) + al_get_display_width(game->display)/2.0, 0, 0);//al_get_display_height(game->display)*((game->intro.position/3.0)/(float)al_get_display_width(game->display)), 0);
|
||||||
else
|
else
|
||||||
al_draw_bitmap(game->intro.table, -1*(game->intro.page)*al_get_display_width(game->display), 0, 0); //al_get_display_height(game->display)*((game->intro.position/3.0)/(float)al_get_display_width(game->display)), 0);
|
al_draw_bitmap(game->intro.table, -1*(game->intro.page)*al_get_display_width(game->display), 0, 0); //al_get_display_height(game->display)*((game->intro.position/3.0)/(float)al_get_display_width(game->display)), 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_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!");
|
||||||
|
|
|
@ -231,7 +231,7 @@ int main(int argc, char **argv){
|
||||||
game.loadstate = GAMESTATE_LOADING;
|
game.loadstate = GAMESTATE_LOADING;
|
||||||
PreloadGameState(&game);
|
PreloadGameState(&game);
|
||||||
LoadGameState(&game);
|
LoadGameState(&game);
|
||||||
game.loadstate = GAMESTATE_ABOUT;
|
game.loadstate = GAMESTATE_MENU;
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
ALLEGRO_EVENT ev;
|
ALLEGRO_EVENT ev;
|
||||||
|
|
|
@ -41,7 +41,7 @@ struct Loading {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct About {
|
struct About {
|
||||||
ALLEGRO_BITMAP *fade_bitmap, *image, *text_bitmap;
|
ALLEGRO_BITMAP *fade_bitmap, *image, *text_bitmap, *letter;
|
||||||
ALLEGRO_SAMPLE *sample;
|
ALLEGRO_SAMPLE *sample;
|
||||||
ALLEGRO_FONT *font;
|
ALLEGRO_FONT *font;
|
||||||
float x;
|
float x;
|
||||||
|
|
Loading…
Reference in a new issue