-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
40 lines (33 loc) · 1.16 KB
/
main.cpp
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
#include "runner.h"
#include "iohelpers.h"
#ifdef __APPLE__
#include "ResourcePath.hpp"
#endif
int main() {
ini_data options = parse_ini("CPaint.ini");
std::cout << "Options: " << options.font << ", " << options.height << "x" << options.width << "\n";
sf::Font inFont;
std::string font_file = options.font;
#ifdef __APPLE__
if(!options.font.compare("VeraMono.ttf"))
font_file = resourcePath() + "VeraMono.ttf";
#endif
if(!inFont.loadFromFile(font_file)) {
emit_error("Unable to load font from file:" + options.font + "\n");
return -1;
}
sf::RenderWindow window(sf::VideoMode(options.height, options.width), "Complex Paint Revamped", sf::Style::Titlebar | sf::Style::Close);
window.setPosition(sf::Vector2i(0, 0));
sf::RenderTexture pic;
if(!pic.create(window.getSize().x, window.getSize().y - HEIGHT_OFFSET))
return -2;
sf::RenderTexture jpic;
if(!jpic.create(window.getSize().x, window.getSize().y - HEIGHT_OFFSET))
return -3;
Runner run = Runner(&window, &inFont, &pic, &jpic);
while(window.isOpen()) {
run.HandleEvents();
run.Draw();
}
return 0;
}