mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-17 20:13:07 +01:00
Chat: Add colour scheme (themes) + 3d edge style.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user