aboutsummaryrefslogtreecommitdiffstats
path: root/examples/pugl_cursor_demo.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/pugl_cursor_demo.c')
-rw-r--r--examples/pugl_cursor_demo.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/examples/pugl_cursor_demo.c b/examples/pugl_cursor_demo.c
index ba9c54f..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>
@@ -19,7 +19,7 @@ typedef struct {
} PuglTestApp;
static void
-onConfigure(const double width, const double height)
+onConfigure(const PuglSpan width, const PuglSpan height)
{
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
@@ -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;