blob: e84396d12f0ae320a7685ac5afd2c6626b1f67b8 (
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
|
#pragma once
#include "Message.hpp"
#include "types.hpp"
#include "../include/Cache.hpp"
#include <SFML/Graphics/RenderTexture.hpp>
#include <SFML/Graphics/RenderWindow.hpp>
#include <SFML/Window/Event.hpp>
#include <stdexcept>
namespace dchat
{
class Channel;
class MessageBoard
{
friend class Channel;
public:
MessageBoard(const sf::Vector2u &size);
~MessageBoard();
void processEvent(const sf::Event &event);
void draw(sf::RenderWindow &window, Cache &cache);
private:
void updateStaticContentTexture(const sf::Vector2u &newSize);
void addMessage(Message *message);
private:
sf::RenderTexture staticContentTexture;
bool dirty;
bool selectingText;
bool leftMouseButtonPressed;
sf::Vector2f mousePos;
sf::Vector2f selectingTextStart;
std::vector<Message*> messages;
double scroll;
double scrollSpeed;
sf::Clock frameTimer;
double totalHeight;
bool scrollToBottom;
};
}
|