aboutsummaryrefslogtreecommitdiff
path: root/include/MessageBoard.hpp
blob: f39976183abbb984ee29536f090c201051c0aa7d (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
#pragma once

#include "Message.hpp"
#include <SFML/Graphics/RenderTexture.hpp>
#include <SFML/Graphics/RenderWindow.hpp>
#include <SFML/Window/Event.hpp>
#include <stdexcept>

namespace dchat
{
    class MessageBoard
    {
    public:
        MessageBoard(const sf::Vector2u &size);
        ~MessageBoard();
        
        void updateStaticContentTexture(const sf::Vector2u &newSize);
        void addMessage(Message *message);
        
        void processEvent(const sf::Event &event);
        void draw(sf::RenderWindow &window);
    private:
        sf::RenderTexture staticContentTexture;
        bool useStaticContentTexture;
        bool dirty;
        bool selectingText;
        bool leftMouseButtonPressed;
        sf::Vector2f mousePos;
        sf::Vector2f selectingTextStart;
        std::vector<Message*> messages;
    };
}