aboutsummaryrefslogtreecommitdiff
path: root/src/UsersSidePanel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/UsersSidePanel.cpp')
-rw-r--r--src/UsersSidePanel.cpp29
1 files changed, 11 insertions, 18 deletions
diff --git a/src/UsersSidePanel.cpp b/src/UsersSidePanel.cpp
index 766539b..74b58cf 100644
--- a/src/UsersSidePanel.cpp
+++ b/src/UsersSidePanel.cpp
@@ -1,4 +1,5 @@
#include "../include/UsersSidePanel.hpp"
+#include "../include/ChannelTopPanel.hpp"
#include "../include/ResourceCache.hpp"
#include "../include/Settings.hpp"
#include "../include/Channel.hpp"
@@ -11,32 +12,24 @@ using namespace std;
namespace dchat
{
- Channel *currentChannel = nullptr;
- const float width = 200.0f;
+ const float WIDTH = 200.0f;
const unsigned int FONT_SIZE = 20;
- void UsersSidePanel::setCurrentChannel(Channel *channel)
- {
- currentChannel = channel;
- }
-
- Channel* UsersSidePanel::getCurrentChannel()
- {
- return currentChannel;
- }
-
void UsersSidePanel::draw(sf::RenderWindow &window)
{
+ float posY = ChannelTopPanel::getHeight();
auto windowSize = window.getSize();
- sf::RectangleShape rect(sf::Vector2f(width, windowSize.y));
- rect.setFillColor(sf::Color(30, 30, 30));
- rect.setPosition(windowSize.x - width, 0.0f);
+ sf::RectangleShape rect(sf::Vector2f(WIDTH, windowSize.y));
+ rect.setFillColor(sf::Color(35, 35, 35));
+ rect.setPosition(windowSize.x - WIDTH, posY);
window.draw(rect);
+ posY += 10.0f;
+ Channel *currentChannel = Channel::getCurrent();
if(!currentChannel) return;
const sf::Font *font = ResourceCache::getFont("fonts/Roboto-Regular.ttf");
- sf::Vector2f position(rect.getPosition().x + 10.0f, 10.0f);
+ sf::Vector2f position(rect.getPosition().x + 10.0f, posY);
for(User *user : currentChannel->getUsers())
{
// TODO: Remove this shit
@@ -44,12 +37,12 @@ namespace dchat
sf::Text text(str, *font, FONT_SIZE * Settings::getScaling());
text.setPosition(position);
window.draw(text);
- position.y += font->getLineSpacing(FONT_SIZE * Settings::getScaling());
+ position.y += floor(font->getLineSpacing(FONT_SIZE * Settings::getScaling()));
}
}
float UsersSidePanel::getWidth()
{
- return width;
+ return WIDTH;
}
}