aboutsummaryrefslogtreecommitdiff
path: root/src/Channel.cpp
blob: 347a6a6d5e1de2375c54d66403678fd8157ae2fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include "../include/Channel.hpp"
#include <cstring>

using namespace std;

namespace dchat
{
    Channel::Channel(const std::string &_name) : 
        messageBoard(sf::Vector2u(1.0f, 1.0f)),
        localOfflineUser("You"),
        name(_name)
    {
        {
            Message *message = new Message(&localOfflineUser, u8"hello, worldåäö1![emoji](https://discordemoji.com/assets/emoji/playtime.png)");
            messageBoard.addMessage(message);
        }
        
        {
            Message *message = new Message(&localOfflineUser, u8"hello, world2![emoji](https://discordemoji.com/assets/emoji/Feels3DMan.gif)");
            messageBoard.addMessage(message);
        }
        
        {
            Message *message = new Message(&localOfflineUser, u8"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.");
            messageBoard.addMessage(message);
        }
        
        {
            Message *message = new Message(&localOfflineUser, u8"Lorem ipsumdolorsitamet,consecteturadipiscingelit,seddoeiusmodtemporincididuntutaboreetdoloremagnaaliqua.Utenimadminimveniam");
            messageBoard.addMessage(message);
        }
        
        {
            Message *message = new Message(&localOfflineUser, u8"xddd");
            messageBoard.addMessage(message);
        }
        
        {
            Message *message = new Message(&localOfflineUser, u8"[emoji](https://discordemoji.com/assets/emoji/SlowbroDumb.png)");
            messageBoard.addMessage(message);
        }
        
        {
            Message *message = new Message(&localOfflineUser, u8"Message after big emoji");
            messageBoard.addMessage(message);
        }
        
        {
            Message *message = new Message(&localOfflineUser, u8"aaa\n[emoji](https://discordemoji.com/assets/emoji/Feels3DMan.gif)\nbbb");
            messageBoard.addMessage(message);
        }
    }
    
    Channel::~Channel()
    {
        
    }
    
    User* Channel::getLocalUser()
    {
        return &localOfflineUser;
    }
    
    MessageBoard& Channel::getMessageBoard()
    {
        return messageBoard;
    }
    
    const string& Channel::getName() const
    {
        return name;
    }
    
    void Channel::processEvent(const sf::Event &event)
    {
        chatbar.processEvent(event, this);
        messageBoard.processEvent(event);
    }
    
    void Channel::draw(sf::RenderWindow &window, const sf::Vector2f &position, Cache &cache)
    {
        messageBoard.draw(window, position, cache);
        chatbar.draw(window, position);
    }
}