hanhan1978/ffi-sdl3
最新稳定版本:v0.1.3
Composer 安装命令:
composer require hanhan1978/ffi-sdl3
包简介
PHP FFI bindings for SDL3 and SDL3_ttf
README 文档
README
Small PHP FFI bindings for SDL3 and SDL3_ttf.
This package was split out from the overlay demo so it can be reused as an independent Composer library.
Requirements
- PHP 8.4 or later
ext-ffi- SDL3
- SDL3_ttf
- Apache-2.0 license
Installation
composer require hanhan1978/ffi-sdl3:^0.1
Local development
If you are developing against a local checkout, add a path repository to the
parent project's composer.json and run composer install.
{
"repositories": [
{
"type": "path",
"url": "../ffi-sdl3"
}
]
}
Usage
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();
Library lookup
LibraryFinder searches for SDL3 and SDL3_ttf in this order:
SDL3_LIBRARY_PATHSDL3_TTF_LIBRARY_PATHpkg-config- Common Homebrew paths
Public API
SDL3\SDLSDL3\WindowSDL3\RendererSDL3\TextureSDL3\SurfaceSDL3\RectSDL3\ColorSDL3\WindowFlagSDL3\BlendModeSDL3\Event\*SDL3\TTF\TTFSDL3\TTF\Font
License
Apache-2.0
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2026-04-16