Add highlighted button rendering to machine_1 layout

- Introduce `drawHighlightedButtons` method for drawing button grids based on configurable rows, columns, and spacing.
- Add new constants for button size, spacing, and grid dimensions.
- Update asset usage to include `machine_1_button_highlighted_transparent`.
This commit is contained in:
Jeppe Bundgaard
2026-01-28 14:57:44 +01:00
parent a2dc4da2bf
commit d03151c426
2 changed files with 29 additions and 0 deletions
@@ -15,6 +15,11 @@ class machine_1 extends dynamicimages_image
const IMAGE_BUTTON_HIGHLIGHTED = 'machine_1_button_highlighted_transparent.png';
public int $thumb_position = 9; // 0-11 (default: 0 = up = 270 degrees)
public int $thumb_size = 1550; // height and width of the thumb
public int $button_highlight_size = 295; // size of the highlighted button
public int $button_rows = 4; // Number of rows (on top of each other)
public int $button_rows_spacing = 100; // Spacing between rows of buttons
public int $button_columns = 3; // Number of columns (side by side)
public int $button_columns_spacing = 442; // Spacing between columns of buttons
/**
* @throws \Exception
@@ -41,9 +46,33 @@ class machine_1 extends dynamicimages_image
$this->drawAsset($this->getAsset(self::IMAGE_PANEL_BACKGROUND), 0, 0);
$this->drawProgramWheel();
$this->drawThumb();
$this->drawHighlightedButtons();
//$this->drawAsset($this->getAsset(self::IMAGE_POWER_BUTTON), 0, 0);
}
/**
* @throws \Exception
*/
public function drawHighlightedButtons(): void
{
$startX = 2815; // Starting X position for the first button
$startY = 1265; // Starting Y position for the first button
for ($row = 0; $row < $this->button_rows; $row++) {
for ($col = 0; $col < $this->button_columns; $col++) {
$x = $startX + ($col * ($this->button_highlight_size + $this->button_columns_spacing));
$y = $startY + ($row * ($this->button_highlight_size + $this->button_rows_spacing));
$tmp = new dynamicimages_asset($this->getAssetPath(self::IMAGE_BUTTON_HIGHLIGHTED));
$tmp->resize($this->button_highlight_size, $this->button_highlight_size);
$this->drawAsset($tmp, $x, $y);
// Free memory used by temporary asset image, if any
if (method_exists($tmp, 'clearMemoryImage')) {
$tmp->clearMemoryImage();
}
}
}
}
/**
* @throws \Exception
*/