--- a/CLIParser.h Wed Nov 29 01:27:05 2023 +0100
+++ b/CLIParser.h Fri Dec 01 20:25:49 2023 +0100
@@ -26,6 +26,7 @@
private:
static const std::string OPTION_TEXTURE;
+ static const std::string OPTION_SHADER;
static const std::string OPTION_BACKGROUND_COLOR;
static const std::string OPTION_ROOT_WINDOW;
@@ -70,6 +71,12 @@
Configuration::Texture tex;
tex.fileName = readNext(arguments, i);
c.textures.push_back(tex);
+ } else if (option == OPTION_SHADER) {
+ const auto type = readNext(arguments, i);
+ const auto file = readNext(arguments, i);
+ if (type == "fragment") c.fragmentShaders.push_back({file});
+ else if (type == "vertex") c.vertexShaders .push_back({file});
+ else throw std::invalid_argument("unsupported shader type");
} else if (option == OPTION_BACKGROUND_COLOR) {
c.backgroundColor = parseHexColor(readNext(arguments, i));
} else if (option == OPTION_ROOT_WINDOW) {
@@ -82,5 +89,6 @@
};
const std::string CLIParser::OPTION_TEXTURE = "--texture";
+const std::string CLIParser::OPTION_SHADER = "--shader";
const std::string CLIParser::OPTION_BACKGROUND_COLOR = "--background-color";
const std::string CLIParser::OPTION_ROOT_WINDOW = "--root-window";