Summary Files Commits Branches @commit @diff @stats
path: root / src / LEDVideoWall.cpp
diff options
context:
space:
mode:
1 files changed, 21 insertions, 4 deletions
-rw-r--r--src/LEDVideoWall.cpp25
diff --git a/src/LEDVideoWall.cpp b/src/LEDVideoWall.cpp
index b86afb0..ad3dc3c 100644
--- a/src/LEDVideoWall.cpp
+++ b/src/LEDVideoWall.cpp
@@ -10,10 +10,16 @@ LEDVideoWall* LEDVideoWall::Freeform(mm panel_width, mm panel_height, mm wall_ma
(wall_max_height / panel_height) * panel_height);
}
+LEDVideoWall* LEDVideoWall::Aspect(mm panel_width, mm panel_height, unsigned int aspect_width, unsigned int aspect_height) {
+ return new LEDVideoWall(
+ aspect_width * panel_width,
+ aspect_height * panel_height);
+}
+
LEDVideoWall::LEDVideoWall(mm width, mm height) : Screen(width, height) { }
enum class LEDVideoWallType {
- Freeform = 0
+ Freeform = 0, Aspect
};
LEDVideoWall* LEDVideoWall::fromCommandLine() {
@@ -29,11 +35,11 @@ LEDVideoWall* LEDVideoWall::fromCommandLine() {
"Enter height for a single panel (in mm): ",
"Invalid panel height, try again!");
- unsigned int itype = 1;
+ unsigned int itype = 2;
cli::readUserInputMax(
itype,
- (unsigned int)1,
- "Select an LED video wall type [0 for Freeform]: ",
+ (unsigned int)2,
+ "Select an LED video wall type [0 for Freeform, 1 for Aspect]: ",
"Invalid type, try again!");
LEDVideoWallType type = static_cast<LEDVideoWallType>(itype);
@@ -53,6 +59,17 @@ LEDVideoWall* LEDVideoWall::fromCommandLine() {
return LEDVideoWall::Freeform(ipanel_width, ipanel_height, iwall_max_width, iwall_max_height);
};
+
+ case LEDVideoWallType::Aspect: {
+ mm i_width = 0, i_height = 0;
+ printf("Enter aspect ratio (in the format 'width:height'): ");
+ while (scanf("%d:%d", &i_width, &i_height) != 2) {
+ printf("Invalid input, try again!\n");
+ printf("Enter aspect ratio (in the format 'width:height'): ");
+ }
+
+ return LEDVideoWall::Aspect(ipanel_width, ipanel_height, i_width, i_height);
+ };
}
throw std::logic_error("Implementation error: didn't handle all types of LED video walls!");
}