use a file source object to abstract loading of resources
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user