generated from sigonasr2/CPlusPlusProjectTemplate
Terminal overlay effect
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
2439c7d728
commit
bd01a1103d
@ -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<STORY_TEXT1.length()) {
|
||||
@ -89,6 +98,7 @@ public:
|
||||
|
||||
void drawGame(){
|
||||
switch (GAME_STATE) {
|
||||
FillRectDecal({0,0},{WIDTH,HEIGHT},olc::Pixel(0,0,0,transparency));
|
||||
case CUTSCENE_1:{
|
||||
DrawStringDecal({16,16},CUTSCENE_CONSOLE_TEXT,olc::GREEN,{1,1});
|
||||
if (textInd<STORY_TEXT1.length()) {
|
||||
@ -103,6 +113,13 @@ public:
|
||||
}break;
|
||||
}
|
||||
}
|
||||
|
||||
void fadeOut() {
|
||||
fade=true;
|
||||
}
|
||||
void fadeIn() {
|
||||
fade=false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
3
data.h
3
data.h
@ -9,4 +9,5 @@ GPSNAV-26 - UNABLE TO LOCATE
|
||||
GPSNAV-31 - UNABLE TO LOCATE
|
||||
GPSNAV-33 - UNABLE TO LOCATE
|
||||
GPSNAV-35 - UNABLE TO LOCATE
|
||||
)";
|
||||
|
||||
Press any key to continue.)";
|
@ -928,6 +928,7 @@ namespace olc
|
||||
virtual bool OnUserUpdate(float fElapsedTime);
|
||||
// Called once on application termination, so you can be one clean coder
|
||||
virtual bool OnUserDestroy();
|
||||
virtual bool GetAnyKey();
|
||||
|
||||
// Called when a text entry is confirmed with "enter" key
|
||||
virtual void OnTextEntryComplete(const std::string& sText);
|
||||
@ -3453,6 +3454,7 @@ namespace olc
|
||||
pKeys[i].bReleased = true;
|
||||
pKeys[i].bHeld = false;
|
||||
}
|
||||
GetAnyKey();
|
||||
}
|
||||
pStateOld[i] = pStateNew[i];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user