|
|
|
@ -58,6 +58,7 @@ struct ConsoleLine { |
|
|
|
Help, |
|
|
|
Help, |
|
|
|
Input, |
|
|
|
Input, |
|
|
|
Output, |
|
|
|
Output, |
|
|
|
|
|
|
|
Warning, |
|
|
|
Error |
|
|
|
Error |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
@ -98,6 +99,7 @@ bool FirstRender; |
|
|
|
constexpr UiFlags TextUiFlags = UiFlags::FontSizeDialog; |
|
|
|
constexpr UiFlags TextUiFlags = UiFlags::FontSizeDialog; |
|
|
|
constexpr UiFlags InputTextUiFlags = TextUiFlags | UiFlags::ColorDialogWhite; |
|
|
|
constexpr UiFlags InputTextUiFlags = TextUiFlags | UiFlags::ColorDialogWhite; |
|
|
|
constexpr UiFlags OutputTextUiFlags = TextUiFlags | UiFlags::ColorDialogWhite; |
|
|
|
constexpr UiFlags OutputTextUiFlags = TextUiFlags | UiFlags::ColorDialogWhite; |
|
|
|
|
|
|
|
constexpr UiFlags WarningTextUiFlags = TextUiFlags | UiFlags::ColorDialogYellow; |
|
|
|
constexpr UiFlags ErrorTextUiFlags = TextUiFlags | UiFlags::ColorDialogRed; |
|
|
|
constexpr UiFlags ErrorTextUiFlags = TextUiFlags | UiFlags::ColorDialogRed; |
|
|
|
|
|
|
|
|
|
|
|
constexpr int TextSpacing = 0; |
|
|
|
constexpr int TextSpacing = 0; |
|
|
|
@ -210,6 +212,10 @@ void DrawConsoleLines(const Surface &out) |
|
|
|
DrawString(out, line, { 0, lineYEnd }, |
|
|
|
DrawString(out, line, { 0, lineYEnd }, |
|
|
|
TextRenderOptions { .flags = OutputTextUiFlags, .spacing = TextSpacing }); |
|
|
|
TextRenderOptions { .flags = OutputTextUiFlags, .spacing = TextSpacing }); |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
case ConsoleLine::Warning: |
|
|
|
|
|
|
|
DrawString(out, line, { 0, lineYEnd }, |
|
|
|
|
|
|
|
TextRenderOptions { .flags = WarningTextUiFlags, .spacing = TextSpacing }); |
|
|
|
|
|
|
|
break; |
|
|
|
case ConsoleLine::Error: |
|
|
|
case ConsoleLine::Error: |
|
|
|
DrawString(out, line, { 0, lineYEnd }, |
|
|
|
DrawString(out, line, { 0, lineYEnd }, |
|
|
|
TextRenderOptions { .flags = ErrorTextUiFlags, .spacing = TextSpacing }); |
|
|
|
TextRenderOptions { .flags = ErrorTextUiFlags, .spacing = TextSpacing }); |
|
|
|
@ -292,7 +298,7 @@ void NextInput() |
|
|
|
bool IsHistoryOutputLine(const ConsoleLine &line) |
|
|
|
bool IsHistoryOutputLine(const ConsoleLine &line) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return !line.text.empty() |
|
|
|
return !line.text.empty() |
|
|
|
&& (line.type == ConsoleLine::Output || line.type == ConsoleLine::Error) |
|
|
|
&& (line.type == ConsoleLine::Output || line.type == ConsoleLine::Warning || line.type == ConsoleLine::Error) |
|
|
|
&& (HistoryIndex == -1 |
|
|
|
&& (HistoryIndex == -1 |
|
|
|
|| GetConsoleLineFromEnd(HistoryIndex).textWithoutPrompt() != line.text); |
|
|
|
|| GetConsoleLineFromEnd(HistoryIndex).textWithoutPrompt() != line.text); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -471,5 +477,10 @@ void PrintToConsole(std::string_view text) |
|
|
|
AddConsoleLine(ConsoleLine { .type = ConsoleLine::Output, .text = std::string(text) }); |
|
|
|
AddConsoleLine(ConsoleLine { .type = ConsoleLine::Output, .text = std::string(text) }); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void PrintWarningToConsole(std::string_view text) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
AddConsoleLine(ConsoleLine { .type = ConsoleLine::Warning, .text = std::string(text) }); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} // namespace devilution
|
|
|
|
} // namespace devilution
|
|
|
|
#endif // _DEBUG
|
|
|
|
#endif // _DEBUG
|
|
|
|
|