From: Marek Moeckel Date: Fri, 30 Sep 2005 09:40:17 +0000 (+0000) Subject: cutscene borders fade in and out now X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=59b7aaf55f0375327c1d12d5d68baac9ffa6a317;p=supertux.git cutscene borders fade in and out now SVN-Revision: 2791 --- diff --git a/src/object/display_effect.cpp b/src/object/display_effect.cpp index 3c3bc4c5d..7bf875b4f 100644 --- a/src/object/display_effect.cpp +++ b/src/object/display_effect.cpp @@ -8,7 +8,9 @@ DisplayEffect::DisplayEffect() : type(NO_FADE), fadetime(0), fading(0), black(false) { - cutscene_borders = false; + border_size = 0; + borders_fading = false; + borders_active = false; } DisplayEffect::~DisplayEffect() @@ -18,6 +20,14 @@ DisplayEffect::~DisplayEffect() void DisplayEffect::update(float elapsed_time) { + if (borders_fading) { + if (border_size < 75) border_size += 1.5; + else borders_active = true; + } + else if (borders_active) { + if (border_size > 0) border_size -= 1.5; + else borders_active = false; + } switch(type) { case NO_FADE: return; @@ -68,10 +78,10 @@ DisplayEffect::draw(DrawingContext& context) Color(0, 0, 0, alpha), LAYER_GUI-10); } - if (cutscene_borders) { - context.draw_filled_rect(Vector(0, 0), Vector(SCREEN_WIDTH, 75), + if (borders_fading || borders_active) { + context.draw_filled_rect(Vector(0, 0), Vector(SCREEN_WIDTH, border_size), Color(0, 0, 0, 255), LAYER_GUI-10); - context.draw_filled_rect(Vector(0, SCREEN_HEIGHT - 75), Vector(SCREEN_WIDTH, 75), + context.draw_filled_rect(Vector(0, SCREEN_HEIGHT - border_size), Vector(SCREEN_WIDTH, border_size), Color(0, 0, 0, 255), LAYER_GUI-10); } @@ -111,11 +121,11 @@ DisplayEffect::is_black() void DisplayEffect::sixteen_to_nine() { - cutscene_borders = true; + borders_fading = true; } void DisplayEffect::four_to_three() { - cutscene_borders = false; + borders_fading = false; } diff --git a/src/object/display_effect.hpp b/src/object/display_effect.hpp index f35dd528e..eec97772e 100644 --- a/src/object/display_effect.hpp +++ b/src/object/display_effect.hpp @@ -28,7 +28,9 @@ private: float fadetime; float fading; bool black; - bool cutscene_borders; + bool borders_fading; + bool borders_active; + float border_size; }; #endif