diff options
author | peter1138 <peter1138@openttd.org> | 2009-04-10 18:55:38 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2009-04-10 18:55:38 +0000 |
commit | 238742ee036f483f12a84ba7033fc8ef67506201 (patch) | |
tree | 9dbddba862805e3d90222350f080cf915d1f6eee | |
parent | 3bb5b00e48285fff1a7aea708359ef72b75ca641 (diff) | |
download | openttd-238742ee036f483f12a84ba7033fc8ef67506201.tar.xz |
(svn r16021) -Codechange: Offset current console output by (width of "] ")+5 pixels instead of 5+5 pixels.
-rw-r--r-- | src/console_gui.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/console_gui.cpp b/src/console_gui.cpp index 3bf40aae1..9f158d341 100644 --- a/src/console_gui.cpp +++ b/src/console_gui.cpp @@ -147,12 +147,14 @@ struct IConsoleWindow : Window { static int scroll; int line_height; + int line_offset; IConsoleWindow() : Window(0, 0, _screen.width, _screen.height / 3, WC_CONSOLE, NULL) { _iconsole_mode = ICONSOLE_OPENED; this->line_height = FONT_HEIGHT_NORMAL + ICON_LINE_SPACING; + this->line_offset = GetStringBoundingBox("] ").width + 5; } ~IConsoleWindow() @@ -171,16 +173,16 @@ struct IConsoleWindow : Window DrawString(5, right, this->height - (2 + i) * this->line_height, print->buffer, print->colour, SA_LEFT | SA_FORCE); } /* If the text is longer than the window, don't show the starting ']' */ - int delta = this->width - 10 - _iconsole_cmdline.width - ICON_RIGHT_BORDERWIDTH; + int delta = this->width - this->line_offset - _iconsole_cmdline.width - ICON_RIGHT_BORDERWIDTH; if (delta > 0) { DrawString(5, right, this->height - this->line_height, "]", (TextColour)CC_COMMAND, SA_LEFT | SA_FORCE); delta = 0; } - DrawString(10 + delta, right, this->height - this->line_height, _iconsole_cmdline.buf, (TextColour)CC_COMMAND, SA_LEFT | SA_FORCE); + DrawString(this->line_offset + delta, right, this->height - this->line_height, _iconsole_cmdline.buf, (TextColour)CC_COMMAND, SA_LEFT | SA_FORCE); if (_focused_window == this && _iconsole_cmdline.caret) { - DrawString(10 + delta + _iconsole_cmdline.caretxoffs, right, this->height - this->line_height, "_", TC_WHITE, SA_LEFT | SA_FORCE); + DrawString(this->line_offset + delta + _iconsole_cmdline.caretxoffs, right, this->height - this->line_height, "_", TC_WHITE, SA_LEFT | SA_FORCE); } } |