mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2025-02-01 11:06:44 +01:00
letterbox implementation is now complete and enabled by default
This commit is contained in:
parent
219fc714db
commit
0ec111c197
14 changed files with 228 additions and 211 deletions
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by Qt Creator 2.5.81, 2012-07-13T13:49:15. -->
|
||||
<!-- Written by Qt Creator 2.5.81, 2012-08-04T20:19:15. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>GenericProjectManager.GenericProject.Toolchain</variable>
|
||||
|
|
32
src/about.c
32
src/about.c
|
@ -35,13 +35,13 @@ void About_Draw(struct Game *game) {
|
|||
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_bitmap(game->about.letter, al_get_display_width(game->display)*0.3, -al_get_display_height(game->display)*0.1, 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,game->viewportWidth, game->viewportHeight,0);
|
||||
al_draw_bitmap(game->about.letter, game->viewportWidth*0.3, -game->viewportHeight*0.1, 0);
|
||||
float x = game->about.x;
|
||||
if (x<0) x=0;
|
||||
ALLEGRO_BITMAP* subbitmap;
|
||||
subbitmap = al_create_sub_bitmap(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));
|
||||
al_draw_rotated_bitmap(subbitmap, al_get_bitmap_width(subbitmap)/2.0, al_get_bitmap_height(subbitmap)/2.0, al_get_display_width(game->display)*0.5+al_get_bitmap_width(subbitmap)/2.0, al_get_display_height(game->display)*0.1+al_get_bitmap_height(subbitmap)/2.0, -0.11, 0);
|
||||
subbitmap = al_create_sub_bitmap(game->about.text_bitmap, 0, x*al_get_bitmap_height(game->about.text_bitmap), al_get_bitmap_width(game->about.text_bitmap), game->viewportHeight);
|
||||
al_draw_rotated_bitmap(subbitmap, al_get_bitmap_width(subbitmap)/2.0, al_get_bitmap_height(subbitmap)/2.0, game->viewportWidth*0.5+al_get_bitmap_width(subbitmap)/2.0, game->viewportHeight*0.1+al_get_bitmap_height(subbitmap)/2.0, -0.11, 0);
|
||||
al_destroy_bitmap(subbitmap);
|
||||
game->about.x+=tps(game, 60*0.00025);
|
||||
if (game->about.x>1) {
|
||||
|
@ -69,9 +69,9 @@ int About_Keydown(struct Game *game, ALLEGRO_EVENT *ev) {
|
|||
void About_Preload(struct Game *game, void (*progress)(struct Game*, float)) {
|
||||
PROGRESS_INIT(6);
|
||||
|
||||
game->about.image =LoadScaledBitmap("table.png", al_get_display_width(game->display), al_get_display_height(game->display));
|
||||
game->about.image =LoadScaledBitmap("table.png", game->viewportWidth, game->viewportHeight);
|
||||
PROGRESS;
|
||||
game->about.letter = LoadScaledBitmap("about/letter.png", al_get_display_height(game->display)*1.3, al_get_display_height(game->display)*1.3 );
|
||||
game->about.letter = LoadScaledBitmap("about/letter.png", game->viewportHeight*1.3, game->viewportHeight*1.3 );
|
||||
PROGRESS;
|
||||
|
||||
game->about.sample = al_load_sample( "data/about/about.flac" );
|
||||
|
@ -82,14 +82,14 @@ void About_Preload(struct Game *game, void (*progress)(struct Game*, float)) {
|
|||
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.font = al_load_ttf_font("data/ShadowsIntoLight.ttf",game->viewportHeight*0.035,0 );
|
||||
PROGRESS;
|
||||
game->about.x = -0.1;
|
||||
if (!game->about.sample){
|
||||
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)*3.225);
|
||||
game->about.text_bitmap = al_create_bitmap(game->viewportWidth*0.4, game->viewportHeight*3.225);
|
||||
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(0,0,0), 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");
|
||||
|
@ -183,14 +183,14 @@ void About_Preload(struct Game *game, void (*progress)(struct Game*, float)) {
|
|||
draw_text("http://www.superderpy.com/");
|
||||
PROGRESS;
|
||||
|
||||
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(game->viewportWidth, game->viewportHeight);
|
||||
|
||||
al_set_target_bitmap(game->about.fade_bitmap);
|
||||
al_draw_bitmap(game->about.image, 0, 0, 0);
|
||||
al_draw_bitmap(game->about.letter, al_get_display_width(game->display)*0.3, -al_get_display_height(game->display)*0.1, 0);
|
||||
al_draw_bitmap(game->about.letter, game->viewportWidth*0.3, -game->viewportHeight*0.1, 0);
|
||||
ALLEGRO_BITMAP* subbitmap;
|
||||
subbitmap = al_create_sub_bitmap(game->about.text_bitmap, 0, 0, al_get_bitmap_width(game->about.text_bitmap), al_get_display_height(game->display));
|
||||
al_draw_rotated_bitmap(subbitmap, al_get_bitmap_width(subbitmap)/2.0, al_get_bitmap_height(subbitmap)/2.0, al_get_display_width(game->display)*0.5+al_get_bitmap_width(subbitmap)/2.0, al_get_display_height(game->display)*0.1+al_get_bitmap_height(subbitmap)/2.0, -0.11, 0);
|
||||
subbitmap = al_create_sub_bitmap(game->about.text_bitmap, 0, 0, al_get_bitmap_width(game->about.text_bitmap), game->viewportHeight);
|
||||
al_draw_rotated_bitmap(subbitmap, al_get_bitmap_width(subbitmap)/2.0, al_get_bitmap_height(subbitmap)/2.0, game->viewportWidth*0.5+al_get_bitmap_width(subbitmap)/2.0, game->viewportHeight*0.1+al_get_bitmap_height(subbitmap)/2.0, -0.11, 0);
|
||||
al_destroy_bitmap(subbitmap);
|
||||
|
||||
al_set_target_bitmap(al_get_backbuffer(game->display));
|
||||
|
@ -200,14 +200,14 @@ void About_Preload(struct Game *game, void (*progress)(struct Game*, float)) {
|
|||
void About_Unload(struct Game *game) {
|
||||
if (game->about.x<0) game->about.x=0;
|
||||
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(game->viewportWidth, game->viewportHeight);
|
||||
al_set_target_bitmap(game->about.fade_bitmap);
|
||||
al_draw_bitmap(game->about.image,0,0,0);
|
||||
al_draw_bitmap(game->about.letter, al_get_display_width(game->display)*0.3, -al_get_display_height(game->display)*0.1, 0);
|
||||
al_draw_bitmap(game->about.letter, game->viewportWidth*0.3, -game->viewportHeight*0.1, 0);
|
||||
|
||||
ALLEGRO_BITMAP* subbitmap;
|
||||
subbitmap = al_create_sub_bitmap(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));
|
||||
al_draw_rotated_bitmap(subbitmap, al_get_bitmap_width(subbitmap)/2.0, al_get_bitmap_height(subbitmap)/2.0, al_get_display_width(game->display)*0.5+al_get_bitmap_width(subbitmap)/2.0, al_get_display_height(game->display)*0.1+al_get_bitmap_height(subbitmap)/2.0, -0.11, 0);
|
||||
subbitmap = al_create_sub_bitmap(game->about.text_bitmap, 0, game->about.x*al_get_bitmap_height(game->about.text_bitmap), al_get_bitmap_width(game->about.text_bitmap), game->viewportHeight);
|
||||
al_draw_rotated_bitmap(subbitmap, al_get_bitmap_width(subbitmap)/2.0, al_get_bitmap_height(subbitmap)/2.0, game->viewportWidth*0.5+al_get_bitmap_width(subbitmap)/2.0, game->viewportHeight*0.1+al_get_bitmap_height(subbitmap)/2.0, -0.11, 0);
|
||||
al_destroy_bitmap(subbitmap);
|
||||
al_set_target_bitmap(al_get_backbuffer(game->display));
|
||||
float fadeloop;
|
||||
|
|
|
@ -25,11 +25,11 @@
|
|||
|
||||
void Disclaimer_Draw(struct Game *game) {
|
||||
al_clear_to_color(al_map_rgb(0,0,0));
|
||||
al_draw_text_with_shadow(game->menu.font_selected, al_map_rgb(255,255,255), al_get_display_width(game->display)/2, al_get_display_height(game->display)*0.3, ALLEGRO_ALIGN_CENTRE, "This is an early development preview of the game.");
|
||||
al_draw_text_with_shadow(game->menu.font_selected, al_map_rgb(255,255,255), al_get_display_width(game->display)/2, al_get_display_height(game->display)*0.4, ALLEGRO_ALIGN_CENTRE, "It's not supposed to be complete!");
|
||||
al_draw_text_with_shadow(game->menu.font_selected, al_map_rgb(255,255,255), al_get_display_width(game->display)/2, al_get_display_height(game->display)*0.5, ALLEGRO_ALIGN_CENTRE, "Keep in mind that everything may be changed");
|
||||
al_draw_text_with_shadow(game->menu.font_selected, al_map_rgb(255,255,255), al_get_display_width(game->display)/2, al_get_display_height(game->display)*0.6, ALLEGRO_ALIGN_CENTRE, "and many things surely will change.");
|
||||
al_draw_text_with_shadow(game->menu.font, al_map_rgb(255,255,255), al_get_display_width(game->display)/2, al_get_display_height(game->display)*0.9, ALLEGRO_ALIGN_CENTRE, "Press any key to continue...");
|
||||
al_draw_text_with_shadow(game->menu.font_selected, al_map_rgb(255,255,255), game->viewportWidth/2, game->viewportHeight*0.3, ALLEGRO_ALIGN_CENTRE, "This is an early development preview of the game.");
|
||||
al_draw_text_with_shadow(game->menu.font_selected, al_map_rgb(255,255,255), game->viewportWidth/2, game->viewportHeight*0.4, ALLEGRO_ALIGN_CENTRE, "It's not supposed to be complete!");
|
||||
al_draw_text_with_shadow(game->menu.font_selected, al_map_rgb(255,255,255), game->viewportWidth/2, game->viewportHeight*0.5, ALLEGRO_ALIGN_CENTRE, "Keep in mind that everything may be changed");
|
||||
al_draw_text_with_shadow(game->menu.font_selected, al_map_rgb(255,255,255), game->viewportWidth/2, game->viewportHeight*0.6, ALLEGRO_ALIGN_CENTRE, "and many things surely will change.");
|
||||
al_draw_text_with_shadow(game->menu.font, al_map_rgb(255,255,255), game->viewportWidth/2, game->viewportHeight*0.9, ALLEGRO_ALIGN_CENTRE, "Press any key to continue...");
|
||||
}
|
||||
|
||||
void Disclaimer_Load(struct Game *game) {
|
||||
|
@ -38,7 +38,7 @@ void Disclaimer_Load(struct Game *game) {
|
|||
for (fadeloop=255; fadeloop>0; fadeloop-=tps(game, 600)) {
|
||||
al_wait_for_event(game->event_queue, &ev);
|
||||
Disclaimer_Draw(game);
|
||||
al_draw_filled_rectangle(0,0,al_get_display_width(game->display),al_get_display_height(game->display),al_map_rgba(0,0,0,fadeloop));
|
||||
al_draw_filled_rectangle(0,0,game->viewportWidth,game->viewportHeight,al_map_rgba(0,0,0,fadeloop));
|
||||
DrawConsole(game);
|
||||
al_flip_display();
|
||||
}
|
||||
|
@ -54,8 +54,8 @@ int Disclaimer_Keydown(struct Game *game, ALLEGRO_EVENT *ev) {
|
|||
|
||||
void Disclaimer_Preload(struct Game *game, void (*progress)(struct Game*, float)) {
|
||||
if (!game->menu.loaded) {
|
||||
game->menu.font = al_load_ttf_font("data/ShadowsIntoLight.ttf",al_get_display_height(game->display)*0.05,0 );
|
||||
game->menu.font_selected = al_load_ttf_font("data/ShadowsIntoLight.ttf",al_get_display_height(game->display)*0.065,0 );
|
||||
game->menu.font = al_load_ttf_font("data/ShadowsIntoLight.ttf",game->viewportHeight*0.05,0 );
|
||||
game->menu.font_selected = al_load_ttf_font("data/ShadowsIntoLight.ttf",game->viewportHeight*0.065,0 );
|
||||
}
|
||||
PrintConsole(game, "Preloading GAMESTATE_INTRO...");
|
||||
Intro_Preload(game, progress);
|
||||
|
@ -67,7 +67,7 @@ void Disclaimer_Unload(struct Game *game) {
|
|||
for (fadeloop=0; fadeloop<256; fadeloop+=tps(game, 600)) {
|
||||
al_wait_for_event(game->event_queue, &ev);
|
||||
Disclaimer_Draw(game);
|
||||
al_draw_filled_rectangle(0,0,al_get_display_width(game->display),al_get_display_height(game->display),al_map_rgba(0,0,0,fadeloop));
|
||||
al_draw_filled_rectangle(0,0,game->viewportWidth,game->viewportHeight,al_map_rgba(0,0,0,fadeloop));
|
||||
DrawConsole(game);
|
||||
al_flip_display();
|
||||
}
|
||||
|
|
60
src/intro.c
60
src/intro.c
|
@ -25,7 +25,7 @@
|
|||
|
||||
void AnimPage(struct Game *game, int page, ALLEGRO_COLOR tint) {
|
||||
int offset = 0;
|
||||
if (game->intro.in_animation) offset = -1*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;
|
||||
if (game->intro.in_animation) offset = -1*game->viewportWidth + (cos(((-1*((game->intro.position)%game->viewportWidth))/(float)game->viewportWidth)*(ALLEGRO_PI))/2.0)*game->viewportWidth + game->viewportWidth/2.0;
|
||||
|
||||
int amount1 = 2, amount2 = 2;
|
||||
float anim = game->intro.anim;
|
||||
|
@ -34,7 +34,7 @@ void AnimPage(struct Game *game, int page, ALLEGRO_COLOR tint) {
|
|||
if (page==3) { amount1=3; amount2=3; }
|
||||
if (page==5) { amount1=5; amount2=3; anim*=2; }
|
||||
|
||||
if (page<6) al_draw_tinted_bitmap_region(game->intro.animsprites[page-1],tint,al_get_display_width(game->display)*0.3125*(int)fmod(anim,amount1),al_get_display_height(game->display)*0.63*(((int)(anim/amount1))%amount2),al_get_display_width(game->display)*0.3125, al_get_display_height(game->display)*0.63,offset+al_get_display_width(game->display)*0.08, al_get_display_height(game->display)*0.18,0);
|
||||
if (page<6) al_draw_tinted_bitmap_region(game->intro.animsprites[page-1],tint,game->viewportWidth*0.3125*(int)fmod(anim,amount1),game->viewportHeight*0.63*(((int)(anim/amount1))%amount2),game->viewportWidth*0.3125, game->viewportHeight*0.63,offset+game->viewportWidth*0.08, game->viewportHeight*0.18,0);
|
||||
|
||||
amount1 = 2;
|
||||
amount2 = 2;
|
||||
|
@ -42,7 +42,7 @@ void AnimPage(struct Game *game, int page, ALLEGRO_COLOR tint) {
|
|||
if (page==2) { amount1=3; amount2=3; }
|
||||
if (page==4) { amount1=5; amount2=3; anim*=2; }
|
||||
|
||||
if (page<5) al_draw_tinted_bitmap_region(game->intro.animsprites[page],tint,al_get_display_width(game->display)*0.3125*(int)fmod(anim,amount1),al_get_display_height(game->display)*0.63*(((int)(anim/amount1))%amount2),al_get_display_width(game->display)*0.3125, al_get_display_height(game->display)*0.63,offset+al_get_display_width(game->display)*1.08, al_get_display_height(game->display)*0.18,0);
|
||||
if (page<5) al_draw_tinted_bitmap_region(game->intro.animsprites[page],tint,game->viewportWidth*0.3125*(int)fmod(anim,amount1),game->viewportHeight*0.63*(((int)(anim/amount1))%amount2),game->viewportWidth*0.3125, game->viewportHeight*0.63,offset+game->viewportWidth*1.08, game->viewportHeight*0.18,0);
|
||||
|
||||
game->intro.anim += tps(game, 2);
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ void FillPage(struct Game *game, int page) {
|
|||
void draw_text(int page, char* text) {
|
||||
float x = 0.45;
|
||||
if (page!=oldx) { y=0.2; oldx=page; }
|
||||
al_draw_text_with_shadow(game->intro.font, al_map_rgb(255,255,255), al_get_display_width(game->display)*x, al_get_display_height(game->display)*y, ALLEGRO_ALIGN_LEFT, text);
|
||||
al_draw_text_with_shadow(game->intro.font, al_map_rgb(255,255,255), game->viewportWidth*x, game->viewportHeight*y, ALLEGRO_ALIGN_LEFT, text);
|
||||
y+=0.07;
|
||||
}
|
||||
|
||||
|
@ -79,8 +79,8 @@ void FillPage(struct Game *game, int page) {
|
|||
al_hold_bitmap_drawing(false);
|
||||
break;
|
||||
case 2:
|
||||
al_draw_bitmap_region(game->intro.table_bitmap, al_get_bitmap_width(game->intro.table_bitmap)/2, 0, al_get_bitmap_width(game->intro.table_bitmap)/2, al_get_bitmap_height(game->intro.table_bitmap), al_get_display_width(game->display)*0, 0, 0);
|
||||
al_draw_bitmap_region(game->intro.table_bitmap, al_get_bitmap_width(game->intro.table_bitmap)/2, 0, al_get_bitmap_width(game->intro.table_bitmap)/2, al_get_bitmap_height(game->intro.table_bitmap), al_get_display_width(game->display)*0.5, 0, 0);
|
||||
al_draw_bitmap_region(game->intro.table_bitmap, al_get_bitmap_width(game->intro.table_bitmap)/2, 0, al_get_bitmap_width(game->intro.table_bitmap)/2, al_get_bitmap_height(game->intro.table_bitmap), game->viewportWidth*0, 0, 0);
|
||||
al_draw_bitmap_region(game->intro.table_bitmap, al_get_bitmap_width(game->intro.table_bitmap)/2, 0, al_get_bitmap_width(game->intro.table_bitmap)/2, al_get_bitmap_height(game->intro.table_bitmap), game->viewportWidth*0.5, 0, 0);
|
||||
al_hold_bitmap_drawing(false);
|
||||
al_hold_bitmap_drawing(true);
|
||||
draw_text(2, "Until one day a reckless pony caused");
|
||||
|
@ -90,8 +90,8 @@ void FillPage(struct Game *game, int page) {
|
|||
break;
|
||||
case 3:
|
||||
al_hold_bitmap_drawing(true);
|
||||
al_draw_bitmap_region(game->intro.table_bitmap, al_get_bitmap_width(game->intro.table_bitmap)/2, 0, al_get_bitmap_width(game->intro.table_bitmap)/2, al_get_bitmap_height(game->intro.table_bitmap), al_get_display_width(game->display)*0, 0, 0);
|
||||
al_draw_bitmap_region(game->intro.table_bitmap, al_get_bitmap_width(game->intro.table_bitmap)/2, 0, al_get_bitmap_width(game->intro.table_bitmap)/2, al_get_bitmap_height(game->intro.table_bitmap), al_get_display_width(game->display)*0.5, 0, 0);
|
||||
al_draw_bitmap_region(game->intro.table_bitmap, al_get_bitmap_width(game->intro.table_bitmap)/2, 0, al_get_bitmap_width(game->intro.table_bitmap)/2, al_get_bitmap_height(game->intro.table_bitmap), game->viewportWidth*0, 0, 0);
|
||||
al_draw_bitmap_region(game->intro.table_bitmap, al_get_bitmap_width(game->intro.table_bitmap)/2, 0, al_get_bitmap_width(game->intro.table_bitmap)/2, al_get_bitmap_height(game->intro.table_bitmap), game->viewportWidth*0.5, 0, 0);
|
||||
al_hold_bitmap_drawing(false);
|
||||
al_hold_bitmap_drawing(true);
|
||||
draw_text(3, "This small amount of chaos was not");
|
||||
|
@ -103,8 +103,8 @@ void FillPage(struct Game *game, int page) {
|
|||
break;
|
||||
case 4:
|
||||
al_hold_bitmap_drawing(true);
|
||||
al_draw_bitmap_region(game->intro.table_bitmap, al_get_bitmap_width(game->intro.table_bitmap)/2, 0, al_get_bitmap_width(game->intro.table_bitmap)/2, al_get_bitmap_height(game->intro.table_bitmap), al_get_display_width(game->display)*0, 0, 0);
|
||||
al_draw_bitmap_region(game->intro.table_bitmap, al_get_bitmap_width(game->intro.table_bitmap)/2, 0, al_get_bitmap_width(game->intro.table_bitmap)/2, al_get_bitmap_height(game->intro.table_bitmap), al_get_display_width(game->display)*0.5, 0, 0);
|
||||
al_draw_bitmap_region(game->intro.table_bitmap, al_get_bitmap_width(game->intro.table_bitmap)/2, 0, al_get_bitmap_width(game->intro.table_bitmap)/2, al_get_bitmap_height(game->intro.table_bitmap), game->viewportWidth*0, 0, 0);
|
||||
al_draw_bitmap_region(game->intro.table_bitmap, al_get_bitmap_width(game->intro.table_bitmap)/2, 0, al_get_bitmap_width(game->intro.table_bitmap)/2, al_get_bitmap_height(game->intro.table_bitmap), game->viewportWidth*0.5, 0, 0);
|
||||
al_hold_bitmap_drawing(false);
|
||||
al_hold_bitmap_drawing(true);
|
||||
draw_text(4, "Discord, learning from his last failure,");
|
||||
|
@ -118,8 +118,8 @@ void FillPage(struct Game *game, int page) {
|
|||
break;
|
||||
case 5:
|
||||
al_hold_bitmap_drawing(true);
|
||||
al_draw_bitmap_region(game->intro.table_bitmap, al_get_bitmap_width(game->intro.table_bitmap)/2, 0, al_get_bitmap_width(game->intro.table_bitmap)/2, al_get_bitmap_height(game->intro.table_bitmap), al_get_display_width(game->display)*0, 0, 0);
|
||||
al_draw_bitmap_region(game->intro.table_bitmap, al_get_bitmap_width(game->intro.table_bitmap)/2, 0, al_get_bitmap_width(game->intro.table_bitmap)/2, al_get_bitmap_height(game->intro.table_bitmap), al_get_display_width(game->display)*0.5, 0, 0);
|
||||
al_draw_bitmap_region(game->intro.table_bitmap, al_get_bitmap_width(game->intro.table_bitmap)/2, 0, al_get_bitmap_width(game->intro.table_bitmap)/2, al_get_bitmap_height(game->intro.table_bitmap), game->viewportWidth*0, 0, 0);
|
||||
al_draw_bitmap_region(game->intro.table_bitmap, al_get_bitmap_width(game->intro.table_bitmap)/2, 0, al_get_bitmap_width(game->intro.table_bitmap)/2, al_get_bitmap_height(game->intro.table_bitmap), game->viewportWidth*0.5, 0, 0);
|
||||
al_hold_bitmap_drawing(false);
|
||||
al_hold_bitmap_drawing(true);
|
||||
draw_text(5, "Who can defeat Discord without");
|
||||
|
@ -133,11 +133,11 @@ void FillPage(struct Game *game, int page) {
|
|||
}
|
||||
|
||||
DrawPage(page);
|
||||
ALLEGRO_BITMAP* second = al_create_bitmap(al_get_display_width(game->display), al_get_display_height(game->display));
|
||||
ALLEGRO_BITMAP* second = al_create_bitmap(game->viewportWidth, game->viewportHeight);
|
||||
al_set_target_bitmap(second);
|
||||
DrawPage(page+1);
|
||||
al_set_target_bitmap(game->intro.table);
|
||||
al_draw_bitmap(second, al_get_display_width(game->display), 0, 0);
|
||||
al_draw_bitmap(second, game->viewportWidth, 0, 0);
|
||||
al_set_target_bitmap(al_get_backbuffer(game->display));
|
||||
al_destroy_bitmap(second);
|
||||
}
|
||||
|
@ -145,23 +145,23 @@ void FillPage(struct Game *game, int page) {
|
|||
void Intro_Draw(struct Game *game) {
|
||||
al_clear_to_color(al_map_rgb(0,0,0));
|
||||
if (game->intro.in_animation) {
|
||||
al_draw_bitmap(game->intro.table, -1*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_draw_bitmap(game->intro.table, -1*game->viewportWidth + (cos(((-1*((game->intro.position)%game->viewportWidth))/(float)game->viewportWidth)*(ALLEGRO_PI))/2.0)*game->viewportWidth + game->viewportWidth/2.0, 0, 0);
|
||||
AnimPage(game, game->intro.page, al_map_rgba_f(1,1,1,1));
|
||||
}
|
||||
else {
|
||||
al_draw_bitmap(game->intro.table, 0, 0, 0);
|
||||
AnimPage(game, game->intro.page+1, al_map_rgba_f(1,1,1,1));
|
||||
}
|
||||
al_draw_text_with_shadow(game->intro.font, al_map_rgb(255,255,255), al_get_display_width(game->display)/2, al_get_display_height(game->display)*0.90, ALLEGRO_ALIGN_CENTRE, "Press any key to continue or escape to skip...");
|
||||
al_draw_text_with_shadow(game->intro.font, al_map_rgb(255,255,255), game->viewportWidth/2, game->viewportHeight*0.90, ALLEGRO_ALIGN_CENTRE, "Press any key to continue or escape to skip...");
|
||||
al_draw_bitmap(game->intro.frame, 0, 0, 0);
|
||||
/*PrintConsole(game, "drawing");*/
|
||||
if (game->intro.in_animation) {
|
||||
/*PrintConsole(game, "animating");*/
|
||||
int old = game->intro.position%al_get_display_width(game->display);
|
||||
int old = game->intro.position%game->viewportWidth;
|
||||
if (tps(game, 600)) game->intro.position -= tps(game, 600);
|
||||
else game->intro.position -= 1;
|
||||
/*PrintConsole(game, "%d", game->intro.position%al_get_display_width(game->display));*/
|
||||
if (game->intro.position%al_get_display_width(game->display)>old) {
|
||||
/*PrintConsole(game, "%d", game->intro.position%game->viewportWidth);*/
|
||||
if (game->intro.position%game->viewportWidth>old) {
|
||||
/*DrawConsole(game);
|
||||
al_flip_display();*/
|
||||
game->intro.in_animation = false;
|
||||
|
@ -169,7 +169,7 @@ void Intro_Draw(struct Game *game) {
|
|||
PrintConsole(game, "Animation finished.");
|
||||
al_set_audio_stream_playing(game->intro.audiostream, true);
|
||||
}
|
||||
else if (game->intro.position<=-4*al_get_display_width(game->display)) {
|
||||
else if (game->intro.position<=-4*game->viewportWidth) {
|
||||
PrintConsole(game, "This was the last page.");
|
||||
UnloadGameState(game);
|
||||
game->loadstate = GAMESTATE_MAP;
|
||||
|
@ -224,20 +224,20 @@ void Intro_Preload(struct Game *game, void (*progress)(struct Game*, float)) {
|
|||
game->intro.in_animation = false;
|
||||
game->intro.anim = 0;
|
||||
|
||||
game->intro.animsprites[0] = LoadScaledBitmap("intro/1.png", (int)(al_get_display_width(game->display)*0.3125)*2, al_get_display_height(game->display)*0.63*2);
|
||||
game->intro.animsprites[0] = LoadScaledBitmap("intro/1.png", (int)(game->viewportWidth*0.3125)*2, game->viewportHeight*0.63*2);
|
||||
PROGRESS;
|
||||
game->intro.animsprites[1] = LoadScaledBitmap("intro/2.png", (int)(al_get_display_width(game->display)*0.3125)*4, al_get_display_height(game->display)*0.63*3);
|
||||
game->intro.animsprites[1] = LoadScaledBitmap("intro/2.png", (int)(game->viewportWidth*0.3125)*4, game->viewportHeight*0.63*3);
|
||||
PROGRESS;
|
||||
game->intro.animsprites[2] = LoadScaledBitmap("intro/3.png", (int)(al_get_display_width(game->display)*0.3125)*3, al_get_display_height(game->display)*0.63*3);
|
||||
game->intro.animsprites[2] = LoadScaledBitmap("intro/3.png", (int)(game->viewportWidth*0.3125)*3, game->viewportHeight*0.63*3);
|
||||
PROGRESS;
|
||||
game->intro.animsprites[3] = LoadScaledBitmap("intro/4.png", (int)(al_get_display_width(game->display)*0.3125)*2, al_get_display_height(game->display)*0.63*2);
|
||||
game->intro.animsprites[3] = LoadScaledBitmap("intro/4.png", (int)(game->viewportWidth*0.3125)*2, game->viewportHeight*0.63*2);
|
||||
PROGRESS;
|
||||
game->intro.animsprites[4] = LoadScaledBitmap("intro/5.png", (int)(al_get_display_width(game->display)*0.3125)*5, al_get_display_height(game->display)*0.63*3);
|
||||
game->intro.animsprites[4] = LoadScaledBitmap("intro/5.png", (int)(game->viewportWidth*0.3125)*5, game->viewportHeight*0.63*3);
|
||||
PROGRESS;
|
||||
|
||||
game->intro.table_bitmap =LoadScaledBitmap("intro/paper.png", al_get_display_width(game->display), al_get_display_height(game->display));
|
||||
game->intro.table_bitmap =LoadScaledBitmap("intro/paper.png", game->viewportWidth, game->viewportHeight);
|
||||
PROGRESS;
|
||||
game->intro.frame =LoadScaledBitmap("intro/frame.png", al_get_display_width(game->display), al_get_display_height(game->display));
|
||||
game->intro.frame =LoadScaledBitmap("intro/frame.png", game->viewportWidth, game->viewportHeight);
|
||||
PROGRESS;
|
||||
|
||||
game->intro.sample = al_load_sample( "data/intro/intro.flac" );
|
||||
|
@ -252,9 +252,9 @@ void Intro_Preload(struct Game *game, void (*progress)(struct Game*, float)) {
|
|||
fprintf(stderr, "Audio clip sample not loaded!\n" );
|
||||
exit(-1);
|
||||
}
|
||||
game->intro.table = al_create_bitmap(al_get_display_width(game->display)*2, al_get_display_height(game->display));
|
||||
game->intro.table = al_create_bitmap(game->viewportWidth*2, game->viewportHeight);
|
||||
|
||||
game->intro.font = al_load_ttf_font("data/ShadowsIntoLight.ttf",al_get_display_height(game->display)*0.04,0 );
|
||||
game->intro.font = al_load_ttf_font("data/ShadowsIntoLight.ttf",game->viewportHeight*0.04,0 );
|
||||
|
||||
FillPage(game, 1);
|
||||
PROGRESS;
|
||||
|
@ -278,7 +278,7 @@ void Intro_Unload(struct Game *game) {
|
|||
for(fadeloop=255; fadeloop>=0; fadeloop-=tps(game, 600)){
|
||||
al_wait_for_event(game->event_queue, &ev);
|
||||
if (game->intro.in_animation) {
|
||||
al_draw_tinted_bitmap(game->intro.table, al_map_rgba_f(fadeloop/255.0,fadeloop/255.0,fadeloop/255.0,1), -1*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_draw_tinted_bitmap(game->intro.table, al_map_rgba_f(fadeloop/255.0,fadeloop/255.0,fadeloop/255.0,1), -1*game->viewportWidth + (cos(((-1*((game->intro.position)%game->viewportWidth))/(float)game->viewportWidth)*(ALLEGRO_PI))/2.0)*game->viewportWidth + game->viewportWidth/2.0, 0, 0);
|
||||
AnimPage(game, game->intro.page, al_map_rgba_f(fadeloop/255.0,fadeloop/255.0,fadeloop/255.0,1));
|
||||
}
|
||||
else {
|
||||
|
|
64
src/level.c
64
src/level.c
|
@ -46,7 +46,7 @@ void SelectDerpySpritesheet(struct Game *game, char* name) {
|
|||
game->level.sheet_pos = 0;
|
||||
game->level.sheet_scale = tmp->scale;
|
||||
if (game->level.derpy) al_destroy_bitmap(game->level.derpy);
|
||||
game->level.derpy = al_create_bitmap((al_get_display_height(game->display)*0.25)*tmp->aspect*tmp->scale, (al_get_display_height(game->display)*0.25)*tmp->scale);
|
||||
game->level.derpy = al_create_bitmap((game->viewportHeight*0.25)*tmp->aspect*tmp->scale, (game->viewportHeight*0.25)*tmp->scale);
|
||||
PrintConsole(game, "SUCCESS: Derpy spritesheet activated: %s (%dx%d)", name, al_get_bitmap_width(game->level.derpy), al_get_bitmap_height(game->level.derpy));
|
||||
return;
|
||||
}
|
||||
|
@ -141,17 +141,17 @@ void Level_Draw(struct Game *game) {
|
|||
al_draw_bitmap(game->level.stage, (-game->level.st_pos)*al_get_bitmap_width(game->level.stage), 0 ,0);
|
||||
al_draw_bitmap(game->level.stage, (1+(-game->level.st_pos))*al_get_bitmap_width(game->level.stage), 0 ,0);
|
||||
|
||||
int derpyx = game->level.derpy_x*al_get_display_width(game->display);
|
||||
int derpyy = game->level.derpy_y*al_get_display_height(game->display);
|
||||
int derpyx = game->level.derpy_x*game->viewportWidth;
|
||||
int derpyy = game->level.derpy_y*game->viewportHeight;
|
||||
int derpyw = al_get_bitmap_width(game->level.derpy);
|
||||
int derpyh = al_get_bitmap_height(game->level.derpy);
|
||||
int derpyo = al_get_display_width(game->display)*0.1953125-al_get_bitmap_width(game->level.derpy); /* offset */
|
||||
int derpyo = game->viewportWidth*0.1953125-al_get_bitmap_width(game->level.derpy); /* offset */
|
||||
bool colision = false;
|
||||
struct Obstacle *tmp = game->level.obstacles;
|
||||
while (tmp) {
|
||||
/*PrintConsole(game, "DRAWING %f %f", tmp->x, tmp->y);*/
|
||||
int x = (tmp->x/100.0)*al_get_display_width(game->display);
|
||||
int y = (tmp->y/100.0)*al_get_display_height(game->display);
|
||||
int x = (tmp->x/100.0)*game->viewportWidth;
|
||||
int y = (tmp->y/100.0)*game->viewportHeight;
|
||||
int w = 0, h = 0;
|
||||
if (tmp->bitmap) {
|
||||
w = al_get_bitmap_width(*(tmp->bitmap))/tmp->cols;
|
||||
|
@ -195,7 +195,7 @@ void Level_Draw(struct Game *game) {
|
|||
TM_AddBackgroundAction(&LevelFailed, NULL, 0, "levelfailed");
|
||||
}
|
||||
}
|
||||
tmp->x -= tps(game, game->level.speed*game->level.speed_modifier*60*tmp->speed)*100*al_get_bitmap_width(game->level.stage)/(float)al_get_display_width(game->display);
|
||||
tmp->x -= tps(game, game->level.speed*game->level.speed_modifier*60*tmp->speed)*100*al_get_bitmap_width(game->level.stage)/(float)game->viewportWidth;
|
||||
if (tmp->callback) tmp->callback(game, tmp);
|
||||
tmp = tmp->next;
|
||||
} else {
|
||||
|
@ -225,7 +225,7 @@ void Level_Draw(struct Game *game) {
|
|||
}
|
||||
al_set_target_bitmap(al_get_backbuffer(game->display));
|
||||
|
||||
al_draw_tinted_rotated_bitmap(game->level.derpy, al_map_rgba(255,255-colision*255,255-colision*255,255), al_get_bitmap_width(game->level.derpy), al_get_bitmap_height(game->level.derpy)/2, derpyx+al_get_display_width(game->display)*0.1953125, derpyy + al_get_bitmap_height(game->level.derpy)/2, game->level.derpy_angle, 0);
|
||||
al_draw_tinted_rotated_bitmap(game->level.derpy, al_map_rgba(255,255-colision*255,255-colision*255,255), al_get_bitmap_width(game->level.derpy), al_get_bitmap_height(game->level.derpy)/2, derpyx+game->viewportWidth*0.1953125, derpyy + al_get_bitmap_height(game->level.derpy)/2, game->level.derpy_angle, 0);
|
||||
|
||||
/* if ((((x>=derpyx+0.36*derpyw) && (x<=derpyx+0.94*derpyw)) || ((x+w>=derpyx+0.36*derpyw) && (x+w<=derpyx+0.94*derpyw))) &&
|
||||
(((y>=derpyy+0.26*derpyh) && (y<=derpyy+0.76*derpyh)) || ((y+h>=derpyy+0.26*derpyh) && (y+h<=derpyy+0.76*derpyh)))) {
|
||||
|
@ -254,12 +254,12 @@ void Level_Draw(struct Game *game) {
|
|||
al_clear_to_color(al_map_rgba(0,0,0,0));
|
||||
al_draw_filled_rounded_rectangle(al_get_bitmap_width(game->level.meter_bmp)*0.1, al_get_bitmap_height(game->level.meter_bmp)*0.34, al_get_bitmap_width(game->level.meter_bmp)*0.993, al_get_bitmap_height(game->level.meter_bmp)*0.66,
|
||||
6,6, al_map_rgb(232,234,239));
|
||||
al_draw_horizontal_gradient_rect(al_get_bitmap_width(game->level.meter_bmp)-al_get_display_width(game->display)*0.215, (al_get_bitmap_height(game->level.meter_bmp)-al_get_display_height(game->display)*0.025)/2, al_get_display_width(game->display)*0.215*0.975, al_get_display_height(game->display)*0.025, al_map_rgb(150,159,182), al_map_rgb(130,139,162));
|
||||
al_draw_filled_rectangle(al_get_bitmap_width(game->level.meter_bmp)-al_get_display_width(game->display)*0.215, (al_get_bitmap_height(game->level.meter_bmp)-al_get_display_height(game->display)*0.025)/2, al_get_bitmap_width(game->level.meter_bmp)-al_get_display_width(game->display)*0.215+(al_get_display_width(game->display)*0.215*0.975)*game->level.hp, (al_get_bitmap_height(game->level.meter_bmp)-al_get_display_height(game->display)*0.025)/2+al_get_display_height(game->display)*0.025, al_map_rgb(214,172,55));
|
||||
al_draw_horizontal_gradient_rect(al_get_bitmap_width(game->level.meter_bmp)-game->viewportWidth*0.215, (al_get_bitmap_height(game->level.meter_bmp)-game->viewportHeight*0.025)/2, game->viewportWidth*0.215*0.975, game->viewportHeight*0.025, al_map_rgb(150,159,182), al_map_rgb(130,139,162));
|
||||
al_draw_filled_rectangle(al_get_bitmap_width(game->level.meter_bmp)-game->viewportWidth*0.215, (al_get_bitmap_height(game->level.meter_bmp)-game->viewportHeight*0.025)/2, al_get_bitmap_width(game->level.meter_bmp)-game->viewportWidth*0.215+(game->viewportWidth*0.215*0.975)*game->level.hp, (al_get_bitmap_height(game->level.meter_bmp)-game->viewportHeight*0.025)/2+game->viewportHeight*0.025, al_map_rgb(214,172,55));
|
||||
al_draw_bitmap(game->level.meter_image, 0, 0, 0);
|
||||
al_set_target_bitmap(al_get_backbuffer(game->display));
|
||||
|
||||
al_draw_tinted_bitmap(game->level.meter_bmp, al_map_rgba(game->level.meter_alpha,game->level.meter_alpha,game->level.meter_alpha,game->level.meter_alpha), al_get_display_width(game->display)*0.95-al_get_bitmap_width(game->level.meter_bmp), al_get_display_height(game->display)*0.975-al_get_bitmap_height(game->level.meter_bmp), 0);
|
||||
al_draw_tinted_bitmap(game->level.meter_bmp, al_map_rgba(game->level.meter_alpha,game->level.meter_alpha,game->level.meter_alpha,game->level.meter_alpha), game->viewportWidth*0.95-al_get_bitmap_width(game->level.meter_bmp), game->viewportHeight*0.975-al_get_bitmap_height(game->level.meter_bmp), 0);
|
||||
|
||||
TM_Process();
|
||||
}
|
||||
|
@ -482,7 +482,7 @@ void Level_PreloadBitmaps(struct Game *game, void (*progress)(struct Game*, floa
|
|||
while (tmp) {
|
||||
char filename[255] = { };
|
||||
sprintf(filename, "levels/derpy/%s.png", tmp->name);
|
||||
tmp->bitmap = LoadScaledBitmap(filename, (int)(al_get_display_height(game->display)*0.25*tmp->aspect*tmp->scale)*tmp->cols, (int)(al_get_display_height(game->display)*0.25*tmp->scale)*tmp->rows);
|
||||
tmp->bitmap = LoadScaledBitmap(filename, (int)(game->viewportHeight*0.25*tmp->aspect*tmp->scale)*tmp->cols, (int)(game->viewportHeight*0.25*tmp->scale)*tmp->rows);
|
||||
PROGRESS;
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
@ -494,38 +494,38 @@ void Level_PreloadBitmaps(struct Game *game, void (*progress)(struct Game*, floa
|
|||
if (game->level.current_level!=1) Moonwalk_PreloadBitmaps(game);
|
||||
else {
|
||||
/* TODO: handle strange display aspects */
|
||||
game->level.clouds = LoadScaledBitmap("levels/1/clouds.png", al_get_display_height(game->display)*4.73307291666666666667, al_get_display_height(game->display));
|
||||
game->level.clouds = LoadScaledBitmap("levels/1/clouds.png", game->viewportHeight*4.73307291666666666667, game->viewportHeight);
|
||||
PROGRESS;
|
||||
game->level.foreground = LoadScaledBitmap("levels/1/foreground.png", al_get_display_height(game->display)*4.73307291666666666667, al_get_display_height(game->display));
|
||||
game->level.foreground = LoadScaledBitmap("levels/1/foreground.png", game->viewportHeight*4.73307291666666666667, game->viewportHeight);
|
||||
PROGRESS;
|
||||
game->level.background = LoadScaledBitmap("levels/1/background.png", al_get_display_height(game->display)*4.73307291666666666667, al_get_display_height(game->display));
|
||||
game->level.background = LoadScaledBitmap("levels/1/background.png", game->viewportHeight*4.73307291666666666667, game->viewportHeight);
|
||||
PROGRESS;
|
||||
game->level.stage = LoadScaledBitmap("levels/1/stage.png", al_get_display_height(game->display)*4.73307291666666666667, al_get_display_height(game->display));
|
||||
game->level.stage = LoadScaledBitmap("levels/1/stage.png", game->viewportHeight*4.73307291666666666667, game->viewportHeight);
|
||||
PROGRESS;
|
||||
game->level.obst_bmps.pie1 = LoadScaledBitmap("levels/pie1.png", al_get_display_width(game->display)*0.1, al_get_display_height(game->display)*0.08);
|
||||
game->level.obst_bmps.pie1 = LoadScaledBitmap("levels/pie1.png", game->viewportWidth*0.1, game->viewportHeight*0.08);
|
||||
PROGRESS;
|
||||
game->level.obst_bmps.pie2 = LoadScaledBitmap("levels/pie2.png", al_get_display_width(game->display)*0.1, al_get_display_height(game->display)*0.08);
|
||||
game->level.obst_bmps.pie2 = LoadScaledBitmap("levels/pie2.png", game->viewportWidth*0.1, game->viewportHeight*0.08);
|
||||
PROGRESS;
|
||||
game->level.obst_bmps.pig = LoadScaledBitmap("levels/pig.png", (int)(al_get_display_width(game->display)*0.15)*3, (int)(al_get_display_height(game->display)*0.2)*3);
|
||||
game->level.obst_bmps.pig = LoadScaledBitmap("levels/pig.png", (int)(game->viewportWidth*0.15)*3, (int)(game->viewportHeight*0.2)*3);
|
||||
PROGRESS;
|
||||
game->level.obst_bmps.screwball = LoadScaledBitmap("levels/screwball.png", (int)(al_get_display_height(game->display)*0.2)*4*1.4, (int)(al_get_display_height(game->display)*0.2)*4);
|
||||
game->level.obst_bmps.screwball = LoadScaledBitmap("levels/screwball.png", (int)(game->viewportHeight*0.2)*4*1.4, (int)(game->viewportHeight*0.2)*4);
|
||||
PROGRESS;
|
||||
game->level.obst_bmps.muffin = LoadScaledBitmap("levels/muffin.png", al_get_display_width(game->display)*0.07, al_get_display_height(game->display)*0.1);
|
||||
game->level.obst_bmps.muffin = LoadScaledBitmap("levels/muffin.png", game->viewportWidth*0.07, game->viewportHeight*0.1);
|
||||
PROGRESS;
|
||||
game->level.obst_bmps.cherry = LoadScaledBitmap("levels/cherry.png", al_get_display_width(game->display)*0.03, al_get_display_height(game->display)*0.08);
|
||||
game->level.obst_bmps.cherry = LoadScaledBitmap("levels/cherry.png", game->viewportWidth*0.03, game->viewportHeight*0.08);
|
||||
PROGRESS;
|
||||
game->level.obst_bmps.badmuffin = LoadScaledBitmap("levels/badmuffin.png", al_get_display_width(game->display)*0.07, al_get_display_height(game->display)*0.1);
|
||||
game->level.obst_bmps.badmuffin = LoadScaledBitmap("levels/badmuffin.png", game->viewportWidth*0.07, game->viewportHeight*0.1);
|
||||
PROGRESS;
|
||||
game->level.owl = LoadScaledBitmap("levels/owl.png", al_get_display_width(game->display)*0.08, al_get_display_width(game->display)*0.08);
|
||||
game->level.owl = LoadScaledBitmap("levels/owl.png", game->viewportWidth*0.08, game->viewportWidth*0.08);
|
||||
PROGRESS;
|
||||
game->level.letter_font = al_load_ttf_font("data/DejaVuSans.ttf",al_get_display_height(game->display)*0.0225,0 );
|
||||
game->level.letter_font = al_load_ttf_font("data/DejaVuSans.ttf",game->viewportHeight*0.0225,0 );
|
||||
PROGRESS;
|
||||
game->level.letter = LoadScaledBitmap("levels/letter.png", al_get_display_height(game->display)*1.3, al_get_display_height(game->display)*1.2);
|
||||
game->level.letter = LoadScaledBitmap("levels/letter.png", game->viewportHeight*1.3, game->viewportHeight*1.2);
|
||||
al_set_target_bitmap(game->level.letter);
|
||||
float y = 0.20;
|
||||
float x = 0.19;
|
||||
void draw_text(char* text) {
|
||||
al_draw_text(game->level.letter_font, al_map_rgb(0,0,0), al_get_bitmap_width(game->level.letter)*x, al_get_display_height(game->display)*y, ALLEGRO_ALIGN_LEFT, text);
|
||||
al_draw_text(game->level.letter_font, al_map_rgb(0,0,0), al_get_bitmap_width(game->level.letter)*x, game->viewportHeight*y, ALLEGRO_ALIGN_LEFT, text);
|
||||
y+=0.028;
|
||||
}
|
||||
draw_text("Dear Derpy,");
|
||||
|
@ -562,17 +562,17 @@ void Level_PreloadBitmaps(struct Game *game, void (*progress)(struct Game*, floa
|
|||
al_draw_text_with_shadow(game->menu.font, al_map_rgb(255,255,255), al_get_bitmap_width(game->level.letter)*0.5, al_get_bitmap_height(game->level.letter)*0.8, ALLEGRO_ALIGN_CENTRE, "Press enter to continue...");
|
||||
al_set_target_bitmap(al_get_backbuffer(game->display));
|
||||
PROGRESS;
|
||||
game->level.welcome = al_create_bitmap(al_get_display_width(game->display), al_get_display_height(game->display)/2);
|
||||
game->level.welcome = al_create_bitmap(game->viewportWidth, game->viewportHeight/2);
|
||||
PROGRESS;
|
||||
al_set_target_bitmap(game->level.welcome);
|
||||
al_clear_to_color(al_map_rgba(0,0,0,0));
|
||||
al_draw_text_with_shadow(game->menu.font_title, al_map_rgb(255,255,255), al_get_display_width(game->display)*0.5, al_get_display_height(game->display)*0.1, ALLEGRO_ALIGN_CENTRE, "Level 1");
|
||||
al_draw_text_with_shadow(game->menu.font_subtitle, al_map_rgb(255,255,255), al_get_display_width(game->display)*0.5, al_get_display_height(game->display)*0.275, ALLEGRO_ALIGN_CENTRE, "Fluttershy");
|
||||
al_draw_text_with_shadow(game->menu.font_title, al_map_rgb(255,255,255), game->viewportWidth*0.5, game->viewportHeight*0.1, ALLEGRO_ALIGN_CENTRE, "Level 1");
|
||||
al_draw_text_with_shadow(game->menu.font_subtitle, al_map_rgb(255,255,255), game->viewportWidth*0.5, game->viewportHeight*0.275, ALLEGRO_ALIGN_CENTRE, "Fluttershy");
|
||||
PROGRESS;
|
||||
|
||||
game->level.meter_image = LoadScaledBitmap("levels/meter.png", al_get_display_width(game->display)*0.075, al_get_display_width(game->display)*0.075*0.96470588235294117647);
|
||||
game->level.meter_image = LoadScaledBitmap("levels/meter.png", game->viewportWidth*0.075, game->viewportWidth*0.075*0.96470588235294117647);
|
||||
PROGRESS;
|
||||
game->level.meter_bmp = al_create_bitmap(al_get_display_width(game->display)*0.2+al_get_bitmap_width(game->level.meter_image), al_get_bitmap_height(game->level.meter_image));
|
||||
game->level.meter_bmp = al_create_bitmap(game->viewportWidth*0.2+al_get_bitmap_width(game->level.meter_image), al_get_bitmap_height(game->level.meter_image));
|
||||
|
||||
al_set_target_bitmap(al_get_backbuffer(game->display));
|
||||
}
|
||||
|
|
|
@ -27,8 +27,8 @@ bool LevelFailed(struct Game *game, struct TM_Action *action, enum TM_ActionStat
|
|||
if (state == TM_ACTIONSTATE_INIT) {
|
||||
TM_AddBackgroundAction(&FadeOut, NULL, 3000, "fadeout");
|
||||
} else if (state == TM_ACTIONSTATE_RUNNING) {
|
||||
al_draw_filled_rectangle(0, 0, al_get_display_width(game->display), al_get_display_height(game->display), al_map_rgba(0,0,0,100));
|
||||
al_draw_text_with_shadow(game->menu.font_title, al_map_rgb(255,255,255), al_get_display_width(game->display)*0.5, al_get_display_height(game->display)*0.4, ALLEGRO_ALIGN_CENTRE, "Failed!");
|
||||
al_draw_filled_rectangle(0, 0, game->viewportWidth, game->viewportHeight, al_map_rgba(0,0,0,100));
|
||||
al_draw_text_with_shadow(game->menu.font_title, al_map_rgb(255,255,255), game->viewportWidth*0.5, game->viewportHeight*0.4, ALLEGRO_ALIGN_CENTRE, "Failed!");
|
||||
game->level.speed-=0.00001;
|
||||
return false;
|
||||
}
|
||||
|
@ -233,7 +233,7 @@ bool Letter(struct Game *game, struct TM_Action *action, enum TM_ActionState sta
|
|||
float* f = (float*)action->arguments->value;
|
||||
*f+=tps(game,350);
|
||||
if (*f>255) *f=255;
|
||||
al_draw_tinted_bitmap(game->level.letter, al_map_rgba(*f,*f,*f,*f), (al_get_display_width(game->display)-al_get_bitmap_width(game->level.letter))/2.0, al_get_bitmap_height(game->level.letter)*-0.05, 0);
|
||||
al_draw_tinted_bitmap(game->level.letter, al_map_rgba(*f,*f,*f,*f), (game->viewportWidth-al_get_bitmap_width(game->level.letter))/2.0, al_get_bitmap_height(game->level.letter)*-0.05, 0);
|
||||
struct ALLEGRO_KEYBOARD_STATE keyboard;
|
||||
al_get_keyboard_state(&keyboard);
|
||||
if (al_key_down(&keyboard, ALLEGRO_KEY_ENTER)) {
|
||||
|
@ -245,7 +245,7 @@ bool Letter(struct Game *game, struct TM_Action *action, enum TM_ActionState sta
|
|||
bool FadeIn(struct Game *game, struct TM_Action *action, enum TM_ActionState state) {
|
||||
if (!action->arguments) {
|
||||
action->arguments = TM_AddToArgs(action->arguments, malloc(sizeof(float)));
|
||||
action->arguments = TM_AddToArgs(action->arguments, (void*)al_create_bitmap(al_get_display_width(game->display), al_get_display_height(game->display)));
|
||||
action->arguments = TM_AddToArgs(action->arguments, (void*)al_create_bitmap(game->viewportWidth, game->viewportHeight));
|
||||
}
|
||||
float* fadeloop;
|
||||
ALLEGRO_BITMAP* fade_bitmap;
|
||||
|
@ -273,7 +273,7 @@ bool FadeIn(struct Game *game, struct TM_Action *action, enum TM_ActionState sta
|
|||
bool FadeOut(struct Game *game, struct TM_Action *action, enum TM_ActionState state) {
|
||||
if (!action->arguments) {
|
||||
action->arguments = TM_AddToArgs(action->arguments, malloc(sizeof(float)));
|
||||
action->arguments = TM_AddToArgs(action->arguments, (void*)al_create_bitmap(al_get_display_width(game->display), al_get_display_height(game->display)));
|
||||
action->arguments = TM_AddToArgs(action->arguments, (void*)al_create_bitmap(game->viewportWidth, game->viewportHeight));
|
||||
}
|
||||
float* fadeloop;
|
||||
ALLEGRO_BITMAP* fade_bitmap;
|
||||
|
|
|
@ -30,7 +30,7 @@ void Obst_MoveUpDown(struct Game *game, struct Obstacle *obstacle) {
|
|||
}
|
||||
} else {
|
||||
obstacle->y += 0.5;
|
||||
if (obstacle->y>=((al_get_display_height(game->display)-al_get_bitmap_height(*(obstacle->bitmap))/obstacle->rows)/(float)al_get_display_height(game->display))*100) {
|
||||
if (obstacle->y>=((game->viewportHeight-al_get_bitmap_height(*(obstacle->bitmap))/obstacle->rows)/(float)game->viewportHeight)*100) {
|
||||
obstacle->data++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ void Progress(struct Game *game, float p) {
|
|||
if (game->debug) { printf("%f\n", p); fflush(stdout); }
|
||||
al_set_target_bitmap(al_get_backbuffer(game->display));
|
||||
al_draw_bitmap(game->loading.loading_bitmap,0,0,0);
|
||||
al_draw_filled_rectangle(0, al_get_display_height(game->display)*0.985, p*al_get_display_width(game->display), al_get_display_height(game->display), al_map_rgba(255,255,255,255));
|
||||
al_draw_filled_rectangle(0, game->viewportHeight*0.985, p*game->viewportWidth, game->viewportHeight, al_map_rgba(255,255,255,255));
|
||||
DrawConsole(game);
|
||||
al_flip_display();
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ void Loading_Draw(struct Game *game) {
|
|||
for(fadeloop=255; fadeloop>0; fadeloop-=tps(game, 600)){
|
||||
al_wait_for_event(game->event_queue, &ev);
|
||||
al_draw_tinted_bitmap(game->loading.loading_bitmap,al_map_rgba_f(fadeloop/255.0,fadeloop/255.0,fadeloop/255.0,1),0,0,0);
|
||||
al_draw_filled_rectangle(0, al_get_display_height(game->display)*0.985, al_get_display_width(game->display), al_get_display_height(game->display), al_map_rgba(fadeloop,fadeloop,fadeloop,255));
|
||||
al_draw_filled_rectangle(0, game->viewportHeight*0.985, game->viewportWidth, game->viewportHeight, al_map_rgba(fadeloop,fadeloop,fadeloop,255));
|
||||
DrawConsole(game);
|
||||
al_flip_display();
|
||||
}
|
||||
|
@ -65,14 +65,14 @@ void Loading_Draw(struct Game *game) {
|
|||
void Loading_Load(struct Game *game) {
|
||||
al_clear_to_color(al_map_rgb(0,0,0));
|
||||
|
||||
game->loading.loading_bitmap = al_create_bitmap(al_get_display_width(game->display), al_get_display_height(game->display));
|
||||
game->loading.loading_bitmap = al_create_bitmap(game->viewportWidth, game->viewportHeight);
|
||||
|
||||
game->loading.image = LoadScaledBitmap("loading.png", al_get_display_width(game->display), al_get_display_height(game->display));
|
||||
game->loading.image = LoadScaledBitmap("loading.png", game->viewportWidth, game->viewportHeight);
|
||||
|
||||
al_set_target_bitmap(game->loading.loading_bitmap);
|
||||
al_draw_bitmap(game->loading.image, 0, 0, 0);
|
||||
al_draw_text_with_shadow(game->font, al_map_rgb(255,255,255), al_get_display_width(game->display)*0.0234, al_get_display_height(game->display)*0.84, ALLEGRO_ALIGN_LEFT, "Loading...");
|
||||
al_draw_filled_rectangle(0, al_get_display_height(game->display)*0.985, al_get_display_width(game->display), al_get_display_height(game->display), al_map_rgba(128,128,128,128));
|
||||
al_draw_text_with_shadow(game->font, al_map_rgb(255,255,255), game->viewportWidth*0.0234, game->viewportHeight*0.84, ALLEGRO_ALIGN_LEFT, "Loading...");
|
||||
al_draw_filled_rectangle(0, game->viewportHeight*0.985, game->viewportWidth, game->viewportHeight, al_map_rgba(128,128,128,128));
|
||||
al_set_target_bitmap(al_get_backbuffer(game->display));
|
||||
al_destroy_bitmap(game->loading.image);
|
||||
}
|
||||
|
|
58
src/main.c
58
src/main.c
|
@ -71,7 +71,7 @@ void PrintConsole(struct Game *game, char* format, ...) {
|
|||
al_set_target_bitmap(con);
|
||||
al_clear_to_color(al_map_rgba(0,0,0,80));
|
||||
al_draw_bitmap_region(game->console, 0, al_get_bitmap_height(game->console)*0.2, al_get_bitmap_width(game->console), al_get_bitmap_height(game->console)*0.8, 0, 0, 0);
|
||||
al_draw_text(game->font_console, al_map_rgb(255,255,255), al_get_display_width(game->display)*0.005, al_get_bitmap_height(game->console)*0.81, ALLEGRO_ALIGN_LEFT, text);
|
||||
al_draw_text(game->font_console, al_map_rgb(255,255,255), game->viewportWidth*0.005, al_get_bitmap_height(game->console)*0.81, ALLEGRO_ALIGN_LEFT, text);
|
||||
al_set_target_bitmap(game->console);
|
||||
al_clear_to_color(al_map_rgba(0,0,0,0));
|
||||
al_draw_bitmap(con, 0, 0, 0);
|
||||
|
@ -90,7 +90,7 @@ void DrawConsole(struct Game *game) {
|
|||
}
|
||||
char sfps[6] = { };
|
||||
sprintf(sfps, "%.0f", fps);
|
||||
al_draw_text_with_shadow(game->font, al_map_rgb(255,255,255), al_get_display_width(game->display)*0.99, 0, ALLEGRO_ALIGN_RIGHT, sfps);
|
||||
al_draw_text_with_shadow(game->font, al_map_rgb(255,255,255), game->viewportWidth*0.99, 0, ALLEGRO_ALIGN_RIGHT, sfps);
|
||||
}
|
||||
frames_done++;
|
||||
}
|
||||
|
@ -262,18 +262,43 @@ float tps(struct Game *game, float t) {
|
|||
else return t/fps;
|
||||
}
|
||||
|
||||
void SetupViewport(struct Game *game) {
|
||||
game->viewportWidth = al_get_display_width(game->display);
|
||||
game->viewportHeight = al_get_display_height(game->display);
|
||||
if (atoi(GetConfigOptionDefault("SuperDerpy", "letterbox", "1"))) {
|
||||
float const aspectRatio = (float)800 / (float)500;
|
||||
int clipWidth = game->viewportWidth, clipHeight = game->viewportWidth / aspectRatio;
|
||||
int clipX = 0, clipY = (game->viewportHeight - clipHeight) / 2;
|
||||
if (clipY <= 0) {
|
||||
clipHeight = game->viewportHeight;
|
||||
clipWidth = game->viewportHeight * aspectRatio;
|
||||
clipX = (game->viewportWidth - clipWidth) / 2;
|
||||
clipY = 0;
|
||||
}
|
||||
al_set_clipping_rectangle(clipX, clipY, clipWidth, clipHeight);
|
||||
|
||||
/*float scaleX = (float)clipWidth / (float)800,
|
||||
scaleY = (float)clipHeight / (float)500;*/
|
||||
ALLEGRO_TRANSFORM projection;
|
||||
al_build_transform(&projection, clipX, clipY, 1, 1, 0.0f);
|
||||
al_use_transform(&projection);
|
||||
game->viewportWidth = clipWidth;
|
||||
game->viewportHeight = clipHeight;
|
||||
}
|
||||
}
|
||||
|
||||
int Shared_Load(struct Game *game) {
|
||||
game->font = al_load_ttf_font("data/ShadowsIntoLight.ttf",al_get_display_height(game->display)*0.09,0 );
|
||||
game->font = al_load_ttf_font("data/ShadowsIntoLight.ttf",game->viewportHeight*0.09,0 );
|
||||
if(!game->font) {
|
||||
fprintf(stderr, "failed to load game font!\n");
|
||||
return -1;
|
||||
}
|
||||
game->font_console = al_load_ttf_font("data/DejaVuSansMono.ttf",al_get_display_height(game->display)*0.018,0 );
|
||||
game->font_console = al_load_ttf_font("data/DejaVuSansMono.ttf",game->viewportHeight*0.018,0 );
|
||||
if(!game->font_console) {
|
||||
fprintf(stderr, "failed to load console font!\n");
|
||||
return -1;
|
||||
}
|
||||
game->console = al_create_bitmap(al_get_display_width(game->display), al_get_display_height(game->display)*0.12);
|
||||
game->console = al_create_bitmap(game->viewportWidth, game->viewportHeight*0.12);
|
||||
al_set_target_bitmap(game->console);
|
||||
al_clear_to_color(al_map_rgba(0,0,0,80));
|
||||
al_set_target_bitmap(al_get_backbuffer(game->display));
|
||||
|
@ -370,11 +395,15 @@ int main(int argc, char **argv){
|
|||
if (game.fullscreen) al_hide_mouse_cursor(game.display);
|
||||
al_inhibit_screensaver(true);
|
||||
|
||||
SetupViewport(&game);
|
||||
|
||||
al_set_new_bitmap_flags(ALLEGRO_MAG_LINEAR | ALLEGRO_MIN_LINEAR);
|
||||
|
||||
int ret = Shared_Load(&game);
|
||||
if (ret!=0) return ret;
|
||||
|
||||
PrintConsole(&game, "Viewport %dx%d", game.viewportWidth, game.viewportHeight);
|
||||
|
||||
game.event_queue = al_create_event_queue();
|
||||
if(!game.event_queue) {
|
||||
fprintf(stderr, "failed to create event_queue!\n");
|
||||
|
@ -446,25 +475,6 @@ int main(int argc, char **argv){
|
|||
break;
|
||||
}
|
||||
|
||||
if (atoi(GetConfigOptionDefault("SuperDerpy", "letterbox", "0"))) {
|
||||
float const aspectRatio = (float)800 / (float)500;
|
||||
int clipWidth = al_get_display_width(game.display), clipHeight = al_get_display_width(game.display) / aspectRatio;
|
||||
int clipX = 0, clipY = (al_get_display_height(game.display) - clipHeight) / 2;
|
||||
if (clipY <= 0) {
|
||||
clipHeight = al_get_display_height(game.display);
|
||||
clipWidth = al_get_display_height(game.display) * aspectRatio;
|
||||
clipX = (al_get_display_width(game.display) - clipWidth) / 2;
|
||||
clipY = 0;
|
||||
}
|
||||
al_set_clipping_rectangle(clipX, clipY, clipWidth, clipHeight);
|
||||
|
||||
float scaleX = (float)clipWidth / (float)800,
|
||||
scaleY = (float)clipHeight / (float)500;
|
||||
ALLEGRO_TRANSFORM projection;
|
||||
al_build_transform(&projection, clipX, clipY, scaleX, scaleY, 0.0f);
|
||||
al_use_transform(&projection);
|
||||
}
|
||||
|
||||
while(1) {
|
||||
ALLEGRO_EVENT ev;
|
||||
bool event = false;
|
||||
|
|
|
@ -270,6 +270,8 @@ struct Game {
|
|||
ALLEGRO_EVENT_QUEUE *event_queue; /*!< Main event queue. */
|
||||
ALLEGRO_TIMER *timer; /*!< Main FPS timer. */
|
||||
ALLEGRO_BITMAP *console; /*!< Bitmap with game console. */
|
||||
int viewportWidth; /*!< Actual available width of viewport. */
|
||||
int viewportHeight; /*!< Actual available height of viewport. */
|
||||
bool showconsole; /*!< If true, game console is rendered on screen. */
|
||||
int fx; /*!< Effects volume. */
|
||||
int music; /*!< Music volume. */
|
||||
|
@ -332,4 +334,7 @@ int Shared_Load(struct Game *game);
|
|||
/*! \brief Unload shared resources. */
|
||||
void Shared_Unload(struct Game *game);
|
||||
|
||||
/*! \brief Setups letterbox viewport if necessary. */
|
||||
void SetupViewport(struct Game *game);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -52,7 +52,7 @@ void Map_Draw(struct Game *game) {
|
|||
y=0.65;
|
||||
break;
|
||||
}
|
||||
al_draw_scaled_bitmap(game->map.arrow, 0, 0, al_get_bitmap_width(game->map.arrow), al_get_bitmap_height(game->map.arrow), al_get_display_width(game->display)*x, al_get_display_height(game->display)*y + ((sin(game->map.arrowpos)+0.5)/20.0)*al_get_display_height(game->display), al_get_display_width(game->display)*0.1, al_get_display_height(game->display)*0.16, 0);
|
||||
al_draw_scaled_bitmap(game->map.arrow, 0, 0, al_get_bitmap_width(game->map.arrow), al_get_bitmap_height(game->map.arrow), game->viewportWidth*x, game->viewportHeight*y + ((sin(game->map.arrowpos)+0.5)/20.0)*game->viewportHeight, game->viewportWidth*0.1, game->viewportHeight*0.16, 0);
|
||||
game->map.arrowpos += tps(game, 0.1*60);
|
||||
}
|
||||
|
||||
|
@ -106,11 +106,11 @@ void Map_Preload(struct Game *game, void (*progress)(struct Game*, float)) {
|
|||
PrintConsole(game, "Last level available: %d", game->map.selected);
|
||||
game->map.arrowpos = 0;
|
||||
|
||||
game->map.map_bg = LoadScaledBitmap("map/background.png", al_get_display_width(game->display), al_get_display_height(game->display));
|
||||
game->map.map_bg = LoadScaledBitmap("map/background.png", game->viewportWidth, game->viewportHeight);
|
||||
PROGRESS;
|
||||
char filename[30] = { };
|
||||
sprintf(filename, "map/highlight%d.png", game->map.available);
|
||||
game->map.highlight = LoadScaledBitmap(filename, al_get_display_width(game->display), al_get_display_height(game->display));
|
||||
game->map.highlight = LoadScaledBitmap(filename, game->viewportWidth, game->viewportHeight);
|
||||
PROGRESS;
|
||||
|
||||
game->map.arrow = al_load_bitmap( "data/map/arrow.png" );
|
||||
|
@ -138,7 +138,7 @@ void Map_Preload(struct Game *game, void (*progress)(struct Game*, float)) {
|
|||
exit(-1);
|
||||
}
|
||||
|
||||
game->map.map = LoadScaledBitmap("table.png", al_get_display_width(game->display), al_get_display_height(game->display));
|
||||
game->map.map = LoadScaledBitmap("table.png", game->viewportWidth, game->viewportHeight);
|
||||
PROGRESS;
|
||||
al_set_target_bitmap(game->map.map);
|
||||
al_draw_bitmap(game->map.map_bg, 0, 0 ,0);
|
||||
|
|
120
src/menu.c
120
src/menu.c
|
@ -30,39 +30,39 @@ void DrawMenuState(struct Game *game) {
|
|||
switch (game->menu.menustate) {
|
||||
case MENUSTATE_MAIN:
|
||||
font = game->menu.font; if (game->menu.selected==0) font = game->menu.font_selected;
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), al_get_display_width(game->display)*0.5, al_get_display_height(game->display)*0.5, ALLEGRO_ALIGN_CENTRE, "Start game");
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), game->viewportWidth*0.5, game->viewportHeight*0.5, ALLEGRO_ALIGN_CENTRE, "Start game");
|
||||
font = game->menu.font; if (game->menu.selected==1) font = game->menu.font_selected;
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), al_get_display_width(game->display)*0.5, al_get_display_height(game->display)*0.6, ALLEGRO_ALIGN_CENTRE, "Options");
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), game->viewportWidth*0.5, game->viewportHeight*0.6, ALLEGRO_ALIGN_CENTRE, "Options");
|
||||
font = game->menu.font; if (game->menu.selected==2) font = game->menu.font_selected;
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), al_get_display_width(game->display)*0.5, al_get_display_height(game->display)*0.7, ALLEGRO_ALIGN_CENTRE, "About");
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), game->viewportWidth*0.5, game->viewportHeight*0.7, ALLEGRO_ALIGN_CENTRE, "About");
|
||||
font = game->menu.font; if (game->menu.selected==3) font = game->menu.font_selected;
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), al_get_display_width(game->display)*0.5, al_get_display_height(game->display)*0.8, ALLEGRO_ALIGN_CENTRE, "Exit");
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), game->viewportWidth*0.5, game->viewportHeight*0.8, ALLEGRO_ALIGN_CENTRE, "Exit");
|
||||
break;
|
||||
case MENUSTATE_OPTIONS:
|
||||
font = game->menu.font; if (game->menu.selected==0) font = game->menu.font_selected;
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), al_get_display_width(game->display)*0.5, al_get_display_height(game->display)*0.5, ALLEGRO_ALIGN_CENTRE, "Control settings");
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), game->viewportWidth*0.5, game->viewportHeight*0.5, ALLEGRO_ALIGN_CENTRE, "Control settings");
|
||||
font = game->menu.font; if (game->menu.selected==1) font = game->menu.font_selected;
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), al_get_display_width(game->display)*0.5, al_get_display_height(game->display)*0.6, ALLEGRO_ALIGN_CENTRE, "Video settings");
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), game->viewportWidth*0.5, game->viewportHeight*0.6, ALLEGRO_ALIGN_CENTRE, "Video settings");
|
||||
font = game->menu.font; if (game->menu.selected==2) font = game->menu.font_selected;
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), al_get_display_width(game->display)*0.5, al_get_display_height(game->display)*0.7, ALLEGRO_ALIGN_CENTRE, "Audio settings");
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), game->viewportWidth*0.5, game->viewportHeight*0.7, ALLEGRO_ALIGN_CENTRE, "Audio settings");
|
||||
font = game->menu.font; if (game->menu.selected==3) font = game->menu.font_selected;
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), al_get_display_width(game->display)*0.5, al_get_display_height(game->display)*0.8, ALLEGRO_ALIGN_CENTRE, "Back");
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), game->viewportWidth*0.5, game->viewportHeight*0.8, ALLEGRO_ALIGN_CENTRE, "Back");
|
||||
break;
|
||||
case MENUSTATE_AUDIO:
|
||||
font = game->menu.font; if (game->menu.selected==0) font = game->menu.font_selected;
|
||||
if (game->music) sprintf(text, "Music volume: %d0%%", game->music);
|
||||
else sprintf(text, "Music disabled");
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), al_get_display_width(game->display)*0.5, al_get_display_height(game->display)*0.5, ALLEGRO_ALIGN_CENTRE, text);
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), game->viewportWidth*0.5, game->viewportHeight*0.5, ALLEGRO_ALIGN_CENTRE, text);
|
||||
font = game->menu.font; if (game->menu.selected==1) font = game->menu.font_selected;
|
||||
if (game->fx) sprintf(text, "Effects volume: %d0%%", game->fx);
|
||||
else sprintf(text, "Effects disabled");
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), al_get_display_width(game->display)*0.5, al_get_display_height(game->display)*0.6, ALLEGRO_ALIGN_CENTRE, text);
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), game->viewportWidth*0.5, game->viewportHeight*0.6, ALLEGRO_ALIGN_CENTRE, text);
|
||||
font = game->menu.font; if (game->menu.selected==2) font = game->menu.font_selected;
|
||||
if (game->voice) sprintf(text, "Voice volume: %d0%%", game->voice);
|
||||
else sprintf(text, "Voice disabled");
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), al_get_display_width(game->display)*0.5, al_get_display_height(game->display)*0.7, ALLEGRO_ALIGN_CENTRE, text);
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), game->viewportWidth*0.5, game->viewportHeight*0.7, ALLEGRO_ALIGN_CENTRE, text);
|
||||
font = game->menu.font; if (game->menu.selected==3) font = game->menu.font_selected;
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), al_get_display_width(game->display)*0.5, al_get_display_height(game->display)*0.8, ALLEGRO_ALIGN_CENTRE, "Back");
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), game->viewportWidth*0.5, game->viewportHeight*0.8, ALLEGRO_ALIGN_CENTRE, "Back");
|
||||
break;
|
||||
case MENUSTATE_VIDEO:
|
||||
if (game->menu.options.fullscreen) {
|
||||
|
@ -74,28 +74,28 @@ void DrawMenuState(struct Game *game) {
|
|||
color = al_map_rgba(255,255,255,255);
|
||||
}
|
||||
font = game->menu.font; if (game->menu.selected==0) font = game->menu.font_selected;
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), al_get_display_width(game->display)*0.5, al_get_display_height(game->display)*0.5, ALLEGRO_ALIGN_CENTRE, text);
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), game->viewportWidth*0.5, game->viewportHeight*0.5, ALLEGRO_ALIGN_CENTRE, text);
|
||||
font = game->menu.font; if (game->menu.selected==1) font = game->menu.font_selected;
|
||||
al_draw_text_with_shadow(font, color, al_get_display_width(game->display)*0.5, al_get_display_height(game->display)*0.6, ALLEGRO_ALIGN_CENTRE, "Resolution: 800x500");
|
||||
al_draw_text_with_shadow(font, color, game->viewportWidth*0.5, game->viewportHeight*0.6, ALLEGRO_ALIGN_CENTRE, "Resolution: 800x500");
|
||||
font = game->menu.font; if (game->menu.selected==2) font = game->menu.font_selected;
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), al_get_display_width(game->display)*0.5, al_get_display_height(game->display)*0.7, ALLEGRO_ALIGN_CENTRE, "FPS: 60");
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), game->viewportWidth*0.5, game->viewportHeight*0.7, ALLEGRO_ALIGN_CENTRE, "FPS: 60");
|
||||
font = game->menu.font; if (game->menu.selected==3) font = game->menu.font_selected;
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), al_get_display_width(game->display)*0.5, al_get_display_height(game->display)*0.8, ALLEGRO_ALIGN_CENTRE, "Back");
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), game->viewportWidth*0.5, game->viewportHeight*0.8, ALLEGRO_ALIGN_CENTRE, "Back");
|
||||
break;
|
||||
case MENUSTATE_PAUSE:
|
||||
font = game->menu.font; if (game->menu.selected==0) font = game->menu.font_selected;
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), al_get_display_width(game->display)*0.5, al_get_display_height(game->display)*0.5, ALLEGRO_ALIGN_CENTRE, "Resume game");
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), game->viewportWidth*0.5, game->viewportHeight*0.5, ALLEGRO_ALIGN_CENTRE, "Resume game");
|
||||
font = game->menu.font; if (game->menu.selected==1) font = game->menu.font_selected;
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), al_get_display_width(game->display)*0.5, al_get_display_height(game->display)*0.6, ALLEGRO_ALIGN_CENTRE, "Return to map");
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), game->viewportWidth*0.5, game->viewportHeight*0.6, ALLEGRO_ALIGN_CENTRE, "Return to map");
|
||||
font = game->menu.font; if (game->menu.selected==2) font = game->menu.font_selected;
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), al_get_display_width(game->display)*0.5, al_get_display_height(game->display)*0.7, ALLEGRO_ALIGN_CENTRE, "Options");
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), game->viewportWidth*0.5, game->viewportHeight*0.7, ALLEGRO_ALIGN_CENTRE, "Options");
|
||||
font = game->menu.font; if (game->menu.selected==3) font = game->menu.font_selected;
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), al_get_display_width(game->display)*0.5, al_get_display_height(game->display)*0.8, ALLEGRO_ALIGN_CENTRE, "Exit");
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), game->viewportWidth*0.5, game->viewportHeight*0.8, ALLEGRO_ALIGN_CENTRE, "Exit");
|
||||
break;
|
||||
default:
|
||||
game->menu.selected=0;
|
||||
font = game->menu.font; if (game->menu.selected==0) font = game->menu.font_selected;
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), al_get_display_width(game->display)*0.5, al_get_display_height(game->display)*0.5, ALLEGRO_ALIGN_CENTRE, "Not implemented yet");
|
||||
al_draw_text_with_shadow(font, al_map_rgb(255,255,255), game->viewportWidth*0.5, game->viewportHeight*0.5, ALLEGRO_ALIGN_CENTRE, "Not implemented yet");
|
||||
break;
|
||||
}
|
||||
free(text);
|
||||
|
@ -121,27 +121,27 @@ void Menu_Draw(struct Game *game) {
|
|||
|
||||
al_clear_to_color(al_map_rgb(183,234,193));
|
||||
float tint = (sin((game->menu.cloud_position-80)/15)+1)/2;
|
||||
if (tint < 0.000004) { PrintConsole(game, "random tint %f", tint); game->menu.mountain_position = (al_get_display_width(game->display)*(rand()/(float)RAND_MAX)/2)+al_get_display_width(game->display)/2; }
|
||||
if (tint < 0.000004) { PrintConsole(game, "random tint %f", tint); game->menu.mountain_position = (game->viewportWidth*(rand()/(float)RAND_MAX)/2)+game->viewportWidth/2; }
|
||||
al_draw_tinted_bitmap(game->menu.mountain,al_map_rgba_f(tint,tint,tint,tint),game->menu.mountain_position, 0,0);
|
||||
al_draw_scaled_bitmap(game->menu.cloud,0,0,al_get_bitmap_width(game->menu.cloud), al_get_bitmap_height(game->menu.cloud), al_get_display_width(game->display)*(sin((game->menu.cloud_position/40)-4.5)-0.3), al_get_display_height(game->display)*0.35, al_get_bitmap_width(game->menu.cloud)/2, al_get_bitmap_height(game->menu.cloud)/2,0);
|
||||
al_draw_bitmap(game->menu.cloud2,al_get_display_width(game->display)*(game->menu.cloud2_position/100.0), al_get_display_height(game->display)/1.5,0);
|
||||
al_draw_bitmap(game->menu.image,0, al_get_display_height(game->display)*0.55,0);
|
||||
al_draw_scaled_bitmap(game->menu.cloud,0,0,al_get_bitmap_width(game->menu.cloud), al_get_bitmap_height(game->menu.cloud), game->viewportWidth*(sin((game->menu.cloud_position/40)-4.5)-0.3), game->viewportHeight*0.35, al_get_bitmap_width(game->menu.cloud)/2, al_get_bitmap_height(game->menu.cloud)/2,0);
|
||||
al_draw_bitmap(game->menu.cloud2,game->viewportWidth*(game->menu.cloud2_position/100.0), game->viewportHeight/1.5,0);
|
||||
al_draw_bitmap(game->menu.image,0, game->viewportHeight*0.55,0);
|
||||
|
||||
al_draw_bitmap(game->menu.pinkcloud_bitmap,(al_get_display_width(game->display)*0.12) + (cos((game->menu.cloud_position/25+80)*1.74444))*40, 0,0);
|
||||
al_draw_bitmap(game->menu.cloud,al_get_display_width(game->display)*game->menu.cloud_position/100, al_get_display_height(game->display)*0.1,0);
|
||||
al_draw_bitmap(game->menu.pinkcloud_bitmap,(game->viewportWidth*0.12) + (cos((game->menu.cloud_position/25+80)*1.74444))*40, 0,0);
|
||||
al_draw_bitmap(game->menu.cloud,game->viewportWidth*game->menu.cloud_position/100, game->viewportHeight*0.1,0);
|
||||
|
||||
al_draw_bitmap(game->menu.pie_bitmap, al_get_display_width(game->display)/2, al_get_display_height(game->display)*(game->menu.cloud_position)/10,0);
|
||||
al_draw_bitmap(game->menu.pie_bitmap, game->viewportWidth/2, game->viewportHeight*(game->menu.cloud_position)/10,0);
|
||||
|
||||
/* GLASS EFFECT */
|
||||
al_set_target_bitmap(game->menu.blurbg);
|
||||
|
||||
al_clear_to_color(al_map_rgb(183,234,193));
|
||||
al_draw_scaled_bitmap(game->menu.cloud,0,0,al_get_bitmap_width(game->menu.cloud), al_get_bitmap_height(game->menu.cloud), al_get_display_width(game->display)*(sin((game->menu.cloud_position/40)-4.5)-0.3) - (al_get_display_width(game->display)/2)+(al_get_bitmap_width(game->menu.logo)/2), al_get_display_height(game->display)*0.35-(al_get_display_height(game->display)*0.1), al_get_bitmap_width(game->menu.cloud)/2, al_get_bitmap_height(game->menu.cloud)/2,0);
|
||||
al_draw_bitmap(game->menu.pinkcloud_bitmap,(al_get_display_width(game->display)*0.12) + (cos((game->menu.cloud_position/25+80)*1.74444))*40 - (al_get_display_width(game->display)/2)+(al_get_bitmap_width(game->menu.logo)/2), -(al_get_display_height(game->display)*0.1),0);
|
||||
al_draw_bitmap(game->menu.cloud,al_get_display_width(game->display)*game->menu.cloud_position/100 - (al_get_display_width(game->display)/2)+(al_get_bitmap_width(game->menu.logo)/2), al_get_display_height(game->display)*0.1-(al_get_display_height(game->display)*0.1),0);
|
||||
al_draw_bitmap(game->menu.pie_bitmap, al_get_display_width(game->display)/2 - (al_get_display_width(game->display)/2)+(al_get_bitmap_width(game->menu.logo)/2), al_get_display_height(game->display)*(game->menu.cloud_position)/10 -(al_get_display_height(game->display)*0.1),0);
|
||||
al_draw_scaled_bitmap(game->menu.cloud,0,0,al_get_bitmap_width(game->menu.cloud), al_get_bitmap_height(game->menu.cloud), game->viewportWidth*(sin((game->menu.cloud_position/40)-4.5)-0.3) - (game->viewportWidth/2)+(al_get_bitmap_width(game->menu.logo)/2), game->viewportHeight*0.35-(game->viewportHeight*0.1), al_get_bitmap_width(game->menu.cloud)/2, al_get_bitmap_height(game->menu.cloud)/2,0);
|
||||
al_draw_bitmap(game->menu.pinkcloud_bitmap,(game->viewportWidth*0.12) + (cos((game->menu.cloud_position/25+80)*1.74444))*40 - (game->viewportWidth/2)+(al_get_bitmap_width(game->menu.logo)/2), -(game->viewportHeight*0.1),0);
|
||||
al_draw_bitmap(game->menu.cloud,game->viewportWidth*game->menu.cloud_position/100 - (game->viewportWidth/2)+(al_get_bitmap_width(game->menu.logo)/2), game->viewportHeight*0.1-(game->viewportHeight*0.1),0);
|
||||
al_draw_bitmap(game->menu.pie_bitmap, game->viewportWidth/2 - (game->viewportWidth/2)+(al_get_bitmap_width(game->menu.logo)/2), game->viewportHeight*(game->menu.cloud_position)/10 -(game->viewportHeight*0.1),0);
|
||||
|
||||
/*al_draw_bitmap_region(al_get_backbuffer(game->display), (al_get_display_width(game->display)/2)-(al_get_bitmap_width(game->menu.logo)/2), (al_get_display_height(game->display)*0.1), al_get_bitmap_width(game->menu.logo), al_get_bitmap_height(game->menu.logo), 0, 0, 0);*/
|
||||
/*al_draw_bitmap_region(al_get_backbuffer(game->display), (game->viewportWidth/2)-(al_get_bitmap_width(game->menu.logo)/2), (game->viewportHeight*0.1), al_get_bitmap_width(game->menu.logo), al_get_bitmap_height(game->menu.logo), 0, 0, 0);*/
|
||||
|
||||
al_set_target_bitmap(game->menu.blurbg2);
|
||||
al_clear_to_color(al_map_rgba(0,0,0,0));
|
||||
|
@ -160,14 +160,14 @@ void Menu_Draw(struct Game *game) {
|
|||
al_draw_bitmap(game->menu.logo, 0, 0, 0);
|
||||
al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA);
|
||||
al_set_target_bitmap(al_get_backbuffer(game->display));
|
||||
al_draw_bitmap(game->menu.blurbg2, (al_get_display_width(game->display)/2)-(al_get_bitmap_width(game->menu.logo)/2), (al_get_display_height(game->display)*0.1), 0);
|
||||
al_draw_bitmap(game->menu.blurbg2, (game->viewportWidth/2)-(al_get_bitmap_width(game->menu.logo)/2), (game->viewportHeight*0.1), 0);
|
||||
|
||||
al_draw_bitmap(game->menu.logoblur, (al_get_display_width(game->display)/2)-(al_get_bitmap_width(game->menu.logo)/2)-2, (al_get_display_height(game->display)*0.1)-2, 0);
|
||||
al_draw_tinted_bitmap(game->menu.logo, al_map_rgba_f(0.1, 0.1, 0.1, 0.1), (al_get_display_width(game->display)/2)-(al_get_bitmap_width(game->menu.logo)/2), (al_get_display_height(game->display)*0.1), 0);
|
||||
al_draw_bitmap(game->menu.logoblur, (game->viewportWidth/2)-(al_get_bitmap_width(game->menu.logo)/2)-2, (game->viewportHeight*0.1)-2, 0);
|
||||
al_draw_tinted_bitmap(game->menu.logo, al_map_rgba_f(0.1, 0.1, 0.1, 0.1), (game->viewportWidth/2)-(al_get_bitmap_width(game->menu.logo)/2), (game->viewportHeight*0.1), 0);
|
||||
/* END OF GLASS EFFECT */
|
||||
|
||||
al_draw_text_with_shadow(game->menu.font_title, al_map_rgb(255,255,255), al_get_display_width(game->display)*0.5, al_get_display_height(game->display)*0.1, ALLEGRO_ALIGN_CENTRE, "Super Derpy");
|
||||
al_draw_text_with_shadow(game->menu.font_subtitle, al_map_rgb(255,255,255), al_get_display_width(game->display)*0.5, al_get_display_height(game->display)*0.275, ALLEGRO_ALIGN_CENTRE, "Muffin Attack");
|
||||
al_draw_text_with_shadow(game->menu.font_title, al_map_rgb(255,255,255), game->viewportWidth*0.5, game->viewportHeight*0.1, ALLEGRO_ALIGN_CENTRE, "Super Derpy");
|
||||
al_draw_text_with_shadow(game->menu.font_subtitle, al_map_rgb(255,255,255), game->viewportWidth*0.5, game->viewportHeight*0.275, ALLEGRO_ALIGN_CENTRE, "Muffin Attack");
|
||||
|
||||
DrawMenuState(game);
|
||||
|
||||
|
@ -185,19 +185,19 @@ void Menu_Preload(struct Game *game, void (*progress)(struct Game*, float)) {
|
|||
game->menu.options.width = game->width;
|
||||
game->menu.options.height = game->height;
|
||||
game->menu.loaded = true;
|
||||
game->menu.image = LoadScaledBitmap( "menu/menu.png", al_get_display_width(game->display), al_get_display_height(game->display)*0.45);
|
||||
game->menu.image = LoadScaledBitmap( "menu/menu.png", game->viewportWidth, game->viewportHeight*0.45);
|
||||
PROGRESS;
|
||||
game->menu.mountain = LoadScaledBitmap( "menu/mountain.png", al_get_display_width(game->display)*0.055, al_get_display_height(game->display)/9 );
|
||||
game->menu.mountain = LoadScaledBitmap( "menu/mountain.png", game->viewportWidth*0.055, game->viewportHeight/9 );
|
||||
PROGRESS;
|
||||
game->menu.cloud = LoadScaledBitmap( "menu/cloud.png", al_get_display_width(game->display)*0.5, al_get_display_height(game->display)*0.25 );
|
||||
game->menu.cloud = LoadScaledBitmap( "menu/cloud.png", game->viewportWidth*0.5, game->viewportHeight*0.25 );
|
||||
PROGRESS;
|
||||
game->menu.cloud2 = LoadScaledBitmap( "menu/cloud2.png", al_get_display_width(game->display)*0.2, al_get_display_height(game->display)*0.1 );
|
||||
game->menu.cloud2 = LoadScaledBitmap( "menu/cloud2.png", game->viewportWidth*0.2, game->viewportHeight*0.1 );
|
||||
PROGRESS;
|
||||
game->menu.logo = LoadScaledBitmap( "menu/logo.png", al_get_display_width(game->display)*0.3, al_get_display_height(game->display)*0.35 );
|
||||
game->menu.blurbg = al_create_bitmap(al_get_display_width(game->display)*0.3, al_get_display_height(game->display)*0.35);
|
||||
game->menu.blurbg2 = al_create_bitmap(al_get_display_width(game->display)*0.3, al_get_display_height(game->display)*0.35);
|
||||
game->menu.logo = LoadScaledBitmap( "menu/logo.png", game->viewportWidth*0.3, game->viewportHeight*0.35 );
|
||||
game->menu.blurbg = al_create_bitmap(game->viewportWidth*0.3, game->viewportHeight*0.35);
|
||||
game->menu.blurbg2 = al_create_bitmap(game->viewportWidth*0.3, game->viewportHeight*0.35);
|
||||
PROGRESS;
|
||||
game->menu.logoblur = al_create_bitmap(al_get_display_width(game->display)*0.3+4, al_get_display_height(game->display)*0.35+4);
|
||||
game->menu.logoblur = al_create_bitmap(game->viewportWidth*0.3+4, game->viewportHeight*0.35+4);
|
||||
al_set_target_bitmap(game->menu.logoblur);
|
||||
al_clear_to_color(al_map_rgba(0,0,0,0));
|
||||
float alpha = (1.0/40.0);
|
||||
|
@ -211,9 +211,9 @@ void Menu_Preload(struct Game *game, void (*progress)(struct Game*, float)) {
|
|||
}
|
||||
al_set_target_bitmap(al_get_backbuffer(game->display));
|
||||
PROGRESS;
|
||||
game->menu.glass = LoadScaledBitmap( "menu/glass.png", al_get_display_width(game->display)*0.3, al_get_display_height(game->display)*0.35 );
|
||||
game->menu.glass = LoadScaledBitmap( "menu/glass.png", game->viewportWidth*0.3, game->viewportHeight*0.35 );
|
||||
PROGRESS;
|
||||
game->menu.pinkcloud = LoadScaledBitmap( "menu/pinkcloud.png", al_get_display_width(game->display)*0.33125, al_get_display_height(game->display)*0.8122);
|
||||
game->menu.pinkcloud = LoadScaledBitmap( "menu/pinkcloud.png", game->viewportWidth*0.33125, game->viewportHeight*0.8122);
|
||||
PROGRESS;
|
||||
al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP);
|
||||
game->menu.rain = al_load_bitmap( "data/menu/rain.png" );
|
||||
|
@ -228,7 +228,7 @@ void Menu_Preload(struct Game *game, void (*progress)(struct Game*, float)) {
|
|||
PROGRESS;
|
||||
game->menu.click_sample = al_load_sample( "data/menu/click.flac" );
|
||||
PROGRESS;
|
||||
game->menu.mountain_position = al_get_display_width(game->display)*0.7;
|
||||
game->menu.mountain_position = game->viewportWidth*0.7;
|
||||
|
||||
game->menu.music = al_create_sample_instance(game->menu.sample);
|
||||
al_attach_sample_instance_to_mixer(game->menu.music, game->audio.music);
|
||||
|
@ -242,10 +242,10 @@ void Menu_Preload(struct Game *game, void (*progress)(struct Game*, float)) {
|
|||
al_attach_sample_instance_to_mixer(game->menu.click, game->audio.fx);
|
||||
al_set_sample_instance_playmode(game->menu.click, ALLEGRO_PLAYMODE_ONCE);
|
||||
|
||||
game->menu.font_title = al_load_ttf_font("data/ShadowsIntoLight.ttf",al_get_display_height(game->display)*0.16,0 );
|
||||
game->menu.font_subtitle = al_load_ttf_font("data/ShadowsIntoLight.ttf",al_get_display_height(game->display)*0.08,0 );
|
||||
game->menu.font = al_load_ttf_font("data/ShadowsIntoLight.ttf",al_get_display_height(game->display)*0.05,0 );
|
||||
game->menu.font_selected = al_load_ttf_font("data/ShadowsIntoLight.ttf",al_get_display_height(game->display)*0.065,0 );
|
||||
game->menu.font_title = al_load_ttf_font("data/ShadowsIntoLight.ttf",game->viewportHeight*0.16,0 );
|
||||
game->menu.font_subtitle = al_load_ttf_font("data/ShadowsIntoLight.ttf",game->viewportHeight*0.08,0 );
|
||||
game->menu.font = al_load_ttf_font("data/ShadowsIntoLight.ttf",game->viewportHeight*0.05,0 );
|
||||
game->menu.font_selected = al_load_ttf_font("data/ShadowsIntoLight.ttf",game->viewportHeight*0.065,0 );
|
||||
PROGRESS;
|
||||
|
||||
if (!game->menu.sample){
|
||||
|
@ -263,14 +263,14 @@ void Menu_Preload(struct Game *game, void (*progress)(struct Game*, float)) {
|
|||
exit(-1);
|
||||
}
|
||||
|
||||
game->menu.pinkcloud_bitmap = al_create_bitmap(al_get_display_width(game->display)*0.33125, al_get_display_height(game->display));
|
||||
game->menu.pinkcloud_bitmap = al_create_bitmap(game->viewportWidth*0.33125, game->viewportHeight);
|
||||
|
||||
game->menu.pie_bitmap = al_create_bitmap(al_get_display_width(game->display)/2, al_get_display_height(game->display));
|
||||
game->menu.pie_bitmap = al_create_bitmap(game->viewportWidth/2, game->viewportHeight);
|
||||
al_set_target_bitmap(game->menu.pie_bitmap);
|
||||
al_clear_to_color(al_map_rgba(0,0,0,0));
|
||||
al_draw_scaled_bitmap(game->menu.pie, 0, 0, al_get_bitmap_width(game->menu.pie), al_get_bitmap_height(game->menu.pie), al_get_bitmap_width(game->menu.pie_bitmap)*0.5, 0, al_get_display_width(game->display)*0.11875, al_get_display_height(game->display)*0.0825, 0);
|
||||
al_draw_scaled_bitmap(game->menu.pie, 0, 0, al_get_bitmap_width(game->menu.pie), al_get_bitmap_height(game->menu.pie), al_get_bitmap_width(game->menu.pie_bitmap)*0.1, al_get_bitmap_height(game->menu.pie_bitmap)*0.3, al_get_display_width(game->display)*0.09, al_get_display_height(game->display)*0.06, ALLEGRO_FLIP_HORIZONTAL);
|
||||
al_draw_scaled_bitmap(game->menu.pie, 0, 0, al_get_bitmap_width(game->menu.pie), al_get_bitmap_height(game->menu.pie), al_get_bitmap_width(game->menu.pie_bitmap)*0.3, al_get_bitmap_height(game->menu.pie_bitmap)*0.6, al_get_display_width(game->display)*0.13, al_get_display_height(game->display)*0.1, 0);
|
||||
al_draw_scaled_bitmap(game->menu.pie, 0, 0, al_get_bitmap_width(game->menu.pie), al_get_bitmap_height(game->menu.pie), al_get_bitmap_width(game->menu.pie_bitmap)*0.5, 0, game->viewportWidth*0.11875, game->viewportHeight*0.0825, 0);
|
||||
al_draw_scaled_bitmap(game->menu.pie, 0, 0, al_get_bitmap_width(game->menu.pie), al_get_bitmap_height(game->menu.pie), al_get_bitmap_width(game->menu.pie_bitmap)*0.1, al_get_bitmap_height(game->menu.pie_bitmap)*0.3, game->viewportWidth*0.09, game->viewportHeight*0.06, ALLEGRO_FLIP_HORIZONTAL);
|
||||
al_draw_scaled_bitmap(game->menu.pie, 0, 0, al_get_bitmap_width(game->menu.pie), al_get_bitmap_height(game->menu.pie), al_get_bitmap_width(game->menu.pie_bitmap)*0.3, al_get_bitmap_height(game->menu.pie_bitmap)*0.6, game->viewportWidth*0.13, game->viewportHeight*0.1, 0);
|
||||
al_destroy_bitmap(game->menu.pie);
|
||||
PROGRESS;
|
||||
|
||||
|
@ -285,7 +285,7 @@ void Menu_Preload(struct Game *game, void (*progress)(struct Game*, float)) {
|
|||
}
|
||||
|
||||
void Menu_Stop(struct Game* game) {
|
||||
game->menu.menu_fade_bitmap = al_create_bitmap(al_get_display_width(game->display), al_get_display_height(game->display));
|
||||
game->menu.menu_fade_bitmap = al_create_bitmap(game->viewportWidth, game->viewportHeight);
|
||||
al_set_target_bitmap(game->menu.menu_fade_bitmap);
|
||||
al_clear_to_color(al_map_rgb(0,0,0));
|
||||
al_set_target_bitmap(al_get_backbuffer(game->display));
|
||||
|
@ -347,7 +347,7 @@ void Menu_Load(struct Game *game) {
|
|||
|
||||
al_play_sample_instance(game->menu.music);
|
||||
al_play_sample_instance(game->menu.rain_sound);
|
||||
game->menu.menu_fade_bitmap = al_create_bitmap(al_get_display_width(game->display), al_get_display_height(game->display));
|
||||
game->menu.menu_fade_bitmap = al_create_bitmap(game->viewportWidth, game->viewportHeight);
|
||||
al_set_target_bitmap(game->menu.menu_fade_bitmap);
|
||||
al_clear_to_color(al_map_rgb(0,0,0));
|
||||
al_set_target_bitmap(al_get_backbuffer(game->display));
|
||||
|
|
|
@ -50,10 +50,10 @@ void Moonwalk_Draw(struct Game *game) {
|
|||
if (game->level.moonwalk.derpy_frame>=24) game->level.moonwalk.derpy_frame=0;
|
||||
}
|
||||
}
|
||||
al_draw_scaled_bitmap(game->level.moonwalk.image,0,0,al_get_bitmap_width(game->level.moonwalk.image),al_get_bitmap_height(game->level.moonwalk.image),0,0,al_get_display_width(game->display), al_get_display_height(game->display),0);
|
||||
al_draw_bitmap(game->level.derpy, game->level.moonwalk.derpy_pos*al_get_display_width(game->display), al_get_display_height(game->display)*0.95-al_get_bitmap_height(game->level.derpy), ALLEGRO_FLIP_HORIZONTAL);
|
||||
al_draw_textf(game->font, al_map_rgb(255,255,255), al_get_display_width(game->display)/2, al_get_display_height(game->display)/2.2, ALLEGRO_ALIGN_CENTRE, "Level %d: Not implemented yet!", game->level.current_level);
|
||||
al_draw_text(game->font, al_map_rgb(255,255,255), al_get_display_width(game->display)/2, al_get_display_height(game->display)/1.8, ALLEGRO_ALIGN_CENTRE, "Have some moonwalk instead.");
|
||||
al_draw_scaled_bitmap(game->level.moonwalk.image,0,0,al_get_bitmap_width(game->level.moonwalk.image),al_get_bitmap_height(game->level.moonwalk.image),0,0,game->viewportWidth, game->viewportHeight,0);
|
||||
al_draw_bitmap(game->level.derpy, game->level.moonwalk.derpy_pos*game->viewportWidth, game->viewportHeight*0.95-al_get_bitmap_height(game->level.derpy), ALLEGRO_FLIP_HORIZONTAL);
|
||||
al_draw_textf(game->font, al_map_rgb(255,255,255), game->viewportWidth/2, game->viewportHeight/2.2, ALLEGRO_ALIGN_CENTRE, "Level %d: Not implemented yet!", game->level.current_level);
|
||||
al_draw_text(game->font, al_map_rgb(255,255,255), game->viewportWidth/2, game->viewportHeight/1.8, ALLEGRO_ALIGN_CENTRE, "Have some moonwalk instead.");
|
||||
}
|
||||
|
||||
void Moonwalk_Load(struct Game *game) {
|
||||
|
@ -79,16 +79,16 @@ int Moonwalk_Keydown(struct Game *game, ALLEGRO_EVENT *ev) {
|
|||
}
|
||||
|
||||
void Moonwalk_PreloadBitmaps(struct Game *game) {
|
||||
game->level.moonwalk.image =LoadScaledBitmap("levels/disco.jpg", al_get_display_width(game->display), al_get_display_height(game->display));
|
||||
/*game->level.derpy_sheet = LoadScaledBitmap("levels/derpcycle.png", al_get_display_width(game->display)*0.1953125*6, al_get_display_height(game->display)*0.25*4);*/
|
||||
game->level.moonwalk.image =LoadScaledBitmap("levels/disco.jpg", game->viewportWidth, game->viewportHeight);
|
||||
/*game->level.derpy_sheet = LoadScaledBitmap("levels/derpcycle.png", game->viewportWidth*0.1953125*6, game->viewportHeight*0.25*4);*/
|
||||
|
||||
game->level.derpy = al_create_bitmap(al_get_display_width(game->display)*0.1953125, al_get_display_height(game->display)*0.25);
|
||||
game->level.derpy = al_create_bitmap(game->viewportWidth*0.1953125, game->viewportHeight*0.25);
|
||||
|
||||
game->level.moonwalk.fade_bitmap = al_create_bitmap(al_get_display_width(game->display), al_get_display_height(game->display));
|
||||
game->level.moonwalk.fade_bitmap = al_create_bitmap(game->viewportWidth, game->viewportHeight);
|
||||
al_set_target_bitmap(game->level.moonwalk.fade_bitmap);
|
||||
al_draw_bitmap(game->level.moonwalk.image,0,0,0);
|
||||
al_draw_textf(game->font, al_map_rgb(255,255,255), al_get_display_width(game->display)/2, al_get_display_height(game->display)/2.2, ALLEGRO_ALIGN_CENTRE, "Level %d: Not implemented yet!", game->level.current_level);
|
||||
al_draw_text(game->font, al_map_rgb(255,255,255), al_get_display_width(game->display)/2, al_get_display_height(game->display)/1.8, ALLEGRO_ALIGN_CENTRE, "Have some moonwalk instead.");
|
||||
al_draw_textf(game->font, al_map_rgb(255,255,255), game->viewportWidth/2, game->viewportHeight/2.2, ALLEGRO_ALIGN_CENTRE, "Level %d: Not implemented yet!", game->level.current_level);
|
||||
al_draw_text(game->font, al_map_rgb(255,255,255), game->viewportWidth/2, game->viewportHeight/1.8, ALLEGRO_ALIGN_CENTRE, "Have some moonwalk instead.");
|
||||
al_set_target_bitmap(al_get_backbuffer(game->display));
|
||||
}
|
||||
|
||||
|
@ -111,12 +111,12 @@ void Moonwalk_UnloadBitmaps(struct Game *game) {
|
|||
|
||||
void Moonwalk_Unload(struct Game *game) {
|
||||
ALLEGRO_EVENT ev;
|
||||
game->level.moonwalk.fade_bitmap = al_create_bitmap(al_get_display_width(game->display), al_get_display_height(game->display));
|
||||
game->level.moonwalk.fade_bitmap = al_create_bitmap(game->viewportWidth, game->viewportHeight);
|
||||
al_set_target_bitmap(game->level.moonwalk.fade_bitmap);
|
||||
al_draw_bitmap(game->level.moonwalk.image,0,0,0);
|
||||
al_draw_bitmap(game->level.derpy, game->level.moonwalk.derpy_pos*al_get_display_width(game->display), al_get_display_height(game->display)*0.95-al_get_bitmap_height(game->level.derpy), ALLEGRO_FLIP_HORIZONTAL);
|
||||
al_draw_textf(game->font, al_map_rgb(255,255,255), al_get_display_width(game->display)/2, al_get_display_height(game->display)/2.2, ALLEGRO_ALIGN_CENTRE, "Level %d: Not implemented yet!", game->level.current_level);
|
||||
al_draw_text(game->font, al_map_rgb(255,255,255), al_get_display_width(game->display)/2, al_get_display_height(game->display)/1.8, ALLEGRO_ALIGN_CENTRE, "Have some moonwalk instead.");
|
||||
al_draw_bitmap(game->level.derpy, game->level.moonwalk.derpy_pos*game->viewportWidth, game->viewportHeight*0.95-al_get_bitmap_height(game->level.derpy), ALLEGRO_FLIP_HORIZONTAL);
|
||||
al_draw_textf(game->font, al_map_rgb(255,255,255), game->viewportWidth/2, game->viewportHeight/2.2, ALLEGRO_ALIGN_CENTRE, "Level %d: Not implemented yet!", game->level.current_level);
|
||||
al_draw_text(game->font, al_map_rgb(255,255,255), game->viewportWidth/2, game->viewportHeight/1.8, ALLEGRO_ALIGN_CENTRE, "Have some moonwalk instead.");
|
||||
al_set_target_bitmap(al_get_backbuffer(game->display));
|
||||
float fadeloop;
|
||||
for(fadeloop=255; fadeloop>=0; fadeloop-=tps(game, 600)){
|
||||
|
|
20
src/pause.c
20
src/pause.c
|
@ -40,9 +40,11 @@ int Pause_Keydown(struct Game *game, ALLEGRO_EVENT *ev) {
|
|||
if (game->fullscreen) al_hide_mouse_cursor(game->display);
|
||||
else al_show_mouse_cursor(game->display);
|
||||
Shared_Unload(game);
|
||||
Shared_Load(game);
|
||||
al_clear_to_color(al_map_rgb(0,0,0));
|
||||
al_draw_text_with_shadow(game->font, al_map_rgb(255,255,255), al_get_display_width(game->display)*0.0234, al_get_display_height(game->display)*0.85, ALLEGRO_ALIGN_LEFT, "Loading...");
|
||||
al_flip_display();
|
||||
SetupViewport(game);
|
||||
Shared_Load(game);
|
||||
al_draw_text_with_shadow(game->font, al_map_rgb(255,255,255), game->viewportWidth*0.0234, game->viewportHeight*0.85, ALLEGRO_ALIGN_LEFT, "Loading...");
|
||||
al_flip_display();
|
||||
Loading_Unload(game);
|
||||
Loading_Load(game);
|
||||
|
@ -60,7 +62,7 @@ int Pause_Keydown(struct Game *game, ALLEGRO_EVENT *ev) {
|
|||
|
||||
void Pause_Preload(struct Game* game) {
|
||||
game->pause.bitmap = NULL;
|
||||
game->pause.derpy = LoadScaledBitmap("levels/derpy_pause.png", al_get_display_width(game->display)*0.53, al_get_display_height(game->display)*0.604);
|
||||
game->pause.derpy = LoadScaledBitmap("levels/derpy_pause.png", game->viewportWidth*0.53, game->viewportHeight*0.604);
|
||||
PrintConsole(game,"Pause preloaded.");
|
||||
if (!game->menu.loaded) {
|
||||
PrintConsole(game,"Pause: Preloading GAMESTATE_MENU...");
|
||||
|
@ -74,15 +76,15 @@ void Pause_Load(struct Game* game) {
|
|||
DrawGameState(game);
|
||||
game->loadstate=game->gamestate;
|
||||
game->gamestate=GAMESTATE_PAUSE;
|
||||
ALLEGRO_BITMAP *fade = al_create_bitmap(al_get_display_width(game->display), al_get_display_height(game->display));
|
||||
ALLEGRO_BITMAP *fade = al_create_bitmap(game->viewportWidth, game->viewportHeight);
|
||||
al_set_target_bitmap(fade);
|
||||
al_clear_to_color(al_map_rgb(0,0,0));
|
||||
al_set_target_bitmap(al_get_backbuffer(game->display));
|
||||
al_draw_tinted_bitmap(fade,al_map_rgba_f(1,1,1,0.75),0,0,0);
|
||||
game->pause.bitmap = al_create_bitmap(al_get_display_width(game->display), al_get_display_height(game->display));
|
||||
game->pause.bitmap = al_create_bitmap(game->viewportWidth, game->viewportHeight);
|
||||
al_set_target_bitmap(game->pause.bitmap);
|
||||
al_draw_bitmap(al_get_backbuffer(game->display), 0, 0, 0);
|
||||
al_draw_bitmap(game->pause.derpy, 0.47*al_get_display_width(game->display), al_get_display_height(game->display)*0.396, 0);
|
||||
al_draw_bitmap(al_get_backbuffer(game->display), -1*(al_get_display_width(game->display)-game->viewportWidth)/2, -1*(al_get_display_height(game->display)-game->viewportHeight)/2, 0);
|
||||
al_draw_bitmap(game->pause.derpy, 0.47*game->viewportWidth, game->viewportHeight*0.396, 0);
|
||||
al_set_target_bitmap(al_get_backbuffer(game->display));
|
||||
al_destroy_bitmap(fade);
|
||||
ChangeMenuState(game,MENUSTATE_PAUSE);
|
||||
|
@ -92,8 +94,8 @@ void Pause_Load(struct Game* game) {
|
|||
|
||||
void Pause_Draw(struct Game* game) {
|
||||
al_draw_bitmap(game->pause.bitmap, 0, 0, 0);
|
||||
al_draw_text_with_shadow(game->menu.font_title, al_map_rgb(255,255,255), al_get_display_width(game->display)*0.5, al_get_display_height(game->display)*0.1, ALLEGRO_ALIGN_CENTRE, "Super Derpy");
|
||||
al_draw_text_with_shadow(game->menu.font_subtitle, al_map_rgb(255,255,255), al_get_display_width(game->display)*0.5, al_get_display_height(game->display)*0.275, ALLEGRO_ALIGN_CENTRE, "Game paused.");
|
||||
al_draw_text_with_shadow(game->menu.font_title, al_map_rgb(255,255,255), game->viewportWidth*0.5, game->viewportHeight*0.1, ALLEGRO_ALIGN_CENTRE, "Super Derpy");
|
||||
al_draw_text_with_shadow(game->menu.font_subtitle, al_map_rgb(255,255,255), game->viewportWidth*0.5, game->viewportHeight*0.275, ALLEGRO_ALIGN_CENTRE, "Game paused.");
|
||||
|
||||
DrawMenuState(game);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue