Working on the typing output.
This commit is contained in:
parent
f5b2925bdf
commit
657b97c4a8
|
@ -1,8 +1,13 @@
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
#include <cstring>
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
class Sleep{
|
class Sleep{
|
||||||
public:
|
public:
|
||||||
void delay(int milliseconds);
|
void delay(int milliseconds);
|
||||||
|
void type(string text);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
#include "include/intro.h"
|
#include "include/intro.h"
|
||||||
|
|
||||||
void Intro::mainIntro(){
|
void Intro::mainIntro(){
|
||||||
cout << "The world didn't end with a bang. It ended with a groan.. and the scratching of death fingers against steel shutters." << endl;
|
Sleep sleep;
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(3000));
|
int time = 2000;
|
||||||
|
sleep.delay(time);
|
||||||
|
sleep.type("The world didn't end with a bang. It ended with a groan.. and the scratching of death fingers against steel shutters.");
|
||||||
|
sleep.delay(time);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,3 +8,18 @@ void Sleep::delay(int milliseconds){
|
||||||
// Do nothing, just wait
|
// Do nothing, just wait
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void Sleep::type(string text){
|
||||||
|
int a = text.size();
|
||||||
|
char* charArray = new char[a+1];
|
||||||
|
strcpy(charArray, text.c_str());
|
||||||
|
int i = 0;
|
||||||
|
int time = 300;
|
||||||
|
|
||||||
|
while(i < a+1){
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(time));
|
||||||
|
cout << charArray[i] << flush;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
cout << endl;
|
||||||
|
delete[] charArray;
|
||||||
|
}
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
#include "include/title.h"
|
#include "include/title.h"
|
||||||
#include "include/print.h"
|
#include "include/print.h"
|
||||||
|
#include "include/sleep.h"
|
||||||
|
|
||||||
void Title::mainTitle(){
|
void Title::mainTitle(){
|
||||||
int s = 2000;
|
Sleep sleep;
|
||||||
Print print;
|
int time = 700;
|
||||||
print.println("███████╗██╗ ██╗ ██████╗ ████████╗ ██████╗ ██╗ ██╗███╗ ██╗ ██████╗ ███████╗████████╗███████╗");
|
cout << "███████╗██╗ ██╗ ██████╗ ████████╗ ██████╗ ██╗ ██╗███╗ ██╗ ██████╗ ███████╗████████╗███████╗" << endl;
|
||||||
usleep(s);
|
sleep.delay(time);
|
||||||
print.println("██╔════╝██║ ██║██╔═══██╗╚══██╔══╝██╔════╝ ██║ ██║████╗ ██║ ██╔══██╗██╔════╝╚══██╔══╝██╔════╝");
|
cout << "██╔════╝██║ ██║██╔═══██╗╚══██╔══╝██╔════╝ ██║ ██║████╗ ██║ ██╔══██╗██╔════╝╚══██╔══╝██╔════╝" << endl;
|
||||||
usleep(s);
|
sleep.delay(time);
|
||||||
print.println("███████╗███████║██║ ██║ ██║ ██║ ███╗██║ ██║██╔██╗ ██║ ██████╔╝█████╗ ██║ █████╗ ");
|
cout << "███████╗███████║██║ ██║ ██║ ██║ ███╗██║ ██║██╔██╗ ██║ ██████╔╝█████╗ ██║ █████╗ " << endl;
|
||||||
usleep(s);
|
sleep.delay(time);
|
||||||
print.println("╚════██║██╔══██║██║ ██║ ██║ ██║ ██║██║ ██║██║╚██╗██║ ██╔═══╝ ██╔══╝ ██║ ██╔══╝ ");
|
cout << "╚════██║██╔══██║██║ ██║ ██║ ██║ ██║██║ ██║██║╚██╗██║ ██╔═══╝ ██╔══╝ ██║ ██╔══╝ " << endl;
|
||||||
usleep(s);
|
sleep.delay(time);
|
||||||
print.println("███████║██║ ██║╚██████╔╝ ██║ ╚██████╔╝╚██████╔╝██║ ╚████║ ██║ ███████╗ ██║ ███████╗");
|
cout << "███████║██║ ██║╚██████╔╝ ██║ ╚██████╔╝╚██████╔╝██║ ╚████║ ██║ ███████╗ ██║ ███████╗" << endl;
|
||||||
usleep(s);
|
sleep.delay(time);
|
||||||
print.println("╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═╝ ╚══════╝ ╚═╝ ╚══════╝");
|
cout << "╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═╝ ╚══════╝ ╚═╝ ╚══════╝" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue