diff options
Diffstat (limited to 'examples/pugl_cursor_demo.c')
-rw-r--r-- | examples/pugl_cursor_demo.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/examples/pugl_cursor_demo.c b/examples/pugl_cursor_demo.c index bc219f0..6ddd5ad 100644 --- a/examples/pugl_cursor_demo.c +++ b/examples/pugl_cursor_demo.c @@ -1,10 +1,10 @@ // Copyright 2012-2020 David Robillard <d@drobilla.net> // SPDX-License-Identifier: ISC -#include "test/test_utils.h" +#include <puglutil/test_utils.h> -#include "pugl/gl.h" -#include "pugl/pugl.h" +#include <pugl/gl.h> +#include <pugl/pugl.h> #include <stdbool.h> @@ -40,7 +40,7 @@ onExpose(void) glColor3f(0.6f, 0.6f, 0.6f); for (int row = 1; row < N_ROWS; ++row) { - const float y = (float)row * (2.0f / (float)N_ROWS) - 1.0f; + const float y = ((float)row * (2.0f / (float)N_ROWS)) - 1.0f; glBegin(GL_LINES); glVertex2f(-1.0f, y); glVertex2f(1.0f, y); @@ -48,7 +48,7 @@ onExpose(void) } for (int col = 1; col < N_COLS; ++col) { - const float x = (float)col * (2.0f / (float)N_COLS) - 1.0f; + const float x = ((float)col * (2.0f / (float)N_COLS)) - 1.0f; glBegin(GL_LINES); glVertex2f(x, -1.0f); glVertex2f(x, 1.0f); @@ -59,9 +59,9 @@ onExpose(void) static void onMotion(PuglView* view, double x, double y) { - const PuglRect frame = puglGetFrame(view); - int row = (int)(y * N_ROWS / frame.height); - int col = (int)(x * N_COLS / frame.width); + const PuglArea size = puglGetSizeHint(view, PUGL_CURRENT_SIZE); + int row = (int)(y * N_ROWS / size.height); + int col = (int)(x * N_COLS / size.width); row = (row < 0) ? 0 : (row >= N_ROWS) ? (N_ROWS - 1) : row; col = (col < 0) ? 0 : (col >= N_COLS) ? (N_COLS - 1) : col; |