Change: Use scaled WidgetDimensions.

This commit is contained in:
Peter Nelson
2022-09-23 09:36:22 +01:00
committed by PeterN
parent 61da064b82
commit 890b2666d3
60 changed files with 881 additions and 864 deletions

View File

@@ -17,6 +17,7 @@
#include "../window_func.h"
#include "../toolbar_gui.h"
#include "../core/geometry_func.hpp"
#include "../zoom_func.h"
#include "network.h"
#include "network_client.h"
#include "network_base.h"
@@ -106,7 +107,7 @@ void CDECL NetworkAddChatMessage(TextColour colour, uint duration, const std::st
void NetworkReInitChatBoxSize()
{
_chatmsg_box.y = 3 * FONT_HEIGHT_NORMAL;
_chatmsg_box.height = MAX_CHAT_MESSAGES * (FONT_HEIGHT_NORMAL + NETWORK_CHAT_LINE_SPACING) + 4;
_chatmsg_box.height = MAX_CHAT_MESSAGES * (FONT_HEIGHT_NORMAL + ScaleGUITrad(NETWORK_CHAT_LINE_SPACING)) + ScaleGUITrad(4);
_chatmessage_backup = ReallocT(_chatmessage_backup, _chatmsg_box.width * _chatmsg_box.height * BlitterFactory::GetCurrentBlitter()->GetBytesPerPixel());
}
@@ -116,7 +117,7 @@ void NetworkInitChatMessage()
MAX_CHAT_MESSAGES = _settings_client.gui.network_chat_box_height;
_chatmsg_list.clear();
_chatmsg_box.x = 10;
_chatmsg_box.x = ScaleGUITrad(10);
_chatmsg_box.width = _settings_client.gui.network_chat_box_width_pct * _screen.width / 100;
NetworkReInitChatBoxSize();
_chatmessage_visible = false;
@@ -242,7 +243,7 @@ void NetworkDrawChatMessage()
for (auto &cmsg : _chatmsg_list) {
if (!show_all && cmsg.remove_time < now) continue;
ypos = DrawStringMultiLine(_chatmsg_box.x + 3, _chatmsg_box.x + _chatmsg_box.width - 1, top, ypos, cmsg.message, cmsg.colour, SA_LEFT | SA_BOTTOM | SA_FORCE) - NETWORK_CHAT_LINE_SPACING;
ypos = DrawStringMultiLine(_chatmsg_box.x + ScaleGUITrad(3), _chatmsg_box.x + _chatmsg_box.width - 1, top, ypos, cmsg.message, cmsg.colour, SA_LEFT | SA_BOTTOM | SA_FORCE) - NETWORK_CHAT_LINE_SPACING;
if (ypos < top) break;
}