diff options
author | Aki <please@ignore.pl> | 2022-04-01 21:23:39 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-04-01 21:23:39 +0200 |
commit | 3c487c5cd69c53d6fea948643c0a76df03516605 (patch) | |
tree | 72730c7b8b26a5ef8fc9a987ec4c16129efd5aac /Stars45/FadeView.cpp | |
parent | 8f353abd0bfe18baddd8a8250ab7c4f2d1c83a6e (diff) | |
download | starshatter-3c487c5cd69c53d6fea948643c0a76df03516605.zip starshatter-3c487c5cd69c53d6fea948643c0a76df03516605.tar.gz starshatter-3c487c5cd69c53d6fea948643c0a76df03516605.tar.bz2 |
Moved Stars45 to StarsEx
Diffstat (limited to 'Stars45/FadeView.cpp')
-rw-r--r-- | Stars45/FadeView.cpp | 133 |
1 files changed, 0 insertions, 133 deletions
diff --git a/Stars45/FadeView.cpp b/Stars45/FadeView.cpp deleted file mode 100644 index 7abb3bc..0000000 --- a/Stars45/FadeView.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* Starshatter: The Open Source Project - Copyright (c) 2021-2022, Starshatter: The Open Source Project Contributors - Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors - Copyright (c) 1997-2006, Destroyer Studios LLC. - - AUTHOR: John DiCamillo - - - OVERVIEW - ======== - Fading Bitmap "billboard" Image View class -*/ - -#include "FadeView.h" -#include "Color.h" -#include "Window.h" -#include "Video.h" -#include "Screen.h" -#include "Clock.h" - -// +--------------------------------------------------------------------+ - -FadeView::FadeView(Window* c, double in, double out, double hold) -: View(c), -fade_in(in), -fade_out(out), -hold_time(hold), -step_time(0), -fast(1) -{ - state = StateStart; -} - -FadeView::~FadeView() -{ } - -// +--------------------------------------------------------------------+ - -void FadeView::FastFade(int fade_fast) { fast = fade_fast; } -void FadeView::FadeIn(double in) { fade_in = in; } -void FadeView::FadeOut(double out) { fade_out = out; } -void FadeView::StopHold() -{ - //Print(" FadeView::StopHold()\n"); - hold_time = 0; -} - -// +--------------------------------------------------------------------+ - -void -FadeView::Refresh() -{ - double msec = Clock::GetInstance()->GuiDelta(); - - switch (state) { - case StateStart: - if (fade_in) { - //Print(" * FadeView: %f, %f, %f\n", fade_in, fade_out, hold_time); - Color::SetFade(0); - //Print(" 1. FadeView SetFade to 0 (%6.1f)\n", time); - } - - step_time = 0; - state = State2; - break; - - case State2: - if (fade_in) { - Color::SetFade(0); - //Print(" 1. FadeView SetFade to 0 (%6.1f)\n", time); - } - - step_time = 0; - state = StateIn; - break; - - case StateIn: - if (step_time < fade_in) { - double fade = step_time / fade_in; - Color::SetFade(fade); - //Print(" 2. FadeView SetFade to %3d (%6.1f) %6.1f\n", (int) (fade * 100), time, step_time); - step_time += msec; - } - else { - Color::SetFade(1); - //Print(" 2. FadeView SetFade to %3d (%6.1f) %6.1f => HOLDING\n", 100, time, step_time); - step_time = 0; - state = StateHold; - } - break; - - case StateHold: - if (step_time < hold_time) { - step_time += msec; - //Print(" 3. FadeView holding at %3d (%6.1f) %6.1f\n", 100, time, step_time); - } - else { - //Print(" 3. FadeView HOLD COMPLETE (%6.1f) %6.1f\n", time, step_time); - step_time = 0; - state = StateOut; - } - break; - - case StateOut: - if (fade_out > 0) { - if (step_time < fade_out) { - double fade = 1 - step_time / fade_out; - Color::SetFade(fade); - //Print(" 4. FadeView SetFade to %3d (%6.1f) %6.1f\n", (int) (fade*100), time, step_time); - step_time += msec; - } - else { - Color::SetFade(0); - //Print(" 4. FadeView SetFade to %3d (%6.1f) %6.1f\n", 0, time, step_time); - step_time = 0; - state = StateDone; - } - } - else { - Color::SetFade(1); - //Print(" 4. FadeView SetFade to %3d (%6.1f) %6.1f\n", 0, time, step_time); - step_time = 0; - state = StateDone; - } - break; - - default: - case StateDone: - //Print(" 5. FadeView done (%6.1f) %6.1f\n", time, step_time); - break; - } -} - |