aboutsummaryrefslogtreecommitdiff
path: root/src/ChannelTopPanel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ChannelTopPanel.cpp')
-rw-r--r--src/ChannelTopPanel.cpp14
1 files changed, 9 insertions, 5 deletions
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 <SFML/Graphics/RectangleShape.hpp>
#include <cmath>
@@ -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);
}