From bd01a1103d0bee68bc0661fc05ec794073e0ad8b Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Fri, 26 Aug 2022 16:01:57 -0500 Subject: [PATCH] Terminal overlay effect Co-authored-by: sigonasr2 --- SeasonsOfLoneliness.cpp | 23 ++++++++++++++++++++--- data.h | 3 ++- pixelGameEngine.h | 2 ++ 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/SeasonsOfLoneliness.cpp b/SeasonsOfLoneliness.cpp index f38cb50..057d723 100644 --- a/SeasonsOfLoneliness.cpp +++ b/SeasonsOfLoneliness.cpp @@ -27,6 +27,8 @@ public: int textInd=0; int cursorX=0; int transitionTime=0; + bool fade=false; + int transparency=0; int frameCount=0; float elapsedTime=0; const float TARGET_RATE = 1/60.0; @@ -40,6 +42,10 @@ public: return true; } + bool GetAnyKey() { + cout << "Something has changed."; + } + bool OnUserUpdate(float fElapsedTime) override { elapsedTime+=fElapsedTime; @@ -48,9 +54,6 @@ public: updateGame(); } - if (GetKey(olc::A).bPressed) { - } - drawGame(); // called once per frame return true; @@ -58,6 +61,12 @@ public: void updateGame(){ frameCount++; + if (fade&&transparency>0) { + transparency--; + } else + if (!fade&&transparency<255) { + transparency++; + } switch (GAME_STATE) { case CUTSCENE_1:{ if (textInd