-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchoose_amino_acids_menu_sfml.h
93 lines (70 loc) · 2.37 KB
/
choose_amino_acids_menu_sfml.h
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#ifndef CHOOSE_AMINO_ACIDS_MENU_SFML_H
#define CHOOSE_AMINO_ACIDS_MENU_SFML_H
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>
#include "choose_amino_acids_menu.h"
#include "player.h"
#include "player_sfml.h"
#include "program.h"
#include "program_state.h"
/// SFML visualization of the choose_amino_acids_menu
class choose_amino_acids_menu_sfml
{
public:
///Starts the music
choose_amino_acids_menu_sfml(
sf::RenderWindow& window,
Sprites_sfml& sprites,
const bool do_play_music = true,
const std::vector<amino_acid> initial_amino_acids
= create_first_amino_acids()
);
///Stops the music
~choose_amino_acids_menu_sfml();
///Will the music be played?
bool do_play_music() const noexcept { return m_do_play_music; }
///Runs this menu, which is handling input and displayal.
///Closes when the user wants to quit
///or continue to the game
///This can be obtained with the do_quit member function
void execute();
///Get the current amino acids
std::vector<amino_acid> get_amino_acids() const noexcept { return m_menu.get_amino_acids(); }
///Obtain the current or state after execute
program_state get_state() const noexcept { return m_state; }
///Handle input and show this screen once, to be used in testing only
void tick();
private:
///The amino acid texts
std::vector<sf::Text> m_amino_acid_texts;
///The center text
sf::Text m_center_text;
///Will music be played?
bool m_do_play_music;
///The font for all texts
sf::Font m_font;
///The logic behind this menu
choose_amino_acids_menu m_menu;
///Music played, starts at constructor, ends at destructor
sf::Music m_music;
///The player texts
std::vector<sf::Text> m_player_texts;
///The AminoAcidFighter sprites
///They are non-const, as they are modified before drawing
Sprites_sfml& m_sprites;
///In which state is the program while and directly after this menu?
program_state m_state;
///Window used for displayal
sf::RenderWindow& m_window;
///Show this menu on the screen
void display();
///Process a single event
void process_event(const sf::Event& event);
};
std::vector<player> choose_aminoacids(
sf::RenderWindow& window,
std::vector<amino_acid> amino_acids
);
void check_joystick_press(choose_amino_acids_menu& m_menu);
void check_keyboard_press(choose_amino_acids_menu& m_menu);
#endif // CHOOSE_AMINO_ACIDS_MENU_SFML_H