aboutsummaryrefslogtreecommitdiff
path: root/src/ChannelTopPanel.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-05-07 06:34:22 +0200
committerdec05eba <dec05eba@protonmail.com>2018-05-07 06:34:24 +0200
commit9ebc3e3f5cf4847239d04cf5b3b01d0b1855a039 (patch)
tree7a421d42e8945a1718b9c54f474acbb2d2478c28 /src/ChannelTopPanel.cpp
parent7a2cb2c4b81a8a0696d3a11ce8781542f181bb12 (diff)
Continue text edit, add avatar (image, but not way to change avatar)
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);
}