Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional map mode argument to render #3109

Merged
merged 2 commits into from
Dec 30, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion bin/render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ int main(int argc, char* argv[]) {
args::ValueFlag<uint32_t> widthValue(argumentParser, "pixels", "Image width", {'w', "width"});
args::ValueFlag<uint32_t> heightValue(argumentParser, "pixels", "Image height", {'h', "height"});

args::ValueFlag<std::string> mapModeValue(argumentParser, "MapMode", "Map mode (e.g. 'static', 'tile', 'continuous')", {'m', "mode"});

try {
argumentParser.ParseCLI(argc, argv);
} catch (const args::Help&) {
Expand Down Expand Up @@ -79,11 +81,21 @@ int main(int argc, char* argv[]) {

util::RunLoop loop;

MapMode mapMode = MapMode::Static;
if (mapModeValue) {
const auto modeStr = args::get(mapModeValue);
if (modeStr == "tile") {
mapMode = MapMode::Tile;
} else if (modeStr == "continuous") {
mapMode = MapMode::Continuous;
}
}

HeadlessFrontend frontend({width, height}, static_cast<float>(pixelRatio));
Map map(frontend,
MapObserver::nullObserver(),
MapOptions()
.withMapMode(MapMode::Static)
.withMapMode(mapMode)
.withSize(frontend.getSize())
.withPixelRatio(static_cast<float>(pixelRatio)),
ResourceOptions()
Expand Down