Add command line arguments to headless samples

Those samples can now toggle between glsl and hlsl shaders
Moved command line parster to a separate header
This commit is contained in:
Sascha Willems 2022-12-31 09:45:01 +01:00
parent 484d16d394
commit e52a9342f4
5 changed files with 172 additions and 137 deletions

View file

@ -59,6 +59,7 @@
#include "vulkan/vulkan.h"
#include "CommandLineParser.hpp"
#include "keycodes.hpp"
#include "VulkanTools.h"
#include "VulkanDebug.h"
@ -72,26 +73,6 @@
#include "camera.hpp"
#include "benchmark.hpp"
class CommandLineParser
{
public:
struct CommandLineOption {
std::vector<std::string> commands;
std::string value;
bool hasValue = false;
std::string help;
bool set = false;
};
std::unordered_map<std::string, CommandLineOption> options;
CommandLineParser();
void add(std::string name, std::vector<std::string> commands, bool hasValue, std::string help);
void printHelp();
void parse(std::vector<const char*> arguments);
bool isSet(std::string name);
std::string getValueAsString(std::string name, std::string defaultValue);
int32_t getValueAsInt(std::string name, int32_t defaultValue);
};
class VulkanExampleBase
{
private: