aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/pugl_cairo_demo.c6
-rw-r--r--examples/pugl_cpp_demo.cpp9
-rw-r--r--examples/pugl_cursor_demo.c6
-rw-r--r--examples/pugl_embed_demo.c9
-rw-r--r--examples/pugl_print_events.c2
-rw-r--r--examples/pugl_shader_demo.c14
-rw-r--r--examples/pugl_vulkan_cpp_demo.cpp13
-rw-r--r--examples/pugl_vulkan_demo.c7
-rw-r--r--examples/pugl_window_demo.c6
9 files changed, 36 insertions, 36 deletions
diff --git a/examples/pugl_cairo_demo.c b/examples/pugl_cairo_demo.c
index 2cd4493..cf34158 100644
--- a/examples/pugl_cairo_demo.c
+++ b/examples/pugl_cairo_demo.c
@@ -216,9 +216,9 @@ main(int argc, char** argv)
PuglView* view = puglNewView(app.world);
puglSetWindowTitle(view, "Pugl Cairo Demo");
- puglSetDefaultSize(view, 512, 512);
- puglSetMinSize(view, 256, 256);
- puglSetMaxSize(view, 2048, 2048);
+ puglSetSizeHint(view, PUGL_DEFAULT_SIZE, 512, 512);
+ puglSetSizeHint(view, PUGL_MIN_SIZE, 256, 256);
+ puglSetSizeHint(view, PUGL_MAX_SIZE, 2048, 2048);
puglSetViewHint(view, PUGL_RESIZABLE, app.opts.resizable);
puglSetHandle(view, &app);
puglSetBackend(view, puglCairoBackend());
diff --git a/examples/pugl_cpp_demo.cpp b/examples/pugl_cpp_demo.cpp
index 7794529..015e7aa 100644
--- a/examples/pugl_cpp_demo.cpp
+++ b/examples/pugl_cpp_demo.cpp
@@ -115,10 +115,11 @@ main(int argc, char** argv)
world.setClassName("PuglCppDemo");
view.setWindowTitle("Pugl C++ Demo");
- view.setDefaultSize(512, 512);
- view.setMinSize(64, 64);
- view.setMaxSize(256, 256);
- view.setAspectRatio(1, 1, 16, 9);
+ view.setSizeHint(pugl::SizeHint::defaultSize, 512, 512);
+ view.setSizeHint(pugl::SizeHint::minSize, 64, 64);
+ view.setSizeHint(pugl::SizeHint::maxSize, 1024, 1024);
+ view.setSizeHint(pugl::SizeHint::minAspect, 1, 1);
+ view.setSizeHint(pugl::SizeHint::maxAspect, 16, 9);
view.setBackend(pugl::glBackend());
view.setHint(pugl::ViewHint::resizable, opts.resizable);
view.setHint(pugl::ViewHint::samples, opts.samples);
diff --git a/examples/pugl_cursor_demo.c b/examples/pugl_cursor_demo.c
index 8462193..c9839da 100644
--- a/examples/pugl_cursor_demo.c
+++ b/examples/pugl_cursor_demo.c
@@ -124,9 +124,9 @@ main(int argc, char** argv)
PuglView* view = puglNewView(app.world);
puglSetWindowTitle(view, "Pugl Cursor Demo");
- puglSetDefaultSize(view, 512, 256);
- puglSetMinSize(view, 128, 64);
- puglSetMaxSize(view, 512, 256);
+ puglSetSizeHint(view, PUGL_DEFAULT_SIZE, 512, 256);
+ puglSetSizeHint(view, PUGL_MIN_SIZE, 128, 64);
+ puglSetSizeHint(view, PUGL_MAX_SIZE, 512, 256);
puglSetBackend(view, puglGlBackend());
puglSetViewHint(view, PUGL_USE_DEBUG_CONTEXT, app.opts.errorChecking);
diff --git a/examples/pugl_embed_demo.c b/examples/pugl_embed_demo.c
index 085cfa7..66605b7 100644
--- a/examples/pugl_embed_demo.c
+++ b/examples/pugl_embed_demo.c
@@ -277,10 +277,11 @@ main(int argc, char** argv)
puglSetClassName(app.world, "PuglEmbedDemo");
const PuglRect parentFrame = {0, 0, 512, 512};
- puglSetDefaultSize(app.parent, 512, 512);
- puglSetMinSize(app.parent, borderWidth * 3, borderWidth * 3);
- puglSetMaxSize(app.parent, 1024, 1024);
- puglSetAspectRatio(app.parent, 1, 1, 16, 9);
+ puglSetSizeHint(app.parent, PUGL_DEFAULT_SIZE, 512, 512);
+ puglSetSizeHint(app.parent, PUGL_MIN_SIZE, 192, 192);
+ puglSetSizeHint(app.parent, PUGL_MAX_SIZE, 1024, 1024);
+ puglSetSizeHint(app.parent, PUGL_MIN_ASPECT, 1, 1);
+ puglSetSizeHint(app.parent, PUGL_MAX_ASPECT, 16, 9);
puglSetBackend(app.parent, puglGlBackend());
puglSetViewHint(app.parent, PUGL_USE_DEBUG_CONTEXT, opts.errorChecking);
diff --git a/examples/pugl_print_events.c b/examples/pugl_print_events.c
index 1bbe33a..3c07873 100644
--- a/examples/pugl_print_events.c
+++ b/examples/pugl_print_events.c
@@ -43,7 +43,7 @@ main(void)
puglSetClassName(app.world, "PuglPrintEvents");
puglSetWindowTitle(app.view, "Pugl Event Printer");
- puglSetDefaultSize(app.view, 512, 512);
+ puglSetSizeHint(app.view, PUGL_DEFAULT_SIZE, 512, 512);
puglSetBackend(app.view, puglStubBackend());
puglSetHandle(app.view, &app);
puglSetEventFunc(app.view, onEvent);
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);
diff --git a/examples/pugl_vulkan_cpp_demo.cpp b/examples/pugl_vulkan_cpp_demo.cpp
index 3f635ba..61c7b80 100644
--- a/examples/pugl_vulkan_cpp_demo.cpp
+++ b/examples/pugl_vulkan_cpp_demo.cpp
@@ -1708,17 +1708,16 @@ run(const char* const programPath,
{
PuglVulkanDemo app{programPath, opts, numRects};
- VkResult r = VK_SUCCESS;
- const auto width = static_cast<int>(app.extent.width);
- const auto height = static_cast<int>(app.extent.height);
+ VkResult r = VK_SUCCESS;
+ const auto width = app.extent.width;
+ const auto height = app.extent.height;
// Realize window so we can set up Vulkan
app.world.setClassName("PuglVulkanCppDemo");
app.view.setWindowTitle("Pugl Vulkan C++ Demo");
- app.view.setAspectRatio(1, 1, 16, 9);
- app.view.setDefaultSize(width, height);
- app.view.setMinSize(width / 4, height / 4);
- app.view.setMaxSize(width * 4, height * 4);
+ app.view.setSizeHint(pugl::SizeHint::defaultSize, width, height);
+ app.view.setSizeHint(pugl::SizeHint::minSize, width / 4, height / 4);
+ app.view.setSizeHint(pugl::SizeHint::maxSize, width * 4, height * 4);
app.view.setBackend(pugl::vulkanBackend());
app.view.setHint(pugl::ViewHint::resizable, opts.resizable);
const pugl::Status st = app.view.realize();
diff --git a/examples/pugl_vulkan_demo.c b/examples/pugl_vulkan_demo.c
index b7ff146..ec465bb 100644
--- a/examples/pugl_vulkan_demo.c
+++ b/examples/pugl_vulkan_demo.c
@@ -1036,9 +1036,8 @@ main(int argc, char** argv)
memset(&app, 0, sizeof(app));
VulkanState* vk = &app.vk;
- const uint32_t defaultWidth = 640;
- const uint32_t defaultHeight = 360;
- const PuglRect frame = {0, 0, defaultWidth, defaultHeight};
+ const PuglSpan defaultWidth = 640;
+ const PuglSpan defaultHeight = 360;
// Parse command line options
app.opts = puglParseTestOptions(&argc, &argv);
@@ -1065,7 +1064,7 @@ main(int argc, char** argv)
// Create window
puglSetWindowTitle(app.view, "Pugl Vulkan Demo");
- puglSetFrame(app.view, frame);
+ puglSetSizeHint(app.view, PUGL_DEFAULT_SIZE, defaultWidth, defaultHeight);
puglSetHandle(app.view, &app);
puglSetBackend(app.view, puglVulkanBackend());
puglSetViewHint(app.view, PUGL_RESIZABLE, app.opts.resizable);
diff --git a/examples/pugl_window_demo.c b/examples/pugl_window_demo.c
index 912ccb6..7cb3722 100644
--- a/examples/pugl_window_demo.c
+++ b/examples/pugl_window_demo.c
@@ -194,9 +194,9 @@ main(int argc, char** argv)
puglSetWindowTitle(view, "Pugl Window Demo");
puglSetFrame(view, frame);
- puglSetDefaultSize(view, 512, 512);
- puglSetMinSize(view, 128, 128);
- puglSetMaxSize(view, 2048, 2048);
+ puglSetSizeHint(view, PUGL_DEFAULT_SIZE, 512, 512);
+ puglSetSizeHint(view, PUGL_MIN_SIZE, 128, 128);
+ puglSetSizeHint(view, PUGL_MAX_SIZE, 2048, 2048);
puglSetBackend(view, puglGlBackend());
puglSetViewHint(view, PUGL_USE_DEBUG_CONTEXT, opts.errorChecking);