基于 SDL3(3.2.8)的桌面显示、输入和文件系统。
仓库:github.com/dekiengine/deki-sdl3-integration · 最新版本:0.40.0 · 需要引擎 0.40.0 或更高版本 · 依赖:deki-input
使用 DekiEditor --packages-add deki-sdl3-integration <project> 或通过包管理器安装。引擎自身的组件和 C++ API 见 Deki 文档。
在编辑器中显示为 **SDL3 Integration**。
组件
功能开关
可以从构建中去掉的部分。带有 define 的功能通过该 define 开关,其余的随其组件一起被剥离。
| 功能 | define | 默认值 |
| Display | — | 开 |
| Input | — | 开 |
组件参考
SDL3DisplaySetup
打开游戏渲染所用的桌面窗口。
检视器中的名称:SDL3 显示屏设置 · 类别:SDL3 · 类型:DekiSdl3::SDL3DisplaySetup
| 属性 | 类型 | 默认值 | 约束 | 说明 |
| windowScale | int32 | 2 | 1 到 8 | 用多少个窗口像素显示一个屏幕像素。屏幕大小取自目标平台。 |
| presentThroughOpenGL | bool | true | | 平台有 OpenGL 时,通过 OpenGL 显示帧。帧随后在 GPU 上构建,3D 直接画进去而不读回。无论平台的屏幕格式如何,帧缓冲区都会变为 RGB565A8,以便分层合成 2D。关闭或没有 OpenGL 时,由 SDL 的 GPU API 按原样显示帧缓冲区。 |
| draw2DOnGpu | bool | true | | 通过 OpenGL 呈现时,也在 GPU 上绘制 2D:精灵、文本和形状直接进入帧,CPU 不绘制任何像素。关闭时,像在设备上一样由 CPU 绘制 2D 并上传帧缓冲区。开启时帧缓冲区只包含代码直接写入的内容,所以它的截图不含 2D。 |
SDL3InputSetup
将桌面的键盘、鼠标和手柄输入传给引擎。
检视器中的名称:SDL3 输入设置 · 类别:SDL3 · 类型:DekiSdl3::SDL3InputSetup
| 属性 | 类型 | 默认值 | 说明 |
| enableKeyboard | bool | true | 启用键盘输入 |
| enableMouse | bool | true | 启用鼠标/指针输入 |
| enableGamepad | bool | true | 把手柄读作按键,与掌机按钮发送的按键相同:D-pad 和左摇杆为方向键,A 和 Start 为 Enter,B 为 Esc,X 为 Space,Y 为 Tab,Back 为 Backspace,LB 和 RB 为 Q 和 E,LT 和 RT 为 Z 和 C。其事件来自输入源 "Gamepad"。 |
更新日志
更新日志为英文。
0.40.0
Changed
- minEngine 0.40.0: built against engine 0.40.0. A build of this package from before does not load and is rebuilt.
Added
- A gamepad's sticks are also read as sticks (DekiInput::GetStick): the one pushed furthest on any connected pad.
- Gamepads. SDL3InputSetup reads every connected pad as keys, the same keys a handheld's buttons send: the D-pad and left stick are the arrows, A and Start Enter, B Esc, X Space, Y Tab, Back Backspace, LB and RB Q and E, LT and RT Z and C. Its events come from the source "Gamepad". Enable Gamepad turns it off.
0.30.0
Changed
- minEngine 0.30.0: built against engine 0.30.0. A build of this package from before does not load and is rebuilt.
Declares the capabilities it uses
- package.json has "capabilityDefines": ["opengl"]: its GL presenter tests DEKI_CAPABILITY_OPENGL. The editor reads them instead of knowing opengl itself; needs the editor from this release.
Added
- SDL3GLDisplay: where the platform provides opengl, the window presents through OpenGL and deki-rendering's GLPresenter, so the frame is built on the GPU and deki-3d's meshes draw straight into it. SDL3DisplaySetup's presentThroughOpenGL (on by default) chooses it; SDL's GPU API remains the fallback.
- SDL3DisplaySetup.draw2DOnGpu (on by default): presenting through OpenGL, the 2D is drawn on the GPU too, by the presenter, and the CPU draws no pixels. The frame buffer then holds only what code writes into it directly, so a screenshot of it misses the 2D; turn it off for that, or to see the 565 rounding a device's screen shows.
更早的版本:CHANGELOG.md
由包的反射数据生成(引擎 0.40.1)。属性名就是场景文件中使用的键。重命名后会保留别名(兼容性)。