aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
blob: 284df560f86f373f1024d27f161beebced8643db (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
#include "../include/Channel.hpp"
#include "../include/ChannelSidePanel.hpp"
#include "../include/Cache.hpp"
#include <string>
#include <SFML/Graphics.hpp>
#include <cstring>
#include "process.hpp"

using namespace std;
using namespace dchat;
using namespace TinyProcessLib;

int main()
{
    sf::RenderWindow window(sf::VideoMode(1920, 1080), "dchat");
    window.setVerticalSyncEnabled(false);
    window.setFramerateLimit(60);
    
    Cache cache;
    
    Channel channel;
    ChannelSidePanel channelSidePanel;
    channelSidePanel.addChannel(&channel);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
            else if(event.type == sf::Event::Resized)
            {
                sf::View view(sf::FloatRect(0.0f, 0.0f, event.size.width, event.size.height));
                window.setView(view);
            }
            channel.processEvent(event);
        }

        window.clear();
        channel.draw(window, cache);
        window.display();
    }

    return 0;
}