From 13dd01489efd89268d15751c5299e5783015bbcd Mon Sep 17 00:00:00 2001 From: Jay Kwak <82421531+jkwak-work@users.noreply.github.com> Date: Mon, 21 Jul 2025 19:15:07 -0700 Subject: 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 --- examples/example-base/example-base.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'examples/example-base/example-base.h') 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; -- cgit v1.2.3