diff options
Diffstat (limited to 'platform/glfw/glfw_view.cpp')
-rw-r--r-- | platform/glfw/glfw_view.cpp | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/platform/glfw/glfw_view.cpp b/platform/glfw/glfw_view.cpp index 74dda734c0..3d10f2c654 100644 --- a/platform/glfw/glfw_view.cpp +++ b/platform/glfw/glfw_view.cpp @@ -2,6 +2,7 @@ #include "glfw_backend.hpp" #include "glfw_renderer_frontend.hpp" #include "ny_route.hpp" +#include "test_writer.hpp" #include <mbgl/annotation/annotation.hpp> #include <mbgl/gfx/backend.hpp> @@ -36,6 +37,7 @@ #include <cassert> #include <cstdlib> +#include <iostream> void glfwError(int error, const char *description) { mbgl::Log::Error(mbgl::Event::OpenGL, "GLFW error (%i): %s", error, description); @@ -124,8 +126,8 @@ GLFWView::GLFWView(bool fullscreen_, bool benchmark_) printf("- Press `E` to insert an example building extrusion layer\n"); printf("- Press `O` to toggle online connectivity\n"); printf("- Press `Z` to cycle through north orientations\n"); - printf("- Prezz `X` to cycle through the viewport modes\n"); - printf("- Press `I` to Delete existing database and re-initialize\n"); + printf("- Press `X` to cycle through the viewport modes\n"); + printf("- Press `I` to delete existing database and re-initialize\n"); printf("- Press `A` to cycle through Mapbox offices in the world + dateline monument\n"); printf("- Press `B` to cycle through the color, stencil, and depth buffer\n"); printf("- Press `D` to cycle through camera bounds: inside, crossing IDL at left, crossing IDL at right, and disabled\n"); @@ -138,10 +140,12 @@ GLFWView::GLFWView(bool fullscreen_, bool benchmark_) printf("- Press `K` to add a random custom runtime imagery annotation\n"); printf("- Press `L` to add a random line annotation\n"); printf("- Press `W` to pop the last-added annotation off\n"); - printf("\n"); printf("- Press `P` to pause tile requests\n"); - printf("- `Control` + mouse drag to rotate\n"); - printf("- `Shift` + mouse drag to tilt\n"); + printf("\n"); + printf("- Hold `Control` + mouse drag to rotate\n"); + printf("- Hold `Shift` + mouse drag to tilt\n"); + printf("\n"); + printf("- Press `F1` to generate a render test for the current view\n"); printf("\n"); printf("- Press `Tab` to cycle through the map debug options\n"); printf("- Press `Esc` to quit\n"); @@ -370,6 +374,20 @@ void GLFWView::onKey(GLFWwindow *window, int key, int /*scancode*/, int action, : mbgl::style::VisibilityType::Visible); } } break; + case GLFW_KEY_F1: { + bool success = TestWriter() + .withInitialSize(mbgl::Size(view->width, view->height)) + .withStyle(view->map->getStyle()) + .withCameraOptions(view->map->getCameraOptions()) + .write(view->testDirectory); + + if (success) { + mbgl::Log::Info(mbgl::Event::General, "Render test created!"); + } else { + mbgl::Log::Error(mbgl::Event::General, + "Fail to create render test! Base directory does not exist or permission denied."); + } + } break; } } |