Add network
This commit is contained in:
@@ -2,9 +2,13 @@
|
||||
|
||||
namespace display::graphics
|
||||
{
|
||||
Renderer::Renderer(Framebuffer &framebuffer, model::HostRegistry ®istry)
|
||||
Renderer::Renderer(Framebuffer &framebuffer, model::HostRegistry ®istry, config::server::StyleConfig &config)
|
||||
: framebuffer(framebuffer),
|
||||
registry(registry)
|
||||
registry(registry),
|
||||
config(config),
|
||||
textRenderer(std::make_unique<display::ui::text::Renderer>()),
|
||||
header(std::make_unique<display::ui::header::Header>(config)),
|
||||
hostblock(std::make_unique<display::ui::hostblock::HostBlock>(config))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -12,10 +16,10 @@ namespace display::graphics
|
||||
{
|
||||
framebuffer.clear(Color{0, 0, 0});
|
||||
|
||||
header.draw(framebuffer, textRenderer, START_X, START_Y);
|
||||
header->draw(framebuffer, *textRenderer, START_X, START_Y);
|
||||
|
||||
int blocksPerRow =
|
||||
(SCREEN_WIDTH + BLOCK_GAP) / (display::ui::hostblock::BLOCK_WIDTH + BLOCK_GAP);
|
||||
(SCREEN_WIDTH + config.gap) / (config.hostblock.width + config.gap);
|
||||
if (blocksPerRow < 1)
|
||||
blocksPerRow = 1;
|
||||
|
||||
@@ -26,12 +30,12 @@ namespace display::graphics
|
||||
int col = index % blocksPerRow;
|
||||
int row = index / blocksPerRow;
|
||||
|
||||
int x = START_X + col * (display::ui::hostblock::BLOCK_WIDTH + BLOCK_GAP);
|
||||
int y = START_Y + header.height() + BLOCK_GAP + row * (display::ui::hostblock::BLOCK_HEIGHT + BLOCK_GAP);
|
||||
int x = START_X + col * (config.hostblock.width + config.gap);
|
||||
int y = START_Y + config.header.height + config.gap + row * (config.hostblock.height + config.gap);
|
||||
|
||||
hostblock.draw(
|
||||
hostblock->draw(
|
||||
framebuffer,
|
||||
textRenderer,
|
||||
*textRenderer,
|
||||
x,
|
||||
y,
|
||||
host,
|
||||
|
||||
Reference in New Issue
Block a user