From 6244d8aa64d4d8ecf440b8cf6c0bcdd1ab2cd1d6 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Wed, 23 Jul 2025 13:54:55 +0300 Subject: feat: Implement aspect LED video wall --- src/LEDVideoWall.cpp | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'src/LEDVideoWall.cpp') 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(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!"); } -- cgit v1.3.1-23-gd82d