1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

Chat: Add colour scheme (themes) + 3d edge style.

This commit is contained in:
Wirlie
2016-06-21 01:48:14 -05:00
committed by pizza2004
parent 94ca2364cf
commit 9ec3fbc39b
6 changed files with 44 additions and 11 deletions

View File

@@ -4221,6 +4221,7 @@ STR_5909 :{SMALLFONT}{BLACK}Allows changing ride type freely. May cause crash
STR_5910 :Apply
STR_5911 :See-Through Paths
STR_5912 :See-through paths toggle
STR_5913 :Chat
#############
# Scenarios #

View File

@@ -173,6 +173,7 @@ WindowThemeDesc WindowThemeDescriptors[] =
{ THEME_WC(WC_PLAYER), STR_THEMES_WINDOW_PLAYER, COLOURS_3(COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE, COLOUR_LIGHT_BLUE ) },
{ 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) ) },
};
#pragma endregion

View File

@@ -22,6 +22,7 @@
#include "../platform/platform.h"
#include "chat.h"
#include "../util/util.h"
#include "../interface/themes.h"
#define CHAT_HISTORY_SIZE 10
#define CHAT_INPUT_SIZE 256
@@ -93,18 +94,48 @@ void chat_draw(rct_drawpixelinfo * dpi)
_chatBottom = gScreenHeight - 45;
char lineBuffer[CHAT_INPUT_SIZE + 10];
char* lineCh = lineBuffer;
int x = _chatLeft;
int x = _chatLeft + 5;
int y = _chatBottom - (15 * 2);
uint8 chatBackgroundColor = theme_get_colour(WC_CHAT, 0);
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
gCurrentFontFlags = 0;
if (gChatOpen) {
gfx_set_dirty_blocks(_chatLeft - 3, _chatTop - 3, _chatRight + 3, _chatBottom + 3); //Background area + Textbox
gfx_fill_rect(dpi, _chatLeft - 3, _chatTop - 3, _chatRight + 3, _chatBottom - 15, 0x2000000 | 46); //Draw background below text only if the chat is opened.
gfx_fill_rect(dpi, _chatLeft - 3, _chatTop - 3, _chatRight + 3, _chatTop - 2, 11); //Border top
gfx_fill_rect(dpi, _chatLeft - 3, _chatBottom + 2, _chatRight + 3, _chatBottom + 3, 11); //Border bottom
gfx_fill_rect(dpi, _chatRight + 2, _chatTop - 3, _chatRight + 3, _chatBottom + 3, 11); //Border right
gfx_fill_rect(dpi, _chatLeft - 3, _chatTop - 3, _chatLeft - 2, _chatBottom + 3, 11); //Border left
gfx_set_dirty_blocks(_chatLeft, _chatTop - 5, _chatRight, _chatBottom + 5); //Background area + Textbox
gfx_fill_rect(
dpi,
_chatLeft,
_chatTop - 5,
_chatRight,
_chatBottom + 5,
0x2000000 | 51
); //Simulate window background (gray background).
gfx_fill_rect_inset(
dpi,
_chatLeft,
_chatTop - 5,
_chatRight,
_chatBottom + 5,
chatBackgroundColor,
0x10
);
gfx_fill_rect_inset(
dpi,
_chatLeft + 1,
_chatTop - 4,
_chatRight - 1,
_chatBottom + 4,
chatBackgroundColor,
0x20
);
gfx_fill_rect_inset(
dpi,
x - 1,
_chatBottom - 15,
_chatRight + 1,
_chatBottom + 1,
chatBackgroundColor,
0x20
); //Textbox
}
for (int i = 0; i < CHAT_HISTORY_SIZE; i++, y -= 15) {
if (!gChatOpen && SDL_TICKS_PASSED(SDL_GetTicks(), chat_history_get_time(i) + 10000)) {
@@ -119,9 +150,6 @@ void chat_draw(rct_drawpixelinfo * dpi)
lineCh = utf8_write_codepoint(lineCh, FORMAT_CELADON);
safe_strcpy(lineCh, _chatCurrentLine, CHAT_INPUT_SIZE);
y = _chatBottom - 15;
gfx_fill_rect(dpi, x - 1, y, _chatRight + 1, y + 16, 0x2000000 | 46); // Textbox background
gfx_fill_rect(dpi, x - 3, y - 1, _chatRight + 3, y, 10); //Textbox border top
gfx_draw_string(dpi, lineBuffer, 255, x, y + 3);
if (_chatCaretTicks < 15) {
memcpy(lineBuffer, _chatCurrentLine, gTextInput.selection_offset);

View File

@@ -470,6 +470,7 @@ enum {
WC_STAFF = 220,
WC_EDITOR_TRACK_BOTTOM_TOOLBAR = 221,
WC_EDITOR_SCENARIO_BOTTOM_TOOLBAR = 222,
WC_CHAT = 223,
};
enum PROMPT_MODE {

View File

@@ -3345,6 +3345,7 @@ enum {
STR_APPLY = 5910,
STR_SEE_THROUGH_PATHS = 5911,
STR_SHORTCUT_SEE_THROUGH_PATHS_TOGGLE = 5912,
STR_CHAT = 5913,
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
STR_COUNT = 32768

View File

@@ -245,6 +245,7 @@ static rct_windowclass window_themes_tab_6_classes[] = {
WC_SERVER_LIST,
WC_MULTIPLAYER,
WC_PLAYER,
WC_CHAT,
};
static rct_windowclass window_themes_tab_7_classes[] = {