1. Go to this page and download the library: Download hanhan1978/ffi-sdl3 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/ */
hanhan1978 / ffi-sdl3 example snippets
use SDL3\BlendMode;
use SDL3\Color;
use SDL3\SDL;
use SDL3\TTF\Font;
use SDL3\TTF\TTF;
use SDL3\Window;
use SDL3\WindowFlag;
$sdl = SDL::init();
$ttf = TTF::init($sdl);
$font = new Font($ttf, '/System/Library/Fonts/Helvetica.ttc', 32.0);
$window = new Window($sdl, 'Overlay', 640, 80, [
WindowFlag::Borderless,
WindowFlag::AlwaysOnTop,
WindowFlag::Transparent,
]);
$renderer = $window->createRenderer();
$renderer->setDrawBlendMode(BlendMode::Blend);
$surface = $font->renderTextBlended('Hello', new Color(255, 230, 80));
$texture = $renderer->createTextureFromSurface($surface);
$surface->destroy();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.