scale letter bitmap with linear filtering in about screen

This commit is contained in:
Sebastian Krzyszkowiak 2012-03-01 10:54:56 +01:00
parent b7b19b1a8c
commit 72ab5cf3cb
2 changed files with 15 additions and 4 deletions

View file

@ -7,7 +7,7 @@
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.letter),al_get_bitmap_height(game->about.letter),0,0,al_get_display_width(game->display), al_get_display_height(game->display),0); al_draw_scaled_bitmap(game->about.letter_bitmap,0,0,al_get_bitmap_width(game->about.letter_bitmap),al_get_bitmap_height(game->about.letter_bitmap),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);
@ -45,7 +45,10 @@ int About_Keydown(struct Game *game, ALLEGRO_EVENT *ev) {
void About_Preload(struct Game *game) { void About_Preload(struct Game *game) {
game->about.image =LoadFromCache(game, "table.png", al_get_display_width(game->display), al_get_display_height(game->display)); game->about.image =LoadFromCache(game, "table.png", al_get_display_width(game->display), al_get_display_height(game->display));
//game->about.image = al_load_bitmap( "data/table.png" ); //game->about.image = al_load_bitmap( "data/table.png" );
al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP);
game->about.letter = al_load_bitmap( "data/letter.png" ); game->about.letter = al_load_bitmap( "data/letter.png" );
al_set_new_bitmap_flags(ALLEGRO_MAG_LINEAR | ALLEGRO_MIN_LINEAR);
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.035,0 ); game->about.font = al_load_ttf_font("data/ShadowsIntoLight.ttf",al_get_display_height(game->display)*0.035,0 );
game->about.x = -0.1; game->about.x = -0.1;
@ -110,11 +113,18 @@ void About_Preload(struct Game *game) {
draw_text("or its associates."); draw_text("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));
game->about.letter_bitmap = al_create_bitmap(al_get_display_width(game->display), al_get_display_height(game->display));
al_set_target_bitmap(game->about.letter_bitmap);
ScaleBitmap(game->about.letter, al_get_display_width(game->display), al_get_display_height(game->display), 0.75);
al_destroy_bitmap(game->about.letter);
al_set_target_bitmap(game->about.fade_bitmap); al_set_target_bitmap(game->about.fade_bitmap);
al_draw_bitmap(game->about.image, 0, 0, 0); al_draw_bitmap(game->about.image, 0, 0, 0);
al_draw_bitmap(game->about.letter_bitmap, 0, 0, 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.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); //ScaleBitmap(game->about.letter, al_get_display_width(game->display), al_get_display_height(game->display), 0.75);
//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);
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));
@ -126,7 +136,7 @@ void About_Unload(struct Game *game) {
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.letter),al_get_bitmap_height(game->about.letter),0,0,al_get_display_width(game->display), al_get_display_height(game->display),0); al_draw_scaled_bitmap(game->about.letter_bitmap,0,0,al_get_bitmap_width(game->about.letter_bitmap),al_get_bitmap_height(game->about.letter_bitmap),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));
int fadeloop; int fadeloop;
@ -137,7 +147,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.letter_bitmap);
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);

View file

@ -84,6 +84,7 @@ struct About {
ALLEGRO_BITMAP *image; ALLEGRO_BITMAP *image;
ALLEGRO_BITMAP *text_bitmap; ALLEGRO_BITMAP *text_bitmap;
ALLEGRO_BITMAP *letter; ALLEGRO_BITMAP *letter;
ALLEGRO_BITMAP *letter_bitmap;
ALLEGRO_SAMPLE *sample; ALLEGRO_SAMPLE *sample;
ALLEGRO_FONT *font; ALLEGRO_FONT *font;
float x; float x;