aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-01-12 10:30:10 -0500
committerDavid Robillard <d@drobilla.net>2023-01-14 11:53:28 -0500
commitbd4f79646f623e929e6aa22bea028952b515aeef (patch)
treee2dcc2635bb2b12b9c552755b35a0343005ce88a /examples
parent786a28e4a2bc9fce95a8d2e6cd1a4c76d2ae1a0f (diff)
downloadpugl-bd4f79646f623e929e6aa22bea028952b515aeef.tar.gz
pugl-bd4f79646f623e929e6aa22bea028952b515aeef.tar.bz2
pugl-bd4f79646f623e929e6aa22bea028952b515aeef.zip
Add general string hint interface
This replaces the window title and class name APIs with a more general one that can be easily extended to other things, like icon names, more detailed application hints, and so on.
Diffstat (limited to 'examples')
-rw-r--r--examples/pugl_cairo_demo.c4
-rw-r--r--examples/pugl_clipboard_demo.c4
-rw-r--r--examples/pugl_cpp_demo.cpp4
-rw-r--r--examples/pugl_cursor_demo.c4
-rw-r--r--examples/pugl_embed_demo.c4
-rw-r--r--examples/pugl_management_demo.c6
-rw-r--r--examples/pugl_print_events.c4
-rw-r--r--examples/pugl_shader_demo.c4
-rw-r--r--examples/pugl_vulkan_cpp_demo.cpp4
-rw-r--r--examples/pugl_vulkan_demo.c2
-rw-r--r--examples/pugl_window_demo.c4
11 files changed, 22 insertions, 22 deletions
diff --git a/examples/pugl_cairo_demo.c b/examples/pugl_cairo_demo.c
index f580540..0a4ddd9 100644
--- a/examples/pugl_cairo_demo.c
+++ b/examples/pugl_cairo_demo.c
@@ -211,11 +211,11 @@ main(int argc, char** argv)
}
app.world = puglNewWorld(PUGL_PROGRAM, 0);
- puglSetClassName(app.world, "PuglCairoDemo");
+ puglSetWorldString(app.world, PUGL_CLASS_NAME, "PuglCairoDemo");
PuglView* view = puglNewView(app.world);
- puglSetWindowTitle(view, "Pugl Cairo Demo");
+ puglSetViewString(view, PUGL_WINDOW_TITLE, "Pugl Cairo Demo");
puglSetSizeHint(view, PUGL_DEFAULT_SIZE, 512, 512);
puglSetSizeHint(view, PUGL_MIN_SIZE, 256, 256);
puglSetSizeHint(view, PUGL_MAX_SIZE, 2048, 2048);
diff --git a/examples/pugl_clipboard_demo.c b/examples/pugl_clipboard_demo.c
index d4ab50f..efeb1eb 100644
--- a/examples/pugl_clipboard_demo.c
+++ b/examples/pugl_clipboard_demo.c
@@ -217,9 +217,9 @@ main(int argc, char** argv)
PuglView* const view = app.cube.view;
puglSetWorldHandle(app.world, &app);
- puglSetClassName(app.world, "Pugl Test");
+ puglSetWorldString(app.world, PUGL_CLASS_NAME, "Pugl Test");
- puglSetWindowTitle(view, "Pugl Clipboard Demo");
+ puglSetViewString(view, PUGL_WINDOW_TITLE, "Pugl Clipboard Demo");
puglSetSizeHint(view, PUGL_DEFAULT_SIZE, 512, 512);
puglSetSizeHint(view, PUGL_MIN_SIZE, 128, 128);
puglSetBackend(view, puglGlBackend());
diff --git a/examples/pugl_cpp_demo.cpp b/examples/pugl_cpp_demo.cpp
index 49d547f..2b3c0a1 100644
--- a/examples/pugl_cpp_demo.cpp
+++ b/examples/pugl_cpp_demo.cpp
@@ -112,9 +112,9 @@ main(int argc, char** argv)
CubeView view{world};
PuglFpsPrinter fpsPrinter{};
- world.setClassName("PuglCppDemo");
+ world.setString(pugl::StringHint::className, "PuglCppDemo");
- view.setWindowTitle("Pugl C++ Demo");
+ view.setString(pugl::StringHint::windowTitle, "Pugl C++ Demo");
view.setSizeHint(pugl::SizeHint::defaultSize, 512, 512);
view.setSizeHint(pugl::SizeHint::minSize, 64, 64);
view.setSizeHint(pugl::SizeHint::maxSize, 1024, 1024);
diff --git a/examples/pugl_cursor_demo.c b/examples/pugl_cursor_demo.c
index 9aa0301..ba9c54f 100644
--- a/examples/pugl_cursor_demo.c
+++ b/examples/pugl_cursor_demo.c
@@ -119,11 +119,11 @@ main(int argc, char** argv)
app.world = puglNewWorld(PUGL_PROGRAM, 0);
puglSetWorldHandle(app.world, &app);
- puglSetClassName(app.world, "PuglCursorDemo");
+ puglSetWorldString(app.world, PUGL_CLASS_NAME, "PuglCursorDemo");
PuglView* view = puglNewView(app.world);
- puglSetWindowTitle(view, "Pugl Cursor Demo");
+ puglSetViewString(view, PUGL_WINDOW_TITLE, "Pugl Cursor Demo");
puglSetSizeHint(view, PUGL_DEFAULT_SIZE, 512, 256);
puglSetSizeHint(view, PUGL_MIN_SIZE, 128, 64);
puglSetSizeHint(view, PUGL_MAX_SIZE, 512, 256);
diff --git a/examples/pugl_embed_demo.c b/examples/pugl_embed_demo.c
index 7efba81..a66e032 100644
--- a/examples/pugl_embed_demo.c
+++ b/examples/pugl_embed_demo.c
@@ -259,7 +259,7 @@ main(int argc, char** argv)
app.parent = puglNewView(app.world);
app.child = puglNewView(app.world);
- puglSetClassName(app.world, "PuglEmbedDemo");
+ puglSetWorldString(app.world, PUGL_CLASS_NAME, "PuglEmbedDemo");
const PuglRect parentFrame = {0, 0, 512, 512};
puglSetSizeHint(app.parent, PUGL_DEFAULT_SIZE, 512, 512);
@@ -282,7 +282,7 @@ main(int argc, char** argv)
const uint8_t title[] = {
'P', 'u', 'g', 'l', ' ', 'P', 'r', 0xC3, 0xBC, 'f', 'u', 'n', 'g', 0};
- puglSetWindowTitle(app.parent, (const char*)title);
+ puglSetViewString(app.parent, PUGL_WINDOW_TITLE, (const char*)title);
if ((st = puglRealize(app.parent))) {
return logError("Failed to create parent window (%s)\n", puglStrerror(st));
diff --git a/examples/pugl_management_demo.c b/examples/pugl_management_demo.c
index ec2805b..30a026e 100644
--- a/examples/pugl_management_demo.c
+++ b/examples/pugl_management_demo.c
@@ -118,7 +118,7 @@ toggleDialog(DemoApp* const app)
puglSetViewHint(app->dialogView.view, PUGL_RESIZABLE, true);
puglSetViewHint(
app->dialogView.view, PUGL_VIEW_TYPE, PUGL_VIEW_TYPE_DIALOG);
- puglSetWindowTitle(app->dialogView.view, "Dialog");
+ puglSetViewString(app->dialogView.view, PUGL_WINDOW_TITLE, "Dialog");
}
return puglShow(app->dialogView.view, PUGL_SHOW_RAISE);
@@ -228,7 +228,7 @@ main(int argc, char** argv)
app.world = puglNewWorld(PUGL_PROGRAM, 0);
puglSetWorldHandle(app.world, &app);
- puglSetClassName(app.world, "PuglDemoApp");
+ puglSetWorldString(app.world, PUGL_CLASS_NAME, "PuglDemoApp");
app.mainView.view = puglNewView(app.world);
app.mainView.label = "Main: ";
@@ -243,7 +243,7 @@ main(int argc, char** argv)
puglSetViewHint(app.mainView.view, PUGL_IGNORE_KEY_REPEAT, true);
puglSetViewHint(app.mainView.view, PUGL_RESIZABLE, true);
puglSetViewHint(app.mainView.view, PUGL_VIEW_TYPE, PUGL_VIEW_TYPE_NORMAL);
- puglSetWindowTitle(app.mainView.view, "Main Window");
+ puglSetViewString(app.mainView.view, PUGL_WINDOW_TITLE, "Main Window");
PuglStatus st = PUGL_SUCCESS;
if ((st = puglRealize(app.mainView.view))) {
diff --git a/examples/pugl_print_events.c b/examples/pugl_print_events.c
index c2b1512..96a8889 100644
--- a/examples/pugl_print_events.c
+++ b/examples/pugl_print_events.c
@@ -41,8 +41,8 @@ main(void)
app.world = puglNewWorld(PUGL_PROGRAM, 0);
app.view = puglNewView(app.world);
- puglSetClassName(app.world, "PuglPrintEvents");
- puglSetWindowTitle(app.view, "Pugl Event Printer");
+ puglSetWorldString(app.world, PUGL_CLASS_NAME, "PuglPrintEvents");
+ puglSetViewString(app.view, PUGL_WINDOW_TITLE, "Pugl Event Printer");
puglSetSizeHint(app.view, PUGL_DEFAULT_SIZE, 512, 512);
puglSetBackend(app.view, puglStubBackend());
puglSetHandle(app.view, &app);
diff --git a/examples/pugl_shader_demo.c b/examples/pugl_shader_demo.c
index 6c2fcd6..5773a9d 100644
--- a/examples/pugl_shader_demo.c
+++ b/examples/pugl_shader_demo.c
@@ -245,8 +245,8 @@ setupPugl(PuglTestApp* app)
app->rects = makeRects(app->numRects);
// Set up world and view
- puglSetClassName(app->world, "PuglShaderDemo");
- puglSetWindowTitle(app->view, "Pugl OpenGL Shader Demo");
+ puglSetWorldString(app->world, PUGL_CLASS_NAME, "PuglShaderDemo");
+ puglSetViewString(app->view, PUGL_WINDOW_TITLE, "Pugl OpenGL Shader Demo");
puglSetSizeHint(app->view, PUGL_DEFAULT_SIZE, defaultSpan, defaultSpan);
puglSetSizeHint(app->view, PUGL_MIN_SIZE, 128, 128);
puglSetSizeHint(app->view, PUGL_MAX_SIZE, 2048, 2048);
diff --git a/examples/pugl_vulkan_cpp_demo.cpp b/examples/pugl_vulkan_cpp_demo.cpp
index 1537920..7e652a5 100644
--- a/examples/pugl_vulkan_cpp_demo.cpp
+++ b/examples/pugl_vulkan_cpp_demo.cpp
@@ -1713,8 +1713,8 @@ run(const char* const programPath,
const auto height = static_cast<PuglSpan>(app.extent.height);
// Realize window so we can set up Vulkan
- app.world.setClassName("PuglVulkanCppDemo");
- app.view.setWindowTitle("Pugl Vulkan C++ Demo");
+ app.world.setString(pugl::StringHint::className, "PuglVulkanCppDemo");
+ app.view.setString(pugl::StringHint::windowTitle, "Pugl Vulkan C++ Demo");
app.view.setSizeHint(pugl::SizeHint::defaultSize, width, height);
app.view.setSizeHint(pugl::SizeHint::minSize, width / 4U, height / 4U);
app.view.setBackend(pugl::vulkanBackend());
diff --git a/examples/pugl_vulkan_demo.c b/examples/pugl_vulkan_demo.c
index c12c390..e1daeb0 100644
--- a/examples/pugl_vulkan_demo.c
+++ b/examples/pugl_vulkan_demo.c
@@ -1063,7 +1063,7 @@ main(int argc, char** argv)
}
// Create window
- puglSetWindowTitle(app.view, "Pugl Vulkan Demo");
+ puglSetViewString(app.view, PUGL_WINDOW_TITLE, "Pugl Vulkan Demo");
puglSetSizeHint(app.view, PUGL_DEFAULT_SIZE, defaultWidth, defaultHeight);
puglSetHandle(app.view, &app);
puglSetBackend(app.view, puglVulkanBackend());
diff --git a/examples/pugl_window_demo.c b/examples/pugl_window_demo.c
index d401c67..67086bb 100644
--- a/examples/pugl_window_demo.c
+++ b/examples/pugl_window_demo.c
@@ -176,7 +176,7 @@ main(int argc, char** argv)
app.cubes[1].view = puglNewView(app.world);
puglSetWorldHandle(app.world, &app);
- puglSetClassName(app.world, "PuglWindowDemo");
+ puglSetWorldString(app.world, PUGL_CLASS_NAME, "PuglWindowDemo");
PuglStatus st = PUGL_SUCCESS;
for (unsigned i = 0; i < 2; ++i) {
@@ -185,7 +185,7 @@ main(int argc, char** argv)
cube->dist = 10;
- puglSetWindowTitle(view, "Pugl Window Demo");
+ puglSetViewString(view, PUGL_WINDOW_TITLE, "Pugl Window Demo");
puglSetPosition(view,
(PuglCoord)(pad + (128U + pad) * i),
(PuglCoord)(pad + (128U + pad) * i));