aboutsummaryrefslogtreecommitdiff
path: root/src/UsersSidePanel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/UsersSidePanel.cpp')
-rw-r--r--src/UsersSidePanel.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/UsersSidePanel.cpp b/src/UsersSidePanel.cpp
index 5af01bc..39c0b86 100644
--- a/src/UsersSidePanel.cpp
+++ b/src/UsersSidePanel.cpp
@@ -1,6 +1,7 @@
#include "../include/UsersSidePanel.hpp"
#include "../include/ResourceCache.hpp"
#include "../include/Settings.hpp"
+#include "../include/Channel.hpp"
#include <SFML/Graphics/RectangleShape.hpp>
#include <SFML/Graphics/Text.hpp>
#include <vector>
@@ -10,13 +11,18 @@ using namespace std;
namespace dchat
{
- vector<User*> users;
+ Channel *currentChannel = nullptr;
const float width = 200.0f;
const unsigned int FONT_SIZE = 20;
- void UsersSidePanel::addUser(User *user)
+ void UsersSidePanel::setCurrentChannel(Channel *channel)
{
- users.push_back(user);
+ currentChannel = channel;
+ }
+
+ Channel* UsersSidePanel::getCurrentChannel()
+ {
+ return currentChannel;
}
void UsersSidePanel::draw(sf::RenderWindow &window)
@@ -27,9 +33,11 @@ namespace dchat
rect.setPosition(windowSize.x - width, 0.0f);
window.draw(rect);
+ if(!currentChannel) return;
+
const sf::Font &font = ResourceCache::getFont("fonts/Roboto-Regular.ttf");
sf::Vector2f position(rect.getPosition().x + 10.0f, 10.0f);
- for(User *user : users)
+ for(User *user : currentChannel->getUsers())
{
// TODO: Remove this shit
sf::String str = sf::String::fromUtf8(user->getName().begin(), user->getName().end());