Add network

This commit is contained in:
2026-01-09 21:58:48 +00:00
parent f8e1948059
commit 5b5be7c3c8
24 changed files with 482 additions and 114 deletions
+12 -8
View File
@@ -2,9 +2,13 @@
namespace display::graphics
{
Renderer::Renderer(Framebuffer &framebuffer, model::HostRegistry &registry)
Renderer::Renderer(Framebuffer &framebuffer, model::HostRegistry &registry, 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,