various fixes in TextDisplay
- do not move the cursor when it is already in the correct position - maintain currentFgColor and currentBgColor fields - use translations for the game title
This commit is contained in:
parent
b8d73df4b9
commit
3f7adfd417
@ -13,6 +13,8 @@ namespace Game {
|
||||
"Syntax error in the question database: {0} (line {1} column {2})",
|
||||
"Cannot get console mode",
|
||||
"Cannot set console mode",
|
||||
"WHO WANTS TO BECOME",
|
||||
"A STOPWATCHIONAIRE"
|
||||
}},
|
||||
{"ru-RU", new string[] {
|
||||
"Не указано ни одного варианта ответа на вопрос",
|
||||
@ -24,6 +26,8 @@ namespace Game {
|
||||
"Ошибка синтаксиса в банке вопросов: {0} (строка {1} символ {2})",
|
||||
"Не удалось узнать режим консоли",
|
||||
"Не удалось установить режим консоли",
|
||||
"КТО ХОЧЕТ СТАТЬ",
|
||||
"СЕКУНДОМЕРОМ"
|
||||
}}
|
||||
};
|
||||
|
||||
@ -41,6 +45,8 @@ namespace Game {
|
||||
SYNTAX_ERROR,
|
||||
ERROR_GETCONSOLEMODE,
|
||||
ERROR_SETCONSOLEMODE,
|
||||
TITLE_LINE1,
|
||||
TITLE_LINE2,
|
||||
}
|
||||
}
|
||||
}
|
@ -82,8 +82,8 @@ namespace Game.UI {
|
||||
}
|
||||
|
||||
void DrawTitle(int y, int bgColor) {
|
||||
string text1 = "КТО ХОЧЕТ СТАТЬ";
|
||||
string text2 = "СЕКУНДОМЕРОМ";
|
||||
string text1 = GetMessage(Message.TITLE_LINE1)!;
|
||||
string text2 = GetMessage(Message.TITLE_LINE2)!;
|
||||
SetColors(0xffffff, 0);
|
||||
|
||||
int text1Start = (windowWidth - text1.Length) / 2 + 1;
|
||||
@ -200,10 +200,12 @@ namespace Game.UI {
|
||||
if (fg != -1) {
|
||||
(int r, int g, int b) = ((fg >> 16) & 255, (fg >> 8) & 255, fg & 255);
|
||||
command.Append(RGB_FG_SEQ_START + r + ';' + g + ';' + b + GRAPHICS_SEQ_END);
|
||||
currentFgColor = fg;
|
||||
}
|
||||
if (bg != -1) {
|
||||
(int r, int g, int b) = ((bg >> 16) & 255, (bg >> 8) & 255, bg & 255);
|
||||
command.Append(RGB_BG_SEQ_START + r + ';' + g + ';' + b + GRAPHICS_SEQ_END);
|
||||
currentBgColor = bg;
|
||||
}
|
||||
Console.Write(command.ToString());
|
||||
}
|
||||
@ -215,7 +217,10 @@ namespace Game.UI {
|
||||
}
|
||||
|
||||
public void SetCursor(int row, int column) {
|
||||
if (cursorRow == row && cursorCol == column) return;
|
||||
Console.Write(ESC_SEQ_START + row + ';' + column + SETCURSOR_END);
|
||||
cursorRow = row;
|
||||
cursorCol = column;
|
||||
}
|
||||
|
||||
public void HideCursor() {
|
||||
|
Loading…
Reference in New Issue
Block a user