diff options
author | David Robillard <d@drobilla.net> | 2022-05-20 14:23:41 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-05-21 16:49:47 -0400 |
commit | 1cd37cad0a06fbb15c44fd59dd6b2c12a0812a76 (patch) | |
tree | d7760c11195b003dc27a6f86f0c47df51c0a32da /examples/pugl_shader_demo.c | |
parent | 0fc1422e858bf9849b84aee2abeca3b553214b73 (diff) | |
download | pugl-1cd37cad0a06fbb15c44fd59dd6b2c12a0812a76.tar.gz pugl-1cd37cad0a06fbb15c44fd59dd6b2c12a0812a76.tar.bz2 pugl-1cd37cad0a06fbb15c44fd59dd6b2c12a0812a76.zip |
Add a uniform API for setting size hints
This collapses many functions into one, which makes the API more easily
extensible and reduces code size.
Diffstat (limited to 'examples/pugl_shader_demo.c')
-rw-r--r-- | examples/pugl_shader_demo.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/examples/pugl_shader_demo.c b/examples/pugl_shader_demo.c index db448ca..8f2c2e7 100644 --- a/examples/pugl_shader_demo.c +++ b/examples/pugl_shader_demo.c @@ -45,8 +45,7 @@ # define SHADER_DIR "shaders/" #endif -static const int defaultWidth = 512; -static const int defaultHeight = 512; +static const PuglSpan defaultSpan = 512; static const uintptr_t resizeTimerId = 1u; typedef struct { @@ -180,7 +179,7 @@ makeRects(const size_t numRects) { Rect* rects = (Rect*)calloc(numRects, sizeof(Rect)); for (size_t i = 0; i < numRects; ++i) { - rects[i] = makeRect(i, (float)defaultWidth); + rects[i] = makeRect(i, defaultSpan); } return rects; @@ -262,10 +261,11 @@ setupPugl(PuglTestApp* app) // Set up world and view puglSetClassName(app->world, "PuglShaderDemo"); puglSetWindowTitle(app->view, "Pugl OpenGL Shader Demo"); - puglSetDefaultSize(app->view, defaultWidth, defaultHeight); - puglSetMinSize(app->view, defaultWidth / 4, defaultHeight / 4); - puglSetMaxSize(app->view, defaultWidth * 4, defaultHeight * 4); - puglSetAspectRatio(app->view, 1, 1, 16, 9); + puglSetSizeHint(app->view, PUGL_DEFAULT_SIZE, defaultSpan, defaultSpan); + puglSetSizeHint(app->view, PUGL_MIN_SIZE, 128, 128); + puglSetSizeHint(app->view, PUGL_MAX_SIZE, 2048, 2048); + puglSetSizeHint(app->view, PUGL_MIN_ASPECT, 1, 1); + puglSetSizeHint(app->view, PUGL_MAX_ASPECT, 16, 9); puglSetBackend(app->view, puglGlBackend()); puglSetViewHint(app->view, PUGL_USE_COMPAT_PROFILE, PUGL_FALSE); puglSetViewHint(app->view, PUGL_USE_DEBUG_CONTEXT, app->opts.errorChecking); |