derive from GLKViewController

this handles resizing the view/framebuffer much better

fixes #130, #131, #133, #118
This commit is contained in:
Konstantin Käfer
2014-04-14 18:48:11 -04:00
parent 305e688a3a
commit f18aa61e33
13 changed files with 216 additions and 216 deletions

View File

@@ -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 */

View File

@@ -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);

View File

@@ -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();

View File

@@ -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;