hanhan1978/ffi-sdl3 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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_PATH
  • SDL3_TTF_LIBRARY_PATH
  • pkg-config
  • Common Homebrew paths

Public API

  • SDL3\SDL
  • SDL3\Window
  • SDL3\Renderer
  • SDL3\Texture
  • SDL3\Surface
  • SDL3\Rect
  • SDL3\Color
  • SDL3\WindowFlag
  • SDL3\BlendMode
  • SDL3\Event\*
  • SDL3\TTF\TTF
  • SDL3\TTF\Font

License

Apache-2.0

统计信息

  • 总下载量: 4
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2026-04-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固