diff options
Diffstat (limited to 'examples/pugl_window_demo.c')
-rw-r--r-- | examples/pugl_window_demo.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/examples/pugl_window_demo.c b/examples/pugl_window_demo.c index 7cb3722..8d79f00 100644 --- a/examples/pugl_window_demo.c +++ b/examples/pugl_window_demo.c @@ -14,6 +14,7 @@ #include <math.h> #include <stdbool.h> +#include <stdint.h> #include <string.h> typedef struct { @@ -35,7 +36,7 @@ typedef struct { bool verbose; } PuglTestApp; -static const double pad = 64.0; +static const uint8_t pad = 64u; static void onDisplay(PuglView* view) @@ -69,26 +70,26 @@ onKeyPress(PuglView* view, const PuglKeyEvent* event) app->quit = 1; } else if (event->state & PUGL_MOD_SHIFT) { if (event->key == PUGL_KEY_UP) { - frame.height += 10; + frame.height = (PuglSpan)(frame.height + 10u); } else if (event->key == PUGL_KEY_DOWN) { - frame.height -= 10; + frame.height = (PuglSpan)(frame.height - 10u); } else if (event->key == PUGL_KEY_LEFT) { - frame.width -= 10; + frame.width = (PuglSpan)(frame.width - 10u); } else if (event->key == PUGL_KEY_RIGHT) { - frame.width += 10; + frame.width = (PuglSpan)(frame.width + 10u); } else { return; } puglSetFrame(view, frame); } else { if (event->key == PUGL_KEY_UP) { - frame.y -= 10; + frame.y = (PuglCoord)(frame.y - 10); } else if (event->key == PUGL_KEY_DOWN) { - frame.y += 10; + frame.y = (PuglCoord)(frame.y + 10); } else if (event->key == PUGL_KEY_LEFT) { - frame.x -= 10; + frame.x = (PuglCoord)(frame.x - 10); } else if (event->key == PUGL_KEY_RIGHT) { - frame.x += 10; + frame.x = (PuglCoord)(frame.x + 10); } else { return; } @@ -187,8 +188,10 @@ main(int argc, char** argv) for (unsigned i = 0; i < 2; ++i) { CubeView* cube = &app.cubes[i]; PuglView* view = cube->view; - const PuglRect frame = { - pad + (128.0 + pad) * i, pad + (128.0 + pad) * i, 512.0, 512.0}; + const PuglRect frame = {(PuglCoord)(pad + (128.0 + pad) * i), + (PuglCoord)(pad + (128.0 + pad) * i), + 512u, + 512u}; cube->dist = 10; |