derive from GLKViewController
this handles resizing the view/framebuffer much better fixes #130, #131, #133, #118
This commit is contained in:
@@ -27,7 +27,7 @@ public:
|
||||
void setup();
|
||||
void loadStyle(const uint8_t *const data, uint32_t bytes);
|
||||
void loadSettings();
|
||||
void resize(uint16_t width, uint16_t height, uint16_t fb_width, uint16_t fb_height);
|
||||
void resize(uint16_t width, uint16_t height, float ratio, uint16_t fb_width, uint16_t fb_height);
|
||||
void toggleRaster();
|
||||
|
||||
/* callback */
|
||||
|
||||
@@ -22,7 +22,9 @@ public:
|
||||
void updateAnimations();
|
||||
void cancelAnimations();
|
||||
|
||||
void resize(uint16_t width, uint16_t height, uint16_t fb_width, uint16_t fb_height);
|
||||
// Map view changes.
|
||||
// Note: width * ratio does not necessarily equal fb_width
|
||||
void resize(uint16_t width, uint16_t height, float ratio, uint16_t fb_width, uint16_t fb_height);
|
||||
|
||||
// Relative changes
|
||||
void moveBy(double dx, double dy, double duration = 0);
|
||||
|
||||
@@ -40,7 +40,7 @@ std::shared_ptr<Request> request_http(const std::string &url,
|
||||
void cancel_request_http(const std::shared_ptr<Request> &req);
|
||||
|
||||
// Returns a relative timestamp in seconds. This value must be monotonic.
|
||||
double time();
|
||||
double elapsed();
|
||||
|
||||
// Performs routine cleanup operation and is called on every loop iteration.
|
||||
void cleanup();
|
||||
|
||||
@@ -14,11 +14,11 @@ public:
|
||||
complete
|
||||
};
|
||||
animation(double duration)
|
||||
: start(platform::time()),
|
||||
: start(platform::elapsed()),
|
||||
duration(duration) {}
|
||||
|
||||
double progress() const {
|
||||
return (platform::time() - start) / duration;
|
||||
return (platform::elapsed() - start) / duration;
|
||||
}
|
||||
|
||||
virtual state update() const = 0;
|
||||
|
||||
Reference in New Issue
Block a user