Terminal overlay effect

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 3 years ago
parent 2439c7d728
commit bd01a1103d
  1. 23
      SeasonsOfLoneliness.cpp
  2. 3
      data.h
  3. 2
      pixelGameEngine.h

@ -27,6 +27,8 @@ public:
int textInd=0; int textInd=0;
int cursorX=0; int cursorX=0;
int transitionTime=0; int transitionTime=0;
bool fade=false;
int transparency=0;
int frameCount=0; int frameCount=0;
float elapsedTime=0; float elapsedTime=0;
const float TARGET_RATE = 1/60.0; const float TARGET_RATE = 1/60.0;
@ -40,6 +42,10 @@ public:
return true; return true;
} }
bool GetAnyKey() {
cout << "Something has changed.";
}
bool OnUserUpdate(float fElapsedTime) override bool OnUserUpdate(float fElapsedTime) override
{ {
elapsedTime+=fElapsedTime; elapsedTime+=fElapsedTime;
@ -48,9 +54,6 @@ public:
updateGame(); updateGame();
} }
if (GetKey(olc::A).bPressed) {
}
drawGame(); drawGame();
// called once per frame // called once per frame
return true; return true;
@ -58,6 +61,12 @@ public:
void updateGame(){ void updateGame(){
frameCount++; frameCount++;
if (fade&&transparency>0) {
transparency--;
} else
if (!fade&&transparency<255) {
transparency++;
}
switch (GAME_STATE) { switch (GAME_STATE) {
case CUTSCENE_1:{ case CUTSCENE_1:{
if (textInd<STORY_TEXT1.length()) { if (textInd<STORY_TEXT1.length()) {
@ -89,6 +98,7 @@ public:
void drawGame(){ void drawGame(){
switch (GAME_STATE) { switch (GAME_STATE) {
FillRectDecal({0,0},{WIDTH,HEIGHT},olc::Pixel(0,0,0,transparency));
case CUTSCENE_1:{ case CUTSCENE_1:{
DrawStringDecal({16,16},CUTSCENE_CONSOLE_TEXT,olc::GREEN,{1,1}); DrawStringDecal({16,16},CUTSCENE_CONSOLE_TEXT,olc::GREEN,{1,1});
if (textInd<STORY_TEXT1.length()) { if (textInd<STORY_TEXT1.length()) {
@ -103,6 +113,13 @@ public:
}break; }break;
} }
} }
void fadeOut() {
fade=true;
}
void fadeIn() {
fade=false;
}
}; };

@ -9,4 +9,5 @@ GPSNAV-26 - UNABLE TO LOCATE
GPSNAV-31 - UNABLE TO LOCATE GPSNAV-31 - UNABLE TO LOCATE
GPSNAV-33 - UNABLE TO LOCATE GPSNAV-33 - UNABLE TO LOCATE
GPSNAV-35 - UNABLE TO LOCATE GPSNAV-35 - UNABLE TO LOCATE
)";
Press any key to continue.)";

@ -928,6 +928,7 @@ namespace olc
virtual bool OnUserUpdate(float fElapsedTime); virtual bool OnUserUpdate(float fElapsedTime);
// Called once on application termination, so you can be one clean coder // Called once on application termination, so you can be one clean coder
virtual bool OnUserDestroy(); virtual bool OnUserDestroy();
virtual bool GetAnyKey();
// Called when a text entry is confirmed with "enter" key // Called when a text entry is confirmed with "enter" key
virtual void OnTextEntryComplete(const std::string& sText); virtual void OnTextEntryComplete(const std::string& sText);
@ -3453,6 +3454,7 @@ namespace olc
pKeys[i].bReleased = true; pKeys[i].bReleased = true;
pKeys[i].bHeld = false; pKeys[i].bHeld = false;
} }
GetAnyKey();
} }
pStateOld[i] = pStateNew[i]; pStateOld[i] = pStateNew[i];
} }

Loading…
Cancel
Save