summaryrefslogtreecommitdiffstats
path: root/examples/example-base/example-base.h
diff options
context:
space:
mode:
authorJay Kwak <82421531+jkwak-work@users.noreply.github.com>2025-07-21 19:15:07 -0700
committerGitHub <noreply@github.com>2025-07-21 19:15:07 -0700
commit13dd01489efd89268d15751c5299e5783015bbcd (patch)
tree13208541f8838a16e69d38645f7eebfc76326394 /examples/example-base/example-base.h
parenta77d22bf3bfc3098b01e4886c3a63fb751edc704 (diff)
Add command-line arguments to examples (#7835)
* Add command-line arguments to triangle example - Add -h/--help flag to show usage information - Add -api flag to select rendering API (d3d11 < /dev/null | d3d12|vulkan|metal|cpu|cuda|webgpu) - Platform-specific API availability (D3D on Windows, Metal on macOS) - Output works for both console and WIN32 applications
Diffstat (limited to 'examples/example-base/example-base.h')
-rw-r--r--examples/example-base/example-base.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/examples/example-base/example-base.h b/examples/example-base/example-base.h
index 06970aaba..fbb54748a 100644
--- a/examples/example-base/example-base.h
+++ b/examples/example-base/example-base.h
@@ -136,6 +136,13 @@ int innerMain(int argc, char** argv)
TApp app;
app.parseOption(argc, argv);
+
+ if (app.shouldShowHelp())
+ {
+ app.printUsage(argc > 0 ? argv[0] : "example");
+ return 0;
+ }
+
if (SLANG_FAILED(app.initialize()))
{
return -1;