Skip to content

Commit

Permalink
Demo mode: bezel size
Browse files Browse the repository at this point in the history
  • Loading branch information
eile committed Nov 14, 2019
1 parent 62f9dae commit 2f8a62f
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions eq/server/config/resources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@

#include <cmath>
#include <cstdio>
#include <cstdlib>

#define USE_IPv4

Expand Down Expand Up @@ -523,6 +524,13 @@ void Resources::configure(const Compounds& compounds, const Channels& channels,
}
}

static const float bezelSize = ([]() {
const auto env = getenv("EQ_SERVER_CONFIG_BEZELS");
if (!env)
return 0.f;
return float(std::atof(env)) / 100.f;
})();

void Resources::configureWall(Config* config, const Channels& channels)
{
const size_t nRows = std::ceil(std::sqrt(channels.size()));
Expand All @@ -546,8 +554,15 @@ void Resources::configureWall(Config* config, const Channels& channels)
return;

Segment* segment = new Segment(canvas);
segment->setViewport(
Viewport(c * width, (nRows - r - 1) * height, width, height));
const float leftBezel = c == 0 ? 0.f : bezelSize;
const float rightBezel = c == nCols - 1 ? 0.f : bezelSize;
const float bottomBezel = r == 0 ? 0.f : bezelSize;
const float topBezel = r == nRows - 1 ? 0.f : bezelSize;

segment->setViewport(Viewport(c * width + leftBezel,
(nRows - r - 1) * height + topBezel,
width - leftBezel - rightBezel,
height - topBezel - bottomBezel));
segment->setChannel(channels[i]);
}
}
Expand Down

0 comments on commit 2f8a62f

Please sign in to comment.