X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fshrinkfade.cpp;h=0b579b43068037c5087c0fae19b14099b64cd074;hb=fb8cef6efacc0dff5faaff6dc4aa638289285099;hp=d921efbc97402a8027809db262e101a6eab56dd9;hpb=fea3446f05e1e7673607b835c269d3e8d1929ab3;p=supertux.git diff --git a/src/shrinkfade.cpp b/src/shrinkfade.cpp index d921efbc9..0b579b430 100644 --- a/src/shrinkfade.cpp +++ b/src/shrinkfade.cpp @@ -46,24 +46,11 @@ ShrinkFade::update(float elapsed_time) void ShrinkFade::draw(DrawingContext& context) { - Color black(0, 0, 0); - float left = speedleft * accum_time; - float top = speedtop * accum_time; - float right = SCREEN_WIDTH - speedright * accum_time; - float bottom = SCREEN_HEIGHT - speedbottom * accum_time; - - context.draw_filled_rect(Vector(0, 0), - Vector(left, SCREEN_HEIGHT), - black, LAYER_GUI+1); - context.draw_filled_rect(Vector(0, 0), - Vector(SCREEN_WIDTH, top), - black, LAYER_GUI+1); - context.draw_filled_rect(Vector(right, 0), - Vector(SCREEN_WIDTH, SCREEN_HEIGHT), - black, LAYER_GUI+1); - context.draw_filled_rect(Vector(0, bottom), - Vector(SCREEN_WIDTH, SCREEN_HEIGHT), - black, LAYER_GUI+1); + float progress = accum_time / fade_time; + context.draw_inverse_ellipse(dest, + Vector(2*SCREEN_WIDTH * (1.0f - progress), + 2*SCREEN_HEIGHT * (1.0f - progress)), + Color(0, 0, 0), LAYER_GUI+1); } bool