summaryrefslogtreecommitdiff
path: root/platform/glfw/glfw_view.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/glfw/glfw_view.hpp')
-rw-r--r--platform/glfw/glfw_view.hpp33
1 files changed, 24 insertions, 9 deletions
diff --git a/platform/glfw/glfw_view.hpp b/platform/glfw/glfw_view.hpp
index 77f4f64b01..d3257f6b9a 100644
--- a/platform/glfw/glfw_view.hpp
+++ b/platform/glfw/glfw_view.hpp
@@ -1,15 +1,15 @@
#pragma once
#include <mbgl/map/map.hpp>
-#include <mbgl/map/view.hpp>
-#include <mbgl/map/backend.hpp>
+#include <mbgl/renderer/renderer_backend.hpp>
#include <mbgl/util/run_loop.hpp>
#include <mbgl/util/timer.hpp>
#include <mbgl/util/geometry.hpp>
struct GLFWwindow;
+class GLFWRendererFrontend;
-class GLFWView : public mbgl::View, public mbgl::Backend {
+class GLFWView : public mbgl::RendererBackend, public mbgl::MapObserver {
public:
GLFWView(bool fullscreen = false, bool benchmark = false);
~GLFWView() override;
@@ -17,6 +17,8 @@ public:
float getPixelRatio() const;
void setMap(mbgl::Map*);
+
+ void setRenderFrontend(GLFWRendererFrontend*);
// Callback called when the user presses the key mapped to style change.
// The expected action is to set a new style, different to the current one.
@@ -26,21 +28,28 @@ public:
pauseResumeCallback = callback;
};
+ void setOnlineStatusCallback(std::function<void()> callback) {
+ onlineStatusCallback = callback;
+ }
+
void setShouldClose();
void setWindowTitle(const std::string&);
void run();
+
+ void invalidate();
- // mbgl::View implementation
- void bind() override;
mbgl::Size getSize() const;
- mbgl::Size getFramebufferSize() const;
+ mbgl::Size getFramebufferSize() const override;
- // mbgl::Backend implementation
- void invalidate() override;
+ // mbgl::RendererBackend implementation
+ void bind() override;
void updateAssumedState() override;
+ // mbgl::MapObserver implementation
+ void onDidFinishLoadingStyle() override;
+
protected:
// mbgl::Backend implementation
mbgl::gl::ProcAddress initializeExtension(const char*) override;
@@ -61,7 +70,7 @@ private:
mbgl::Color makeRandomColor() const;
mbgl::Point<double> makeRandomPoint() const;
- static std::unique_ptr<mbgl::style::Image> makeImage(int width, int height, float pixelRatio);
+ static std::unique_ptr<mbgl::style::Image> makeImage(const std::string& id, int width, int height, float pixelRatio);
void nextOrientation();
@@ -77,13 +86,17 @@ private:
std::vector<std::string> spriteIDs;
private:
+ void toggle3DExtrusions(bool visible);
+
mbgl::Map* map = nullptr;
+ GLFWRendererFrontend* rendererFrontend = nullptr;
bool fullscreen = false;
const bool benchmark = false;
bool tracking = false;
bool rotating = false;
bool pitching = false;
+ bool show3DExtrusions = false;
// Frame timer
int frames = 0;
@@ -102,6 +115,8 @@ private:
std::function<void()> changeStyleCallback;
std::function<void()> pauseResumeCallback;
+ std::function<void()> onlineStatusCallback;
+ std::function<void(mbgl::Map*)> animateRouteCallback;
mbgl::util::RunLoop runLoop;
mbgl::util::Timer frameTick;