PHP code example of venusian-surface / embedded-displays

1. Go to this page and download the library: Download venusian-surface/embedded-displays library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

venusian-surface / embedded-displays example snippets


$display = app('displays')->panel('st7789');    // conjured from config/circuits/st7789.php
$engine = app('drawing')->renderer('velvet', ['framebuffer' => $display->framebuffer()]);
$face = app('fonts')->face();

while (true) {
    $engine->frame(function ($g) use ($face) {
        $g->clear(Color::rgb(0, 0, 32));
        $g->strokeRect(1, 1, 238, 238, Color::rgb(255, 255, 255));
        $g->scale(4)->text(date('H:i:s'), 6, 26, Color::rgb(255, 255, 0), $face);
    });
    $display->present();                        // the first frame whole, then only the time
    sleep(1);
}

$tft = app('displays')->panel('st7796', direct: true);
$engine = app('drawing')->renderer('velvet', ['output' => $tft]);

$tft = app('displays')->panel('st7796', direct: true);
$engine = app('drawing')->renderer('vulkan', ['output' => $tft]);
$engine->frame(fn ($g) => $g->clear(Color::rgb(0, 0, 0))->fillEllipse(160, 240, 80, 80, Color::rgb(255, 128, 0)));
$tft->present();