From da2ad781fd156e274ad47e38b919b7c19ae8d049 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Wed, 23 Jul 2025 14:02:57 +0300 Subject: feat: Move aspect ratio input parsing into cli --- src/cli.hpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/cli.hpp') diff --git a/src/cli.hpp b/src/cli.hpp index 21f2ae5..b7d4c30 100644 --- a/src/cli.hpp +++ b/src/cli.hpp @@ -3,6 +3,7 @@ #include #include +#include namespace cli { template @@ -29,6 +30,18 @@ namespace cli { readUserInput(outValue, enter_message, error_message); } } + + template + void scanTwoValues(const char* format, T& outFirst, U& outSecond, const char* enter_message, const char* error_message) { + std::cout << enter_message; + while (scanf(format, &outFirst, &outSecond) != 2) { + std::cerr << error_message << std::endl; + std::cout << enter_message; + + std::cin.clear(); + std::cin.ignore(std::numeric_limits::max(), '\n'); + } + } } #endif /* GS_CLI */ -- cgit v1.3.1-23-gd82d