Skip to content

Finish Base Game Features #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jun 6, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove duplicates in includes and implement slow_print
  • Loading branch information
hentai-chan committed Jun 5, 2021
commit 378e1973c216addb4e1623fcadc6412a493368a0
19 changes: 11 additions & 8 deletions src/utils.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
#include <algorithm>
#include <chrono>
#include <fstream>
#include <fstream>
#include <filesystem>
#include <iostream>
#include <numeric>
#include <random>
#include <string>
#include <thread>

#include <str_format/str_format.hpp>
Expand All @@ -26,6 +18,17 @@ void sleep(int ms)
std::this_thread::sleep_for(std::chrono::milliseconds(ms));
}

void slow_print(std::string str, int ms)
{
for (const char& c : str)
{
std::cout << c;
sleep(ms);
}

std::cout << '\n';
}

std::string style(std::string text, Color fore, Color back)
{
// add fore and background ground color to text
Expand Down
3 changes: 2 additions & 1 deletion src/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include <algorithm>
#include <filesystem>
#include <functional>
#include <iostream>
#include <limits>
#include <numeric>
Expand Down Expand Up @@ -77,6 +76,8 @@ void clear_screen();

void sleep(int ms);

void slow_print(std::string str, int ms);

enum class Color
{
BLACK,
Expand Down