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:
2025-03-23 21:23:10 +03:00
parent b8d73df4b9
commit 3f7adfd417
2 changed files with 13 additions and 2 deletions

View File

@@ -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() {