Newer
Older
#include "graphics/opengl/Window.h"
#include "html/HTMLParser.h"
#include "CommandLineParams.h"
const std::unique_ptr<Window> window = std::make_unique<Window>();
//URL currentURL;
logDebug() << "main::setWindowContent - " << url << std::endl;
WebResource res = getWebResource(url);
if (res.resourceType == ResourceType::INVALID) {
logError() << "Invalid resource type: " << res.raw << std::endl;
HTMLParser parser;
const std::clock_t begin = clock();
std::shared_ptr<Node> rootNode = parser.parse(res.raw);
const std::clock_t end = clock();
logDebug() << "Parsed document in: " << std::fixed << ((static_cast<double>(end - begin)) / CLOCKS_PER_SEC) << std::scientific << " seconds" << std::endl;
int main(int argc, char *argv[]) {
if (argc == 1) {
std::cout << "./netrunner <url|file.html> [-log <error|warning|notice|info|debug>]" << std::endl;
std::cout << "/g/ntr - NetRunner build " << __DATE__ << std::endl;
std::string url = getCLParamByIndex(1);
if (url[0] == '/') {
url = "file://" + url;
}
logDebug() << "loading [" << window->currentURL << "]" << std::endl;
if (!setWindowContent(window->currentURL)) {
if (!window->window) {
return 1;
}
glfwWaitEvents(); // block until something changes
//const std::clock_t end = clock();
//std::cout << '\r' << std::fixed << (((static_cast<double>(end - begin)) / CLOCKS_PER_SEC) * 1000) << std::scientific << " ms/f " << std::flush;