aboutsummaryrefslogtreecommitdiff
path: root/subprojects/d2tk/pugl/examples
diff options
context:
space:
mode:
Diffstat (limited to 'subprojects/d2tk/pugl/examples')
-rw-r--r--subprojects/d2tk/pugl/examples/meson.build80
-rw-r--r--subprojects/d2tk/pugl/examples/pugl_cairo_demo.c1
-rw-r--r--subprojects/d2tk/pugl/examples/pugl_cursor_demo.c1
-rw-r--r--subprojects/d2tk/pugl/examples/pugl_cxx_demo.cpp1
-rw-r--r--subprojects/d2tk/pugl/examples/pugl_shader_demo.c1
-rw-r--r--subprojects/d2tk/pugl/examples/pugl_vulkan_cxx_demo.cpp1
-rw-r--r--subprojects/d2tk/pugl/examples/pugl_window_demo.c1
-rw-r--r--subprojects/d2tk/pugl/examples/shaders/meson.build35
8 files changed, 121 insertions, 0 deletions
diff --git a/subprojects/d2tk/pugl/examples/meson.build b/subprojects/d2tk/pugl/examples/meson.build
new file mode 100644
index 0000000..d455faf
--- /dev/null
+++ b/subprojects/d2tk/pugl/examples/meson.build
@@ -0,0 +1,80 @@
+data_dir = get_option('prefix') / get_option('datadir') / 'pugl-0'
+example_args = ['-DPUGL_DATA_DIR="@0@"'.format(data_dir)]
+
+gl_examples = [
+ 'pugl_cxx_demo.cpp',
+ 'pugl_embed_demo.c',
+ 'pugl_print_events.c',
+ 'pugl_shader_demo.c',
+ 'pugl_window_demo.c',
+]
+
+cairo_examples = [
+ 'pugl_cairo_demo.c'
+]
+
+vulkan_examples = [
+ 'pugl_vulkan_cxx_demo.cpp',
+ 'pugl_vulkan_demo.c',
+]
+
+includes = [
+ '.',
+ '..',
+ '../bindings/cxx/include',
+ '../include',
+]
+
+subdir('shaders')
+
+# Build GL examples
+if opengl_dep.found()
+ foreach example : gl_examples
+ source = [example]
+ target = example.split('.')[0]
+ dependencies = [gl_backend_dep]
+
+ if target == 'pugl_shader_demo'
+ source += ['file_utils.c', 'glad/glad.c']
+ dependencies += [dl_dep]
+ elif target == 'pugl_print_events'
+ dependencies += [stub_backend_dep]
+ endif
+
+ executable(target, source,
+ include_directories: include_directories(includes),
+ c_args: example_args,
+ cpp_args: example_args,
+ dependencies: dependencies)
+ endforeach
+endif
+
+# Build Cairo examples
+if cairo_dep.found()
+ foreach example : cairo_examples
+ target = example.split('.')[0]
+ executable(target, example,
+ include_directories: include_directories(includes),
+ c_args: example_args,
+ dependencies: [pugl_dep, cairo_backend_dep])
+ endforeach
+endif
+
+# Build Vulkan examples
+if vulkan_dep.found()
+ foreach example : vulkan_examples
+ source = [example]
+ target = example.split('.')[0]
+ dependencies = [dl_dep, vulkan_backend_dep]
+
+ if target == 'pugl_vulkan_cxx_demo'
+ source += ['file_utils.c']
+ endif
+
+ executable(target, source,
+ include_directories: include_directories(includes),
+ c_args: example_args,
+ cpp_args: example_args,
+ dependencies: dependencies)
+ endforeach
+endif
diff --git a/subprojects/d2tk/pugl/examples/pugl_cairo_demo.c b/subprojects/d2tk/pugl/examples/pugl_cairo_demo.c
index 4da0caf..67bc13c 100644
--- a/subprojects/d2tk/pugl/examples/pugl_cairo_demo.c
+++ b/subprojects/d2tk/pugl/examples/pugl_cairo_demo.c
@@ -231,6 +231,7 @@ main(int argc, char** argv)
puglSetWindowTitle(view, "Pugl Cairo Demo");
puglSetDefaultSize(view, 512, 512);
puglSetMinSize(view, 256, 256);
+ puglSetMaxSize(view, 2048, 2048);
puglSetViewHint(view, PUGL_RESIZABLE, app.opts.resizable);
puglSetHandle(view, &app);
puglSetBackend(view, puglCairoBackend());
diff --git a/subprojects/d2tk/pugl/examples/pugl_cursor_demo.c b/subprojects/d2tk/pugl/examples/pugl_cursor_demo.c
index 60ec3d3..97e3b9f 100644
--- a/subprojects/d2tk/pugl/examples/pugl_cursor_demo.c
+++ b/subprojects/d2tk/pugl/examples/pugl_cursor_demo.c
@@ -139,6 +139,7 @@ main(int argc, char** argv)
puglSetWindowTitle(view, "Pugl Window Demo");
puglSetDefaultSize(view, 512, 256);
puglSetMinSize(view, 128, 64);
+ puglSetMaxSize(view, 512, 256);
puglSetBackend(view, puglGlBackend());
puglSetViewHint(view, PUGL_USE_DEBUG_CONTEXT, app.opts.errorChecking);
diff --git a/subprojects/d2tk/pugl/examples/pugl_cxx_demo.cpp b/subprojects/d2tk/pugl/examples/pugl_cxx_demo.cpp
index 4914724..d663a3f 100644
--- a/subprojects/d2tk/pugl/examples/pugl_cxx_demo.cpp
+++ b/subprojects/d2tk/pugl/examples/pugl_cxx_demo.cpp
@@ -125,6 +125,7 @@ main(int argc, char** argv)
view.setWindowTitle("Pugl C++ Test");
view.setDefaultSize(512, 512);
view.setMinSize(64, 64);
+ view.setMaxSize(256, 256);
view.setAspectRatio(1, 1, 16, 9);
view.setBackend(pugl::glBackend());
view.setHint(pugl::ViewHint::resizable, opts.resizable);
diff --git a/subprojects/d2tk/pugl/examples/pugl_shader_demo.c b/subprojects/d2tk/pugl/examples/pugl_shader_demo.c
index 087afc5..aa5c38e 100644
--- a/subprojects/d2tk/pugl/examples/pugl_shader_demo.c
+++ b/subprojects/d2tk/pugl/examples/pugl_shader_demo.c
@@ -275,6 +275,7 @@ setupPugl(PuglTestApp* app)
puglSetWindowTitle(app->view, "Pugl OpenGL 3");
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);
puglSetBackend(app->view, puglGlBackend());
puglSetViewHint(app->view, PUGL_USE_COMPAT_PROFILE, PUGL_FALSE);
diff --git a/subprojects/d2tk/pugl/examples/pugl_vulkan_cxx_demo.cpp b/subprojects/d2tk/pugl/examples/pugl_vulkan_cxx_demo.cpp
index e816091..d92e652 100644
--- a/subprojects/d2tk/pugl/examples/pugl_vulkan_cxx_demo.cpp
+++ b/subprojects/d2tk/pugl/examples/pugl_vulkan_cxx_demo.cpp
@@ -1722,6 +1722,7 @@ run(const char* const programPath,
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.setBackend(pugl::vulkanBackend());
app.view.setHint(pugl::ViewHint::resizable, opts.resizable);
const pugl::Status st = app.view.realize();
diff --git a/subprojects/d2tk/pugl/examples/pugl_window_demo.c b/subprojects/d2tk/pugl/examples/pugl_window_demo.c
index be320dd..f7d5b2c 100644
--- a/subprojects/d2tk/pugl/examples/pugl_window_demo.c
+++ b/subprojects/d2tk/pugl/examples/pugl_window_demo.c
@@ -209,6 +209,7 @@ main(int argc, char** argv)
puglSetFrame(view, frame);
puglSetDefaultSize(view, 512, 512);
puglSetMinSize(view, 128, 128);
+ puglSetMaxSize(view, 2048, 2048);
puglSetBackend(view, puglGlBackend());
puglSetViewHint(view, PUGL_USE_DEBUG_CONTEXT, opts.errorChecking);
diff --git a/subprojects/d2tk/pugl/examples/shaders/meson.build b/subprojects/d2tk/pugl/examples/shaders/meson.build
new file mode 100644
index 0000000..e47be9d
--- /dev/null
+++ b/subprojects/d2tk/pugl/examples/shaders/meson.build
@@ -0,0 +1,35 @@
+shader_files = [
+ 'header_330.glsl',
+ 'header_420.glsl',
+ 'rect.frag',
+ 'rect.vert',
+]
+
+# Copy shader sources for GL examples
+foreach shader_file : shader_files
+ configure_file(copy: true, input: shader_file, output: shader_file)
+endforeach
+
+# Build SPV shader binaries for Vulkan examples
+if vulkan_dep.found()
+ cat = find_program('../../scripts/cat.py')
+ glslang = find_program('glslangValidator')
+
+ shaders = ['rect.vert', 'rect.frag']
+ foreach shader : shaders
+ source = shader.split('.')[0] + '.vulkan.' + shader.split('.')[1]
+ shader_input = custom_target(source,
+ output: source,
+ input: ['header_420.glsl', shader],
+ command: [cat, '@INPUT@'],
+ build_by_default: true,
+ capture: true)
+
+ mytarget = custom_target(shader,
+ output: shader + '.spv',
+ input: shader_input,
+ command: [glslang, '-V', '-o', '@OUTPUT@', '@INPUT@'],
+ build_by_default: true,
+ install: false)
+ endforeach
+endif