Working on the sleep
This commit is contained in:
parent
2a29f0dceb
commit
f5b2925bdf
|
@ -5,3 +5,4 @@ ShotGun-Pete
|
||||||
banner.txt
|
banner.txt
|
||||||
print.d
|
print.d
|
||||||
intro.d
|
intro.d
|
||||||
|
sleep.d
|
||||||
|
|
|
@ -1,23 +1,14 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <thread>
|
||||||
#include "print.h"
|
#include "print.h"
|
||||||
|
#include "sleep.h"
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
class Intro {
|
class Intro {
|
||||||
public:
|
public:
|
||||||
Intro();
|
|
||||||
Intro(Intro &&) = default;
|
|
||||||
Intro(const Intro &) = default;
|
|
||||||
Intro &operator=(Intro &&) = default;
|
|
||||||
Intro &operator=(const Intro &) = default;
|
|
||||||
~Intro();
|
|
||||||
|
|
||||||
void intro();
|
void mainIntro();
|
||||||
private:
|
private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Intro::Intro() {
|
|
||||||
}
|
|
||||||
|
|
||||||
Intro::~Intro() {
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include "intro.h"
|
||||||
|
#include "title.h"
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
#include <chrono>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
class Sleep{
|
||||||
|
public:
|
||||||
|
void delay(int milliseconds);
|
||||||
|
|
||||||
|
};
|
|
@ -1,7 +1,6 @@
|
||||||
#include "include/intro.h"
|
#include "include/intro.h"
|
||||||
|
|
||||||
void Intro::intro(){
|
void Intro::mainIntro(){
|
||||||
Print print;
|
cout << "The world didn't end with a bang. It ended with a groan.. and the scratching of death fingers against steel shutters." << endl;
|
||||||
print.println("");
|
std::this_thread::sleep_for(std::chrono::milliseconds(3000));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
#include "include/main.h"
|
#include "include/main.h"
|
||||||
#include "include/title.h"
|
|
||||||
|
|
||||||
int main (){
|
int main (){
|
||||||
Title title;
|
Title title;
|
||||||
title.mainTitle();
|
title.mainTitle();
|
||||||
|
Intro intro;
|
||||||
|
intro.mainIntro();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
#include "include/sleep.h"
|
||||||
|
|
||||||
|
void Sleep::delay(int milliseconds){
|
||||||
|
auto start = std::chrono::high_resolution_clock::now();
|
||||||
|
auto duration = std::chrono::milliseconds(milliseconds);
|
||||||
|
|
||||||
|
while (std::chrono::high_resolution_clock::now() - start < duration) {
|
||||||
|
// Do nothing, just wait
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue