fix last commit and get border around chat (when drawn) to properly DPI scale

This commit is contained in:
UnknownShadow200 2020-09-28 22:05:04 +10:00
parent d4702e9693
commit 619d061a70
3 changed files with 12 additions and 3 deletions

View File

@ -16,3 +16,6 @@ And a big thanks to everyone else in the ClassiCube community (who I didn't ment
who in the past have provided many suggestions and assisted in identifying bugs.
* Portions of the FreeType project (https://www.freetype.org/) are used for text rendering
Some functionality has been removed compared to original FreeType source code.
Additionally, the base .c files have an #ifdef to disable compiling for emscripten
The source code of FreeType is otherwise unmodified.

View File

@ -609,9 +609,11 @@ static void OnInit(void) {
Commands_Register(&TeleportCommand);
Commands_Register(&ClearDeniedCommand);
#if defined CC_BUILD_MINFILES || defined CC_BUILD_ANDROID
#if defined CC_BUILD_MINFILES
#elif defined CC_BUILD_ANDROID
/* Better to not log chat by default on android, */
/* since it's not easily visible to end users */
Chat_Logging = Options_GetBool(OPT_CHAT_LOGGING, false);
#else
Chat_Logging = Options_GetBool(OPT_CHAT_LOGGING, true);
#endif

View File

@ -719,7 +719,7 @@ static struct ChatScreen {
Screen_Body
float chatAcc;
cc_bool suppressNextPress;
int chatIndex;
int chatIndex, paddingX, paddingY;
int lastDownloadStatus;
struct FontDesc chatFont, announcementFont;
struct TextWidget announcement;
@ -939,7 +939,8 @@ static void ChatScreen_DrawChatBackground(struct ChatScreen* s) {
if (height > 0) {
PackedCol backCol = PackedCol_Make(0, 0, 0, 127);
Gfx_Draw2DFlat(x - 5, y - 5, width + 10, height + 10, backCol);
Gfx_Draw2DFlat( x - s->paddingX, y - s->paddingY,
width + s->paddingX * 2, height + s->paddingY * 2, backCol);
}
}
@ -1033,6 +1034,9 @@ static void ChatScreen_Layout(void* screen) {
int yOffset = Gui_HUD->hotbar.height + 15; /* TODO: This should be DPI scaled?? */
if (ChatScreen_ChatUpdateFont(s)) ChatScreen_Redraw(s);
s->paddingX = Display_ScaleX(5);
s->paddingY = Display_ScaleY(5);
Widget_SetLocation(&s->input.base, ANCHOR_MIN, ANCHOR_MAX, 5, 5);
Widget_SetLocation(&s->altText, ANCHOR_MIN, ANCHOR_MAX, 5, 5);
Widget_SetLocation(&s->status, ANCHOR_MAX, ANCHOR_MIN, 0, 0);