-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy patherrorscreen.cpp
54 lines (41 loc) · 1.26 KB
/
errorscreen.cpp
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
#include "prism/errorscreen.h"
#include "prism/mugentexthandler.h"
#include "prism/datastructures.h"
#include "prism/log.h"
#include "prism/screeneffect.h"
#include "prism/input.h"
namespace prism {
static Color getColorFromLogEntryType(LogEntry* e) {
if (e->mType == LOG_TYPE_ERROR) return COLOR_RED;
else if (e->mType == LOG_TYPE_WARNING) return COLOR_YELLOW;
else return COLOR_WHITE;
}
static void loadLogEntryText() {
Vector logEntries = getLogEntries();
int id = addMugenText("An error has occured. Log output:", Vector3D(20, 20, 1), -1);
setMugenTextColor(id, COLOR_RED);
double y = 40;
int i;
for (i = 0; i < vector_size(&logEntries); i++) {
LogEntry* entry = (LogEntry*)vector_get(&logEntries, i);
id = addMugenText(strchr(entry->mText, ']') + 2, Vector3D(20, y, 1), -1);
setMugenTextColor(id, getColorFromLogEntryType(entry));
y += 10;
}
delete_vector(&logEntries);
}
static void loadErrorScreen() {
setScreenBackgroundColorRGB(0, 0, 0);
loadLogEntryText();
}
static void updateErrorScreen() {
if (hasPressedStartFlank()) {
gotoNextScreenAfterWrapperError();
}
}
static Screen gErrorScreen;
Screen* getErrorScreen() {
gErrorScreen = makeScreen(loadErrorScreen, updateErrorScreen);
return &gErrorScreen;
}
}