1
1
#include < algorithm>
2
2
#include < filesystem>
3
3
#include < iostream>
4
+ #include < numeric>
4
5
#include < string>
5
6
#include < vector>
7
+
8
+ #include < str_format/str_format.hpp>
9
+
6
10
#include " models.hpp"
7
11
#include " utils.hpp"
8
- #include < str_format/str_format.hpp>
9
12
10
- std::vector<std::string> gen_healthbar (Pokemon& pkmn)
13
+ namespace anim
14
+ {
15
+ std::vector<std::string> gen_healthbar (models::Pokemon& pkmn)
11
16
{
12
17
/*
13
18
* bulbasaur :L30 // label
@@ -24,7 +29,7 @@ std::vector<std::string> gen_healthbar(Pokemon& pkmn)
24
29
25
30
std::string stars = std::string (hp_scaled, ' *' );
26
31
stars = stars.append (std::string (10 - hp_scaled, ' ' ));
27
- Color star_color = (hp_scaled >= 5 ) ? Color::GREEN : (3 < hp_scaled && hp_scaled < 5 ) ? Color::YELLOW : Color::RED;
32
+ utils:: Color star_color = (hp_scaled >= 5 ) ? utils:: Color::GREEN : (3 < hp_scaled && hp_scaled < 5 ) ? utils:: Color::YELLOW : utils:: Color::RED;
28
33
std::string progressbar = kt::format_str (" HP [{}]" , style (stars, star_color));
29
34
progressbar = std::string (max_width - 15 , ' ' ).append (progressbar);
30
35
@@ -34,7 +39,21 @@ std::vector<std::string> gen_healthbar(Pokemon& pkmn)
34
39
return {label, progressbar, hitpoints};
35
40
}
36
41
37
- void print_frame (Pokemon& pkmn1, Pokemon& pkmn2)
42
+ void print_splash_screen (const std::filesystem::path& assets_dir)
43
+ {
44
+ auto logo = utils::read_file (assets_dir / std::filesystem::path (" splashscreen.txt" ));
45
+ std::cout << utils::style (std::accumulate (logo.begin (), logo.end (), std::string (" " )), utils::Color::YELLOW) << ' \n ' ;
46
+
47
+ std::cout << ' \n ' << std::string (19 , ' ' );
48
+
49
+ for (const char & c : " copyright (c) 2021 cpp-gamedev" )
50
+ {
51
+ std::cout << c;
52
+ utils::sleep (100 );
53
+ }
54
+ }
55
+
56
+ void print_frame (models::Pokemon& pkmn1, models::Pokemon& pkmn2)
38
57
{
39
58
std::string healthbars{};
40
59
std::string sprites{};
@@ -63,3 +82,4 @@ void print_frame(Pokemon& pkmn1, Pokemon& pkmn2)
63
82
64
83
return ;
65
84
}
85
+ } // namespace anim
0 commit comments