use a file source object to abstract loading of resources

This commit is contained in:
Konstantin Käfer
2014-08-08 18:25:45 +02:00
parent a045d9c9d4
commit 4657e6e023
17 changed files with 7074 additions and 560 deletions

View File

@@ -45,15 +45,6 @@ int main(int argc, char *argv[]) {
sigIntHandler.sa_flags = 0;
sigaction(SIGINT, &sigIntHandler, NULL);
// read default stylesheet from disk
std::ifstream stylefile("./style.min.js");
if (!stylefile.good()) {
fprintf(stderr, "Cannot read style file\n");
return 1;
}
std::stringstream stylejson;
stylejson << stylefile.rdbuf();
view = new GLFWView();
mbgl::Map map(*view);
@@ -72,7 +63,10 @@ int main(int argc, char *argv[]) {
}
// Load style
map.setStyleJSON(stylejson.str());
std::string style = "file://";
style += uv::cwd();
style += "/styles/bright/style.json";
map.setStyleURL(style);
int ret = view->run();