Working on the sleep
This commit is contained in:
parent
2a29f0dceb
commit
f5b2925bdf
|
@ -5,3 +5,4 @@ ShotGun-Pete
|
|||
banner.txt
|
||||
print.d
|
||||
intro.d
|
||||
sleep.d
|
||||
|
|
|
@ -1,23 +1,14 @@
|
|||
#include <iostream>
|
||||
#include <thread>
|
||||
#include "print.h"
|
||||
#include "sleep.h"
|
||||
using namespace std;
|
||||
|
||||
class Intro {
|
||||
public:
|
||||
Intro();
|
||||
Intro(Intro &&) = default;
|
||||
Intro(const Intro &) = default;
|
||||
Intro &operator=(Intro &&) = default;
|
||||
Intro &operator=(const Intro &) = default;
|
||||
~Intro();
|
||||
|
||||
void intro();
|
||||
void mainIntro();
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
Intro::Intro() {
|
||||
}
|
||||
|
||||
Intro::~Intro() {
|
||||
}
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
#include <iostream>
|
||||
#include "intro.h"
|
||||
#include "title.h"
|
||||
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"
|
||||
|
||||
void Intro::intro(){
|
||||
Print print;
|
||||
print.println("");
|
||||
|
||||
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));
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#include "include/main.h"
|
||||
#include "include/title.h"
|
||||
|
||||
int main (){
|
||||
Title title;
|
||||
title.mainTitle();
|
||||
Intro intro;
|
||||
intro.mainIntro();
|
||||
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