aboutsummaryrefslogtreecommitdiff
path: root/src/ChannelSidePanel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ChannelSidePanel.cpp')
-rw-r--r--src/ChannelSidePanel.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/ChannelSidePanel.cpp b/src/ChannelSidePanel.cpp
index 3958376..a85dbdc 100644
--- a/src/ChannelSidePanel.cpp
+++ b/src/ChannelSidePanel.cpp
@@ -4,15 +4,16 @@
#include "../include/Channel.hpp"
#include <SFML/Graphics/RectangleShape.hpp>
#include <SFML/Graphics/Text.hpp>
+#include <vector>
#include <cmath>
+using namespace std;
+
namespace dchat
{
- ChannelSidePanel::ChannelSidePanel(float _width) :
- width(floor(_width))
- {
-
- }
+ vector<Channel*> channels;
+ const float width = 200.0f;
+ const unsigned int FONT_SIZE = 20;
void ChannelSidePanel::addChannel(Channel *channel)
{
@@ -27,16 +28,21 @@ namespace dchat
window.draw(rect);
const sf::Font &font = ResourceCache::getFont("fonts/Roboto-Regular.ttf");
- sf::Vector2f position;
+ sf::Vector2f position(10.0f, 10.0f);
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());
+ sf::Text text(str, font, FONT_SIZE * Settings::getScaling());
text.setPosition(position);
window.draw(text);
- position.y += font.getLineSpacing(24 * Settings::getScaling());
+ position.y += font.getLineSpacing(FONT_SIZE * Settings::getScaling());
}
}
+
+ float ChannelSidePanel::getWidth()
+ {
+ return width;
+ }
}