Working on the typing output.

This commit is contained in:
Justin 2025-05-10 22:48:06 -05:00
parent f5b2925bdf
commit 657b97c4a8
4 changed files with 40 additions and 17 deletions

View File

@ -1,8 +1,13 @@
#include <chrono>
#include <string>
#include <iostream>
#include <cstring>
#include <thread>
using namespace std;
class Sleep{
public:
void delay(int milliseconds);
void type(string text);
};

View File

@ -1,6 +1,9 @@
#include "include/intro.h"
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;
std::this_thread::sleep_for(std::chrono::milliseconds(3000));
Sleep sleep;
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);
}

View File

@ -8,3 +8,18 @@ void Sleep::delay(int milliseconds){
// 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;
}

View File

@ -1,21 +1,21 @@
#include "include/title.h"
#include "include/print.h"
#include "include/sleep.h"
void Title::mainTitle(){
int s = 2000;
Print print;
print.println("███████╗██╗ ██╗ ██████╗ ████████╗ ██████╗ ██╗ ██╗███╗ ██╗ ██████╗ ███████╗████████╗███████╗");
usleep(s);
print.println("██╔════╝██║ ██║██╔═══██╗╚══██╔══╝██╔════╝ ██║ ██║████╗ ██║ ██╔══██╗██╔════╝╚══██╔══╝██╔════╝");
usleep(s);
print.println("███████╗███████║██║ ██║ ██║ ██║ ███╗██║ ██║██╔██╗ ██║ ██████╔╝█████╗ ██║ █████╗ ");
usleep(s);
print.println("╚════██║██╔══██║██║ ██║ ██║ ██║ ██║██║ ██║██║╚██╗██║ ██╔═══╝ ██╔══╝ ██║ ██╔══╝ ");
usleep(s);
print.println("███████║██║ ██║╚██████╔╝ ██║ ╚██████╔╝╚██████╔╝██║ ╚████║ ██║ ███████╗ ██║ ███████╗");
usleep(s);
print.println("╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═╝ ╚══════╝ ╚═╝ ╚══════╝");
Sleep sleep;
int time = 700;
cout << "███████╗██╗ ██╗ ██████╗ ████████╗ ██████╗ ██╗ ██╗███╗ ██╗ ██████╗ ███████╗████████╗███████╗" << endl;
sleep.delay(time);
cout << "██╔════╝██║ ██║██╔═══██╗╚══██╔══╝██╔════╝ ██║ ██║████╗ ██║ ██╔══██╗██╔════╝╚══██╔══╝██╔════╝" << endl;
sleep.delay(time);
cout << "███████╗███████║██║ ██║ ██║ ██║ ███╗██║ ██║██╔██╗ ██║ ██████╔╝█████╗ ██║ █████╗ " << endl;
sleep.delay(time);
cout << "╚════██║██╔══██║██║ ██║ ██║ ██║ ██║██║ ██║██║╚██╗██║ ██╔═══╝ ██╔══╝ ██║ ██╔══╝ " << endl;
sleep.delay(time);
cout << "███████║██║ ██║╚██████╔╝ ██║ ╚██████╔╝╚██████╔╝██║ ╚████║ ██║ ███████╗ ██║ ███████╗" << endl;
sleep.delay(time);
cout << "╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═╝ ╚══════╝ ╚═╝ ╚══════╝" << endl;
}