-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsfml_customer.h
68 lines (54 loc) · 1.64 KB
/
sfml_customer.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
#ifndef SFML_CUSTOMER_H
#define SFML_CUSTOMER_H
#include <SFML/Graphics.hpp>
#include "user.h"
#include "ticket.h"
#include <vector>
#include <string>
class SFMLCustomer {
public:
SFMLCustomer(std::vector<Ticket>& tickets);
void runCustomer();
private:
enum class ViewState { TicketList, TicketCreation };
sf::RenderWindow window;
sf::Font font;
// Ticket list view elements
sf::RectangleShape createTicketButton;
sf::Text createTicketButtonText;
// Ticket creation panel elements
sf::Text tagLabel;
sf::Text contentLabel;
sf::Text tagInput;
sf::Text contentInput;
sf::RectangleShape tagRect;
sf::RectangleShape contentRect;
sf::RectangleShape submitButton;
sf::Text submitButtonText;
sf::RectangleShape ticketPanelBackground;
sf::RectangleShape logOutButton;
sf::Text logOutButtonText;
std::vector<Ticket>& tickets;
ViewState viewState;
bool isTagActive;
bool isContentActive;
bool showCursor;
std::string tag;
std::string content;
sf::Clock cursorClock;
void processEvents();
void update();
void render();
void renderTicketList();
void renderTicketCreation();
void handleMouseClick(sf::Vector2i position);
void handleUserInput(sf::Event::KeyEvent keyEvent, bool isPressed);
void handleTextEntered(sf::Event::TextEvent textEvent);
void createTicket();
sf::Text timeAllottedLabel;
sf::Text timeAllottedInput;
sf::RectangleShape timeAllottedRect;
bool isTimeAllottedActive;
std::string timeAllotted;
};
#endif // SFML_CUSTOMER_H