forked from EasyRPG/Player
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmessage_overlay.h
79 lines (60 loc) · 1.72 KB
/
message_overlay.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
/*
* This file is part of EasyRPG Player.
*
* EasyRPG Player is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EasyRPG Player is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EasyRPG Player. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef EP_MESSAGE_OVERLAY_H
#define EP_MESSAGE_OVERLAY_H
#include <deque>
#include <string>
#include "color.h"
#include "drawable.h"
#include "memory_management.h"
#include "tone.h"
class MessageOverlayItem {
public:
MessageOverlayItem(const std::string& text, Color color);
std::string text;
Color color;
bool hidden = false;
int repeat_count = 0;
};
/**
* MessageOverlay class.
* Displays notifications during the game session.
*/
class MessageOverlay : public Drawable {
public:
MessageOverlay();
void Draw(Bitmap& dst) override;
void Update();
void AddMessage(const std::string& message, Color color);
void SetShowAll(bool show_all);
void OnResolutionChange();
private:
bool IsAnyMessageVisible() const;
BitmapRef bitmap;
BitmapRef black;
int ox = 0;
int oy = 0;
int text_height = 12;
int message_max = 10;
std::deque<MessageOverlayItem> messages;
/** Last message added to the console before linebreak processing */
std::string last_message;
bool dirty = false;
int counter = 0;
bool show_all = false;
};
#endif