Files
MapLibreParticleLab/include/mbgl/platform/default/glfw_view.hpp
Konstantin Käfer 47ede853c4 fixes black flicker on rotating the device
fixes #838

instead of rendering ad libitum on the map thread, we are now driving rendering from the UI thread on iOS via the map.renderSync() function. There are still white bars during the rotation, but the general content of the view is kept visible.

- upgrades GLFW to 3.1
- removes swapped/needsSwap in favor of a more explicit scheme
- View#invalidate() now replaces View#swap() and is called whenever the View needs to trigger a rerender. GLFW and Android to this right away, while iOS goes back to the main thread and does the Map redrawing as part of the GLKView update
- sets all iOS deployment targets to 7.0
- disables SQLite3 version check, since the library version changed on iOS 8.2
2015-03-12 12:16:38 +01:00

45 lines
1.0 KiB
C++

#ifndef MBGL_COMMON_GLFW_VIEW
#define MBGL_COMMON_GLFW_VIEW
#include <mbgl/mbgl.hpp>
#ifdef NVIDIA
#define GLFW_INCLUDE_ES2
#endif
#include <GLFW/glfw3.h>
class GLFWView : public mbgl::View {
public:
GLFWView(bool fullscreen = false);
~GLFWView();
void initialize(mbgl::Map *map) override;
void activate() override;
void deactivate() override;
void notify() override;
void invalidate() override;
static void onKey(GLFWwindow *window, int key, int scancode, int action, int mods);
static void onScroll(GLFWwindow *window, double xoffset, double yoffset);
static void onResize(GLFWwindow *window, int width, int height);
static void onMouseClick(GLFWwindow *window, int button, int action, int modifiers);
static void onMouseMove(GLFWwindow *window, double x, double y);
int run();
void fps();
public:
bool fullscreen = false;
double lastX = 0, lastY = 0;
bool tracking = false;
bool rotating = false;
double lastClick = -1;
GLFWwindow *window = nullptr;
};
#endif