aboutsummaryrefslogtreecommitdiff
path: root/src/ChannelSidePanel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ChannelSidePanel.cpp')
-rw-r--r--src/ChannelSidePanel.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/ChannelSidePanel.cpp b/src/ChannelSidePanel.cpp
index 23693b3..3958376 100644
--- a/src/ChannelSidePanel.cpp
+++ b/src/ChannelSidePanel.cpp
@@ -1,9 +1,42 @@
#include "../include/ChannelSidePanel.hpp"
+#include "../include/ResourceCache.hpp"
+#include "../include/Settings.hpp"
+#include "../include/Channel.hpp"
+#include <SFML/Graphics/RectangleShape.hpp>
+#include <SFML/Graphics/Text.hpp>
+#include <cmath>
namespace dchat
{
+ ChannelSidePanel::ChannelSidePanel(float _width) :
+ width(floor(_width))
+ {
+
+ }
+
void ChannelSidePanel::addChannel(Channel *channel)
{
channels.push_back(channel);
}
+
+ void ChannelSidePanel::draw(sf::RenderWindow &window)
+ {
+ auto windowSize = window.getSize();
+ sf::RectangleShape rect(sf::Vector2f(width, windowSize.y));
+ rect.setFillColor(sf::Color(30, 30, 30));
+ window.draw(rect);
+
+ const sf::Font &font = ResourceCache::getFont("fonts/Roboto-Regular.ttf");
+ sf::Vector2f position;
+ for(Channel *channel : channels)
+ {
+ // TODO: Remove this shit
+ sf::String str = "# ";
+ str += sf::String::fromUtf8(channel->getName().begin(), channel->getName().end());
+ sf::Text text(str, font, 24 * Settings::getScaling());
+ text.setPosition(position);
+ window.draw(text);
+ position.y += font.getLineSpacing(24 * Settings::getScaling());
+ }
+ }
}