aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-03-31 20:03:29 +0200
committerDavid Robillard <d@drobilla.net>2020-03-31 20:03:29 +0200
commit3f71daba7d92c50f7fd31e8775fc58d3ebf3900d (patch)
tree296250347e38777d3c96f5e5c0871ad352280dcc
parent87e9220faf2cbafe3a250e1a541b1103b4009e77 (diff)
GL3 Demo: Fix conversion warnings
-rw-r--r--examples/pugl_gl3_demo.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/examples/pugl_gl3_demo.c b/examples/pugl_gl3_demo.c
index 26db852..210d27f 100644
--- a/examples/pugl_gl3_demo.c
+++ b/examples/pugl_gl3_demo.c
@@ -108,9 +108,11 @@ onConfigure(PuglView* view, double width, double height)
static void
onExpose(PuglView* view)
{
- PuglTestApp* app = (PuglTestApp*)puglGetHandle(view);
- const PuglRect frame = puglGetFrame(view);
- const double time = puglGetTime(puglGetWorld(view));
+ PuglTestApp* app = (PuglTestApp*)puglGetHandle(view);
+ const PuglRect frame = puglGetFrame(view);
+ const float width = (float)frame.width;
+ const float height = (float)frame.height;
+ const double time = puglGetTime(puglGetWorld(view));
// Construct projection matrix for 2D window surface (in pixels)
mat4 proj;
@@ -137,11 +139,11 @@ onExpose(PuglView* view)
// Move rect around in an arbitrary way that looks cool
rect->pos[0] =
- (float)(frame.width - rect->size[0] + offset[0]) *
+ (float)(width - rect->size[0] + offset[0]) *
(sinf((float)time * rect->size[0] / 64.0f + normal) + 1.0f) /
2.0f;
rect->pos[1] =
- (float)(frame.height - rect->size[1] + offset[1]) *
+ (float)(height - rect->size[1] + offset[1]) *
(cosf((float)time * rect->size[1] / 64.0f + normal) + 1.0f) /
2.0f;
}