My Project
 
Loading...
Searching...
No Matches
gamelog.h
Go to the documentation of this file.
1#pragma once
2
3#include "component.h"
4#include "signal.h"
5#include "regex/pcrecpp.h"
6#include "bitmaptextmultiline.h"
7
8#include <string>
9#include <vector>
10
11class GameLog :public Component, public Signal<std::string>::Listener{
12private:
13 struct Entry {
14 std::string text;
15 int color;
16 Entry(const std::string& text, int color) {
17 this->text = text;
18 this->color = color;
19 }
20 };
21
22private:
23 static const int MAX_LINES = 3;
24
25 static const pcrecpp::RE PUNCTUATION;
26
27 BitmapTextMultiline* lastEntry;
28 int lastColor;
29
30 static std::vector<Entry> entries;
31
32 void recreateLines();
33public:
34 static void wipe() { entries.clear(); }
35
36 GameLog();
37 virtual void destroy();
38 void newLine();
39 virtual void onSignal(std::string* text);
40
41protected:
42 virtual void layout();
43};
virtual void layout()
Definition gamelog.cpp:106
virtual void onSignal(std::string *text)
Definition gamelog.cpp:38
static void wipe()
Definition gamelog.h:34
void newLine()
Definition gamelog.cpp:33
GameLog()
Definition gamelog.cpp:9
virtual void destroy()
Definition gamelog.cpp:15