diff options
feat: Implement freeform LED video wall
1 files changed, 58 insertions, 0 deletions
| -rw-r--r-- | src/LEDVideoWall.cpp | 58 |
diff --git a/src/LEDVideoWall.cpp b/src/LEDVideoWall.cpp new file mode 100644 index 0000000..b86afb0 --- /dev/null +++ b/src/LEDVideoWall.cpp @@ -0,0 +1,58 @@ +#include "LEDVideoWall.h" +#include "cli.hpp" +#include <stdio.h> + +LEDVideoWall::~LEDVideoWall() { } + +LEDVideoWall* LEDVideoWall::Freeform(mm panel_width, mm panel_height, mm wall_max_width, mm wall_max_height) { + return new LEDVideoWall( + (wall_max_width / panel_width) * panel_width, + (wall_max_height / panel_height) * panel_height); +} + +LEDVideoWall::LEDVideoWall(mm width, mm height) : Screen(width, height) { } + +enum class LEDVideoWallType { + Freeform = 0 +}; + +LEDVideoWall* LEDVideoWall::fromCommandLine() { + mm ipanel_width = 0; + cli::readUserInput( + ipanel_width, + "Enter width for a single panel (in mm): ", + "Invalid panel width, try again!"); + + mm ipanel_height = 0; + cli::readUserInput( + ipanel_height, + "Enter height for a single panel (in mm): ", + "Invalid panel height, try again!"); + + unsigned int itype = 1; + cli::readUserInputMax( + itype, + (unsigned int)1, + "Select an LED video wall type [0 for Freeform]: ", + "Invalid type, try again!"); + + LEDVideoWallType type = static_cast<LEDVideoWallType>(itype); + switch (type) { + case LEDVideoWallType::Freeform: { + mm iwall_max_width = 0; + cli::readUserInput( + iwall_max_width, + "Enter width for a single wall_max (in mm): ", + "Invalid wall_max width, try again!"); + + mm iwall_max_height = 0; + cli::readUserInput( + iwall_max_height, + "Enter height for a single wall_max (in mm): ", + "Invalid wall_max height, try again!"); + + return LEDVideoWall::Freeform(ipanel_width, ipanel_height, iwall_max_width, iwall_max_height); + }; + } + throw std::logic_error("Implementation error: didn't handle all types of LED video walls!"); +} |