From 9ebc3e3f5cf4847239d04cf5b3b01d0b1855a039 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 7 May 2018 06:34:22 +0200 Subject: Continue text edit, add avatar (image, but not way to change avatar) --- src/ChannelTopPanel.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/ChannelTopPanel.cpp') diff --git a/src/ChannelTopPanel.cpp b/src/ChannelTopPanel.cpp index d597353..1781e74 100644 --- a/src/ChannelTopPanel.cpp +++ b/src/ChannelTopPanel.cpp @@ -3,6 +3,8 @@ #include "../include/ResourceCache.hpp" #include "../include/Channel.hpp" #include "../include/ColorScheme.hpp" +#include "../include/ChannelSidePanel.hpp" +#include "../include/UsersSidePanel.hpp" #include #include @@ -17,6 +19,7 @@ namespace dchat const float BOTTOM_LINE_HEIGHT = 2.0f; const float PADDING_TOP = 20.0f; const float PADDING_BOTTOM = PADDING_TOP; + const float PADDING_SIDE = 20.0f; static void drawGradientLine(const sf::Vector2f &position, const sf::Vector2f &size, const LineColor &color, sf::RenderWindow &window) { @@ -37,16 +40,17 @@ namespace dchat void ChannelTopPanel::draw(sf::RenderWindow &window) { - const sf::Color lineSideColor = ColorScheme::getBackgroundColor(); + const sf::Color lineSideColor = ColorScheme::getBackgroundColor() + sf::Color(20, 0, 0); const sf::Color lineCenterColor = lineSideColor + sf::Color(40, 0, 0); auto windowSize = window.getSize(); - sf::RectangleShape rect(sf::Vector2f(windowSize.x, getHeight() - BOTTOM_LINE_HEIGHT)); + sf::RectangleShape rect(sf::Vector2f(floor(windowSize.x - ChannelSidePanel::getWidth() - UsersSidePanel::getWidth()), getHeight() - BOTTOM_LINE_HEIGHT)); + rect.setPosition(ChannelSidePanel::getWidth(), 0.0f); rect.setFillColor(ColorScheme::getBackgroundColor()); window.draw(rect); - sf::Vector2f bottomLinePos(0.0f, getHeight() - BOTTOM_LINE_HEIGHT); - sf::Vector2f bottomLineSize(windowSize.x, BOTTOM_LINE_HEIGHT); + sf::Vector2f bottomLinePos(floor(ChannelSidePanel::getWidth() + PADDING_SIDE * Settings::getScaling()), getHeight() - BOTTOM_LINE_HEIGHT); + sf::Vector2f bottomLineSize(floor(windowSize.x - ChannelSidePanel::getWidth() - UsersSidePanel::getWidth() - PADDING_SIDE * Settings::getScaling() * 2.0f), BOTTOM_LINE_HEIGHT); LineColor lineColor { @@ -63,7 +67,7 @@ namespace dchat float fontSize = FONT_SIZE * Settings::getScaling(); sf::Text text(str, *ResourceCache::getFont("fonts/Roboto-Regular.ttf"), fontSize); auto textBounds = text.getLocalBounds(); - text.setPosition(floor((float)windowSize.x * 0.5f - textBounds.width * 0.5f), PADDING_TOP); + text.setPosition(floor(ChannelSidePanel::getWidth() + PADDING_SIDE * Settings::getScaling()), PADDING_TOP); text.setFillColor(ColorScheme::getTextRegularColor()); window.draw(text); } -- cgit v1.2.3