From 9f67fafc433cbb6cbbbd9189d7c0c7eef2ded878 Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Wed, 18 Oct 2017 08:58:07 +0200 Subject: [PATCH] Add theme support for console background colour. --- data/language/en-GB.txt | 1 + src/openrct2-ui/windows/Themes.cpp | 1 + src/openrct2/interface/Theme.cpp | 1 + src/openrct2/interface/console.c | 24 +++++++++++++++++------- src/openrct2/interface/window.h | 1 + src/openrct2/localisation/string_ids.h | 2 ++ 6 files changed, 23 insertions(+), 7 deletions(-) diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index 373c594271..50ed16dc73 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -4465,6 +4465,7 @@ STR_6153 :Pay to enter park / Pay per ride STR_6154 :It is not recommended to run OpenRCT2 with elevated permissions. STR_6155 :Neither KDialog nor Zenity are installed. Please install one, or configure from the command line. STR_6156 :Name is reserved +STR_6157 :Console ############# # Scenarios # diff --git a/src/openrct2-ui/windows/Themes.cpp b/src/openrct2-ui/windows/Themes.cpp index f34fadd425..3c9a09a0a7 100644 --- a/src/openrct2-ui/windows/Themes.cpp +++ b/src/openrct2-ui/windows/Themes.cpp @@ -244,6 +244,7 @@ static rct_windowclass window_themes_tab_6_classes[] = { WC_MULTIPLAYER, WC_PLAYER, WC_CHAT, + WC_CONSOLE, }; static rct_windowclass window_themes_tab_7_classes[] = { diff --git a/src/openrct2/interface/Theme.cpp b/src/openrct2/interface/Theme.cpp index 14cfb5bfba..5158db0b07 100644 --- a/src/openrct2/interface/Theme.cpp +++ b/src/openrct2/interface/Theme.cpp @@ -173,6 +173,7 @@ static const WindowThemeDesc WindowThemeDescriptors[] = { THEME_WC(WC_NETWORK_STATUS), STR_THEMES_WINDOW_NETWORK_STATUS, COLOURS_1(COLOUR_LIGHT_BLUE ) }, { THEME_WC(WC_SERVER_LIST), STR_SERVER_LIST, COLOURS_2(COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE ) }, { THEME_WC(WC_CHAT), STR_CHAT, COLOURS_1(TRANSLUCENT(COLOUR_GREY) ) }, + { THEME_WC(WC_CONSOLE), STR_CONSOLE, COLOURS_1(TRANSLUCENT(COLOUR_LIGHT_BLUE) ) }, }; #pragma endregion diff --git a/src/openrct2/interface/console.c b/src/openrct2/interface/console.c index ec07a3190f..ca9af2fb81 100644 --- a/src/openrct2/interface/console.c +++ b/src/openrct2/interface/console.c @@ -22,6 +22,7 @@ #include "../Editor.h" #include "../game.h" #include "../input.h" +#include "../interface/themes.h" #include "../localisation/localisation.h" #include "../localisation/user.h" #include "../management/Finance.h" @@ -176,9 +177,13 @@ void console_draw(rct_drawpixelinfo *dpi) lines++; } - // Background console_invalidate(); - gfx_filter_rect(dpi, _consoleLeft, _consoleTop, _consoleRight, _consoleBottom, PALETTE_TRANSLUCENT_LIGHT_BLUE_HIGHLIGHT); + + // Paint background colour. + uint8 backgroundColour = theme_get_colour(WC_CONSOLE, 0); + gfx_filter_rect(dpi, _consoleLeft, _consoleTop, _consoleRight, _consoleBottom, PALETTE_51); + gfx_fill_rect_inset(dpi, _consoleLeft, _consoleTop, _consoleRight, _consoleBottom, backgroundColour, INSET_RECT_FLAG_FILL_NONE); + gfx_fill_rect_inset(dpi, _consoleLeft + 1, _consoleTop + 1, _consoleRight - 1, _consoleBottom - 1, backgroundColour, INSET_RECT_FLAG_BORDER_INSET); sint32 x = _consoleLeft + 4; sint32 y = _consoleTop + 4; @@ -247,16 +252,21 @@ void console_draw(rct_drawpixelinfo *dpi) sint32 caretX = x + gfx_get_string_width(lineBuffer); sint32 caretY = y + lineHeight; - gfx_fill_rect(dpi, caretX, caretY, caretX + 6, caretY + 1, PALETTE_INDEX_144); + uint8 caretColour = ColourMapA[BASE_COLOUR(backgroundColour)].dark; + gfx_fill_rect(dpi, caretX, caretY, caretX + 6, caretY + 1, caretColour); } + // What about border colours? + uint8 borderColour1 = ColourMapA[BASE_COLOUR(backgroundColour)].light; + uint8 borderColour2 = ColourMapA[BASE_COLOUR(backgroundColour)].mid_dark; + // Input area top border - gfx_fill_rect(dpi, _consoleLeft, _consoleBottom - lineHeight - 11, _consoleRight, _consoleBottom - lineHeight - 11, PALETTE_INDEX_14); - gfx_fill_rect(dpi, _consoleLeft, _consoleBottom - lineHeight - 10, _consoleRight, _consoleBottom - lineHeight - 10, PALETTE_INDEX_11); + gfx_fill_rect(dpi, _consoleLeft, _consoleBottom - lineHeight - 11, _consoleRight, _consoleBottom - lineHeight - 11, borderColour1); + gfx_fill_rect(dpi, _consoleLeft, _consoleBottom - lineHeight - 10, _consoleRight, _consoleBottom - lineHeight - 10, borderColour2); // Input area bottom border - gfx_fill_rect(dpi, _consoleLeft, _consoleBottom - 1, _consoleRight, _consoleBottom - 1, PALETTE_INDEX_14); - gfx_fill_rect(dpi, _consoleLeft, _consoleBottom - 0, _consoleRight, _consoleBottom - 0, PALETTE_INDEX_12); + gfx_fill_rect(dpi, _consoleLeft, _consoleBottom - 1, _consoleRight, _consoleBottom - 1, borderColour1); + gfx_fill_rect(dpi, _consoleLeft, _consoleBottom - 0, _consoleRight, _consoleBottom - 0, borderColour2); } void console_input(CONSOLE_INPUT input) diff --git a/src/openrct2/interface/window.h b/src/openrct2/interface/window.h index f1371e15c4..2182b801b5 100644 --- a/src/openrct2/interface/window.h +++ b/src/openrct2/interface/window.h @@ -494,6 +494,7 @@ enum { WC_EDITOR_TRACK_BOTTOM_TOOLBAR = 221, WC_EDITOR_SCENARIO_BOTTOM_TOOLBAR = 222, WC_CHAT = 223, + WC_CONSOLE = 224, WC_NULL = 255, }; diff --git a/src/openrct2/localisation/string_ids.h b/src/openrct2/localisation/string_ids.h index 40ec22ccd0..c4da344732 100644 --- a/src/openrct2/localisation/string_ids.h +++ b/src/openrct2/localisation/string_ids.h @@ -3811,6 +3811,8 @@ enum { STR_ERROR_RESERVED_NAME = 6156, + STR_CONSOLE = 6157, + // Have to include resource strings (from scenarios and objects) for the time being now that language is partially working STR_COUNT = 32768 };