-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtype_anim.h
More file actions
43 lines (37 loc) · 837 Bytes
/
type_anim.h
File metadata and controls
43 lines (37 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#pragma once
#include <iostream>
#include <chrono>
#include <thread>
// TODO:: Refactor overrides
namespace kb
{
namespace kb_settings
{
inline unsigned default_dur = 75;
inline bool default_endl = false;
}
inline void type_to_console(const std::string_view str, const unsigned dur = kb_settings::default_dur, const bool endl = kb_settings::default_endl)
{
for (const auto c : str)
{
std::cout << c;
std::this_thread::sleep_for(std::chrono::milliseconds(dur));
}
if (endl)
{
std::cout << std::endl;
}
}
inline void type_to_console(const std::string_view str, const bool endl = kb_settings::default_endl)
{
for (const auto c : str)
{
std::cout << c;
std::this_thread::sleep_for(std::chrono::milliseconds(kb_settings::default_dur));
}
if (endl)
{
std::cout << std::endl;
}
}
}