From d71c054e221013f5d5f24648ded514b475aed3df Mon Sep 17 00:00:00 2001 From: Syndamia Date: Wed, 23 Jul 2025 14:27:10 +0300 Subject: feat(LEDVideoWall): Store rows and columns of panels --- src/LEDVideoWall.cpp | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'src/LEDVideoWall.cpp') diff --git a/src/LEDVideoWall.cpp b/src/LEDVideoWall.cpp index 2d42fbf..45f66ba 100644 --- a/src/LEDVideoWall.cpp +++ b/src/LEDVideoWall.cpp @@ -1,22 +1,36 @@ #include "LEDVideoWall.h" #include "cli.hpp" -#include +#include LEDVideoWall::~LEDVideoWall() { } LEDVideoWall* LEDVideoWall::Freeform(mm panel_width, mm panel_height, mm wall_max_width, mm wall_max_height) { + unsigned int columns = wall_max_width / panel_width; + unsigned int rows = wall_max_height / panel_height; return new LEDVideoWall( - (wall_max_width / panel_width) * panel_width, - (wall_max_height / panel_height) * panel_height); + columns * panel_width, + rows * panel_height, + columns, + rows); } 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); + aspect_height * panel_height, + aspect_width, + aspect_height); } -LEDVideoWall::LEDVideoWall(mm width, mm height) : Screen(width, height) { } +LEDVideoWall::LEDVideoWall( + mm width, + mm height, + unsigned int columns_of_panels, + unsigned int rows_of_panels) : + Screen(width, height), + columns_of_panels(columns_of_panels), + rows_of_panels(rows_of_panels) +{ } enum class LEDVideoWallType { Freeform = 0, Aspect @@ -68,5 +82,7 @@ LEDVideoWall* LEDVideoWall::fromCommandLine() { } std::string LEDVideoWall::extraOutput() const { - return std::string(); + std::ostringstream output; + output << " (" << this->columns_of_panels << " columns by " << this->rows_of_panels << " rows of tiles)"; + return output.str(); } -- cgit v1.3.1-23-gd82d