From aa07a1094fb48b5d09ec2a1cb309ae33cb1dba68 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Tue, 15 Sep 2020 23:06:36 +0200 Subject: [PATCH] Removed deprecated LaunchAnimation.h --- es-app/CMakeLists.txt | 1 - es-app/src/animations/LaunchAnimation.h | 91 ------------------------- 2 files changed, 92 deletions(-) delete mode 100644 es-app/src/animations/LaunchAnimation.h diff --git a/es-app/CMakeLists.txt b/es-app/CMakeLists.txt index 8dffc00b5..39a5beca3 100644 --- a/es-app/CMakeLists.txt +++ b/es-app/CMakeLists.txt @@ -48,7 +48,6 @@ set(ES_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/views/UIModeController.h # Animations - ${CMAKE_CURRENT_SOURCE_DIR}/src/animations/LaunchAnimation.h ${CMAKE_CURRENT_SOURCE_DIR}/src/animations/MoveCameraAnimation.h ) diff --git a/es-app/src/animations/LaunchAnimation.h b/es-app/src/animations/LaunchAnimation.h deleted file mode 100644 index cff2e6486..000000000 --- a/es-app/src/animations/LaunchAnimation.h +++ /dev/null @@ -1,91 +0,0 @@ -// -// LaunchAnimation.h -// -// Animation to play when launching a game. -// - -#pragma once -#ifndef ES_APP_ANIMATIONS_LAUNCH_ANIMATION_H -#define ES_APP_ANIMATIONS_LAUNCH_ANIMATION_H - -#include "animations/Animation.h" - -// Let's look at the game launch effect: -// - Move camera to center on point P (interpolation method: linear). -// - Zoom camera to factor Z via matrix scale (interpolation method: exponential). -// - Fade screen to black at rate F (interpolation method: exponential). - -// How the animation gets constructed from the example of implementing the game launch effect: -// 1. Current parameters are retrieved through a get() call. -// Ugliness: -// - Have to have a way to get a reference to the animation. -// - Requires additional implementation in some parent objects, -// potentially AnimationController. -// 2. ViewController is passed in LaunchAnimation constructor, applies state through setters. -// Ugliness: -// - Effect only works for ViewController. -// 3. Pass references to ViewController variables - LaunchAnimation(mCameraPos, mFadePerc, target). -// Ugliness: -// - What if ViewController is deleted? --> AnimationController class handles that. -// - No callbacks for changes...but that works well with this style of update, so -// I think it's okay -// 4. Use callbacks to set variables. -// Ugliness: -// - Boilerplate as hell every time. - -// #3 wins. -// Wan't wait to see how this one bites me in the ass. - -class LaunchAnimation : public Animation -{ -public: - // Target is a centerpoint. - LaunchAnimation( - Transform4x4f& camera, - float& fade, - const Vector3f& - target, - int duration) - : mCameraStart(camera), - mTarget(target), - mDuration(duration), - cameraOut(camera), - fadeOut(fade) {} - - int getDuration() const override { return mDuration; } - - void apply(float t) override - { - // TEMPORARY - disabled the launch animations as they don't work properly and more - // work is needed to fix them. This has been done in LaunchAnimation.h instead of in - // ViewController as not calling the animation leads to input not being properly - // consumed. This also needs to be fixed later on. - return; - - cameraOut = Transform4x4f::Identity(); - - float zoom = Math::lerp(1.0, 4.25f, t*t); - cameraOut.scale(zoom); - - const float sw = (float)Renderer::getScreenWidth() / zoom; - const float sh = (float)Renderer::getScreenHeight() / zoom; - - const Vector2f startPoint = Vector2f(-mCameraStart.translation()) + - Vector2f(Renderer::getScreenWidth() / 2.0f, Renderer::getScreenHeight() / 2.0f); - const Vector2f centerPoint = Vector2f().lerp(startPoint, Vector2f(mTarget), - Math::smootherStep(0.0, 1.0, t)); - - cameraOut.translate(Vector3f((sw / 2) - centerPoint.x(), (sh / 2) - centerPoint.y(), 0)); - fadeOut = Math::lerp(0.0, 1.0, t*t); - } - -private: - Transform4x4f mCameraStart; - Vector3f mTarget; - int mDuration; - - Transform4x4f& cameraOut; - float& fadeOut; -}; - -#endif // ES_APP_ANIMATIONS_LAUNCH_ANIMATION_H