blob: 6d718e500e9705a616149db7ea86702bd3ba0c90 (
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
|
#include "../include/Channel.hpp"
#include "../include/ChannelSidePanel.hpp"
#include "../include/Cache.hpp"
#include "../include/ResourceCache.hpp"
#include <string>
#include <SFML/Graphics.hpp>
#include <cstring>
#include <X11/Xlib.h>
#include <boost/filesystem/path.hpp>
using namespace std;
using namespace dchat;
using namespace TinyProcessLib;
int main(int argc, char **argv)
{
/*
boost::filesystem::path programPath(argv[0]);
auto parentPath = programPath.parent_path();
printf("parent path: %s\n", parentPath.string().c_str());
boost::filesystem::current_path(parentPath); // Ensures loading of resources works no matter which path we run this executable from
*/
XInitThreads();
sf::RenderWindow window(sf::VideoMode(1920, 1080), "dchat");
window.setVerticalSyncEnabled(false);
window.setFramerateLimit(60);
//odhtdb::Database database("bootstrap.ring.cx", 4222, Cache::getDchatDir());
Cache cache;
Channel channel;
//ChannelSidePanel channelSidePanel;
//channelSidePanel.addChannel(&channel);
sf::Event event;
while (window.isOpen())
{
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(sf::Color(40, 40, 40));
channel.draw(window, cache);
window.display();
}
return 0;
}
|