@bornengine/engine 0.4.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +231 -0
- package/native/android/Cargo.lock +1848 -0
- package/native/android/Cargo.toml +24 -0
- package/native/android/src/lib.rs +702 -0
- package/native/ios/Cargo.lock +1690 -0
- package/native/ios/Cargo.toml +32 -0
- package/native/ios/src/lib.rs +1267 -0
- package/native/linux/Cargo.lock +3279 -0
- package/native/linux/Cargo.toml +29 -0
- package/native/linux/src/lib.rs +1331 -0
- package/native/macos/Cargo.lock +3310 -0
- package/native/macos/Cargo.toml +46 -0
- package/native/macos/src/lib.rs +1302 -0
- package/native/shared/Cargo.lock +1899 -0
- package/native/shared/Cargo.toml +62 -0
- package/native/shared/assets/default_font.ttf +0 -0
- package/native/shared/build.rs +270 -0
- package/native/shared/shaders/common/clouds.wgsl +122 -0
- package/native/shared/shaders/common/fog.wgsl +16 -0
- package/native/shared/shaders/common/foliage_wind.wgsl +98 -0
- package/native/shared/shaders/common/imposter.wgsl +112 -0
- package/native/shared/shaders/common/pbr.wgsl +186 -0
- package/native/shared/shaders/common/shadows.wgsl +186 -0
- package/native/shared/shaders/common/sky.wgsl +8 -0
- package/native/shared/shaders/common/tonemap.wgsl +25 -0
- package/native/shared/shaders/impulse_field.wgsl +57 -0
- package/native/shared/shaders/material_abi.wgsl +383 -0
- package/native/shared/shaders/materials/test_minimal.wgsl +42 -0
- package/native/shared/src/anim_mixer.rs +61 -0
- package/native/shared/src/attach.rs +263 -0
- package/native/shared/src/audio/decode.rs +123 -0
- package/native/shared/src/audio/mod.rs +863 -0
- package/native/shared/src/audio/render.rs +892 -0
- package/native/shared/src/audio/spsc.rs +156 -0
- package/native/shared/src/audio/stream.rs +226 -0
- package/native/shared/src/custom_shaders.rs +104 -0
- package/native/shared/src/decals.rs +245 -0
- package/native/shared/src/drs.rs +211 -0
- package/native/shared/src/engine.rs +261 -0
- package/native/shared/src/ffi.rs +116 -0
- package/native/shared/src/ffi_core/assets.rs +388 -0
- package/native/shared/src/ffi_core/audio_ffi.rs +184 -0
- package/native/shared/src/ffi_core/draw.rs +334 -0
- package/native/shared/src/ffi_core/game_loop.rs +577 -0
- package/native/shared/src/ffi_core/input.rs +234 -0
- package/native/shared/src/ffi_core/mod.rs +127 -0
- package/native/shared/src/ffi_core/models.rs +1154 -0
- package/native/shared/src/ffi_core/ragdoll_ffi.rs +261 -0
- package/native/shared/src/ffi_core/scene.rs +626 -0
- package/native/shared/src/ffi_core/vfx.rs +212 -0
- package/native/shared/src/ffi_core/visual.rs +691 -0
- package/native/shared/src/frame_callbacks.rs +122 -0
- package/native/shared/src/geometry.rs +236 -0
- package/native/shared/src/handles.rs +182 -0
- package/native/shared/src/input.rs +448 -0
- package/native/shared/src/jolt_sys.rs +822 -0
- package/native/shared/src/lib.rs +55 -0
- package/native/shared/src/models.rs +1093 -0
- package/native/shared/src/models_gltf.rs +1280 -0
- package/native/shared/src/particles.rs +391 -0
- package/native/shared/src/physics_jolt.rs +1908 -0
- package/native/shared/src/picking.rs +298 -0
- package/native/shared/src/postfx.rs +345 -0
- package/native/shared/src/profiler.rs +492 -0
- package/native/shared/src/ragdoll.rs +474 -0
- package/native/shared/src/renderer/atmosphere_lut.rs +573 -0
- package/native/shared/src/renderer/brdf_lut.rs +154 -0
- package/native/shared/src/renderer/draw2d.rs +143 -0
- package/native/shared/src/renderer/formats.rs +822 -0
- package/native/shared/src/renderer/froxel.rs +421 -0
- package/native/shared/src/renderer/gi_bake.rs +653 -0
- package/native/shared/src/renderer/graph.rs +462 -0
- package/native/shared/src/renderer/hiz.rs +269 -0
- package/native/shared/src/renderer/hot_reload.rs +390 -0
- package/native/shared/src/renderer/impulse_field.rs +456 -0
- package/native/shared/src/renderer/lighting.rs +154 -0
- package/native/shared/src/renderer/material_instancing.rs +171 -0
- package/native/shared/src/renderer/material_pipeline.rs +700 -0
- package/native/shared/src/renderer/material_system.rs +1996 -0
- package/native/shared/src/renderer/material_system_tests.rs +601 -0
- package/native/shared/src/renderer/material_system_wasm.rs +41 -0
- package/native/shared/src/renderer/mod.rs +12556 -0
- package/native/shared/src/renderer/model_draw.rs +641 -0
- package/native/shared/src/renderer/occlusion.rs +429 -0
- package/native/shared/src/renderer/planar_pass.rs +593 -0
- package/native/shared/src/renderer/planar_reflection.rs +499 -0
- package/native/shared/src/renderer/post_pass.rs +249 -0
- package/native/shared/src/renderer/postfx_chain.rs +728 -0
- package/native/shared/src/renderer/pt_pass.rs +577 -0
- package/native/shared/src/renderer/scene_pass.rs +607 -0
- package/native/shared/src/renderer/shader_include.rs +205 -0
- package/native/shared/src/renderer/shader_library.rs +135 -0
- package/native/shared/src/renderer/shaders/ao.rs +570 -0
- package/native/shared/src/renderer/shaders/core.rs +1243 -0
- package/native/shared/src/renderer/shaders/env.rs +907 -0
- package/native/shared/src/renderer/shaders/gi.rs +810 -0
- package/native/shared/src/renderer/shaders/mod.rs +19 -0
- package/native/shared/src/renderer/shaders/post.rs +1558 -0
- package/native/shared/src/renderer/shaders/pt.rs +1859 -0
- package/native/shared/src/renderer/shaders/ssgi.rs +1586 -0
- package/native/shared/src/renderer/shadow_pass.rs +731 -0
- package/native/shared/src/renderer/ssgi_pass.rs +392 -0
- package/native/shared/src/renderer/ssr_pass.rs +188 -0
- package/native/shared/src/renderer/texture_store.rs +473 -0
- package/native/shared/src/renderer/transient.rs +591 -0
- package/native/shared/src/renderer/types.rs +941 -0
- package/native/shared/src/renderer/util.rs +152 -0
- package/native/shared/src/scene.rs +1362 -0
- package/native/shared/src/sdf_cache.rs +274 -0
- package/native/shared/src/shadows.rs +1036 -0
- package/native/shared/src/staging.rs +102 -0
- package/native/shared/src/string_header.rs +266 -0
- package/native/shared/src/text_renderer.rs +502 -0
- package/native/shared/src/textures.rs +197 -0
- package/native/tvos/Cargo.lock +1693 -0
- package/native/tvos/Cargo.toml +36 -0
- package/native/tvos/metal-patched/Cargo.toml +178 -0
- package/native/tvos/metal-patched/LICENSE-APACHE +201 -0
- package/native/tvos/metal-patched/LICENSE-MIT +25 -0
- package/native/tvos/metal-patched/src/acceleration_structure.rs +667 -0
- package/native/tvos/metal-patched/src/acceleration_structure_pass.rs +108 -0
- package/native/tvos/metal-patched/src/argument.rs +366 -0
- package/native/tvos/metal-patched/src/blitpass.rs +102 -0
- package/native/tvos/metal-patched/src/buffer.rs +71 -0
- package/native/tvos/metal-patched/src/capturedescriptor.rs +76 -0
- package/native/tvos/metal-patched/src/capturemanager.rs +113 -0
- package/native/tvos/metal-patched/src/commandbuffer.rs +192 -0
- package/native/tvos/metal-patched/src/commandqueue.rs +44 -0
- package/native/tvos/metal-patched/src/computepass.rs +107 -0
- package/native/tvos/metal-patched/src/constants.rs +152 -0
- package/native/tvos/metal-patched/src/counters.rs +119 -0
- package/native/tvos/metal-patched/src/depthstencil.rs +190 -0
- package/native/tvos/metal-patched/src/device.rs +2134 -0
- package/native/tvos/metal-patched/src/drawable.rs +39 -0
- package/native/tvos/metal-patched/src/encoder.rs +2041 -0
- package/native/tvos/metal-patched/src/heap.rs +281 -0
- package/native/tvos/metal-patched/src/indirect_encoder.rs +344 -0
- package/native/tvos/metal-patched/src/lib.rs +657 -0
- package/native/tvos/metal-patched/src/library.rs +902 -0
- package/native/tvos/metal-patched/src/mps.rs +575 -0
- package/native/tvos/metal-patched/src/pipeline/compute.rs +475 -0
- package/native/tvos/metal-patched/src/pipeline/mod.rs +71 -0
- package/native/tvos/metal-patched/src/pipeline/render.rs +762 -0
- package/native/tvos/metal-patched/src/renderpass.rs +443 -0
- package/native/tvos/metal-patched/src/resource.rs +182 -0
- package/native/tvos/metal-patched/src/sampler.rs +165 -0
- package/native/tvos/metal-patched/src/sync.rs +178 -0
- package/native/tvos/metal-patched/src/texture.rs +352 -0
- package/native/tvos/metal-patched/src/types.rs +90 -0
- package/native/tvos/metal-patched/src/vertexdescriptor.rs +250 -0
- package/native/tvos/src/audio_backend.rs +197 -0
- package/native/tvos/src/lib.rs +1891 -0
- package/native/visionos/Cargo.lock +1693 -0
- package/native/visionos/Cargo.toml +40 -0
- package/native/visionos/src/audio_backend.rs +197 -0
- package/native/visionos/src/lib.rs +1887 -0
- package/native/watchos/Cargo.lock +16 -0
- package/native/watchos/Cargo.toml +19 -0
- package/native/watchos/shaders/bloom_postfx.metal +99 -0
- package/native/watchos/src/BloomWatchApp.swift +1267 -0
- package/native/watchos/src/BloomWatchAudio.swift +179 -0
- package/native/watchos/src/audio.rs +55 -0
- package/native/watchos/src/draw_list.rs +229 -0
- package/native/watchos/src/ffi_stubs.rs +915 -0
- package/native/watchos/src/ffi_stubs_manual.rs +35 -0
- package/native/watchos/src/lib.rs +1124 -0
- package/native/watchos/src/models.rs +746 -0
- package/native/watchos/src/postfx.rs +95 -0
- package/native/watchos/src/scene.rs +534 -0
- package/native/watchos/src/textures.rs +184 -0
- package/native/web/Cargo.lock +1657 -0
- package/native/web/Cargo.toml +43 -0
- package/native/web/bloom_glue.js +695 -0
- package/native/web/build.sh +131 -0
- package/native/web/index.html +35 -0
- package/native/web/jolt_bridge.js +1519 -0
- package/native/web/src/input_ffi.rs +286 -0
- package/native/web/src/lib.rs +1796 -0
- package/native/web/src/material_ffi.rs +710 -0
- package/native/web/src/parity_ffi.rs +343 -0
- package/native/web/src/physics_ffi.rs +643 -0
- package/native/web/src/ragdoll_ffi.rs +250 -0
- package/native/web/src/render_settings.rs +98 -0
- package/native/windows/Cargo.lock +1815 -0
- package/native/windows/Cargo.toml +68 -0
- package/native/windows/src/lib.rs +1486 -0
- package/package.json +4279 -0
- package/src/audio/index.ts +315 -0
- package/src/core/colors.ts +63 -0
- package/src/core/index.ts +1206 -0
- package/src/core/keys.ts +63 -0
- package/src/core/types.ts +104 -0
- package/src/index.ts +171 -0
- package/src/math/index.ts +516 -0
- package/src/mobile/index.ts +294 -0
- package/src/models/index.ts +1258 -0
- package/src/physics/index.ts +1134 -0
- package/src/scene/index.ts +698 -0
- package/src/shapes/index.ts +120 -0
- package/src/text/index.ts +48 -0
- package/src/textures/index.ts +187 -0
- package/src/vfx/index.ts +191 -0
- package/src/world/index.ts +24 -0
- package/src/world/loader.ts +423 -0
- package/src/world/prefab.ts +217 -0
- package/src/world/render.ts +172 -0
- package/src/world/saver.ts +108 -0
- package/src/world/serialize.ts +301 -0
- package/src/world/terrain.ts +355 -0
- package/src/world/types.ts +160 -0
- package/src/world/validate.ts +319 -0
- package/src/world/version.ts +114 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Bloom Engine
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# BornEngine
|
|
2
|
+
|
|
3
|
+
**Native games from TypeScript.**
|
|
4
|
+
|
|
5
|
+
Write TypeScript. Ship native games — and now the web too.
|
|
6
|
+
BornEngine compiles your game to Metal, DirectX 12, Vulkan, OpenGL, and WebGPU — one codebase for every platform.
|
|
7
|
+
|
|
8
|
+
> **Inspired by [raylib](https://github.com/raysan5/raylib).** BornEngine models its public
|
|
9
|
+
> API on raylib's — in our view one of the best API designs in gamedev. BornEngine is an
|
|
10
|
+
> independent implementation, not a port — [how BornEngine relates to raylib »](#how-bornengine-relates-to-raylib)
|
|
11
|
+
|
|
12
|
+
> **Fork notice:** BornEngine is an independently maintained fork of the original
|
|
13
|
+
> [Bloom Engine](https://github.com/Bloom-Engine/engine). Bloom Engine remains the
|
|
14
|
+
> upstream project; this repository continues under the BornEngine name and is not
|
|
15
|
+
> affiliated with or endorsed by Bloom Engine's maintainers. The upstream MIT license
|
|
16
|
+
> and copyright notice are preserved in [LICENSE](LICENSE).
|
|
17
|
+
|
|
18
|
+
## Install
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install @bornengine/engine
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Or with your preferred package manager:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
bun add @bornengine/engine
|
|
28
|
+
pnpm add @bornengine/engine
|
|
29
|
+
yarn add @bornengine/engine
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The npm package ships the TypeScript API and the engine's Rust sources. Platform-specific Jolt static libraries come from the separate `@bornengine/jolt-prebuilt` dependency; building Jolt from source requires the `native/third_party/JoltPhysics` Git submodule. Normal builds use the prebuilt package, so there's no separate native download step.
|
|
33
|
+
|
|
34
|
+
You'll also need:
|
|
35
|
+
|
|
36
|
+
- **Perry** — the TypeScript AOT compiler that turns your game into a native binary or WASM module. It also drives the engine's native build.
|
|
37
|
+
- **Rust toolchain** ([rustup.rs](https://rustup.rs)) — Perry invokes Cargo to compile the engine's platform crate the first time you build for each target.
|
|
38
|
+
- For web builds only: [wasm-pack](https://rustwasm.github.io/wasm-pack/installer/) (`cargo install wasm-pack`).
|
|
39
|
+
|
|
40
|
+
## Quick Start
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
import { initWindow, windowShouldClose, beginDrawing,
|
|
44
|
+
endDrawing, clearBackground, drawText, Colors } from "@bornengine/engine";
|
|
45
|
+
|
|
46
|
+
initWindow(800, 450, "My Game");
|
|
47
|
+
|
|
48
|
+
while (!windowShouldClose()) {
|
|
49
|
+
beginDrawing();
|
|
50
|
+
clearBackground(Colors.SNOW);
|
|
51
|
+
drawText("Hello, BornEngine!", 190, 200, 20, Colors.DARKGRAY);
|
|
52
|
+
endDrawing();
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Web-Compatible Pattern
|
|
57
|
+
|
|
58
|
+
Use `runGame()` for code that works on both native and web:
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
import { initWindow, runGame, clearBackground, drawText, Colors } from "@bornengine/engine";
|
|
62
|
+
|
|
63
|
+
initWindow(800, 450, "My Game");
|
|
64
|
+
|
|
65
|
+
runGame((dt) => {
|
|
66
|
+
clearBackground(Colors.SNOW);
|
|
67
|
+
drawText("Hello, BornEngine!", 190, 200, 20, Colors.DARKGRAY);
|
|
68
|
+
});
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Build for web:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
./native/web/build.sh main.ts
|
|
75
|
+
cd dist/web && python3 -m http.server 8080
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Features
|
|
79
|
+
|
|
80
|
+
- **Simple API** — Functions, not classes. The entire API fits on a cheatsheet. ([design rationale](docs/design-api.md))
|
|
81
|
+
- **True native** — Compiles to Metal, DirectX 12, Vulkan, OpenGL, and WebGPU via wgpu.
|
|
82
|
+
- **Ship everywhere** — macOS, Windows, Linux, iOS, tvOS, Android, and Web from one codebase.
|
|
83
|
+
- **Unified 2D/3D** — Shapes, textures, text, 3D models, and audio in one engine.
|
|
84
|
+
- **Zero magic** — Explicit game loops, no hidden framework overhead.
|
|
85
|
+
|
|
86
|
+
## How BornEngine relates to raylib
|
|
87
|
+
|
|
88
|
+
BornEngine's public API is heavily inspired by [raylib](https://github.com/raysan5/raylib).
|
|
89
|
+
raylib's API is, in our opinion, one of the best in the gamedev space — a flat library
|
|
90
|
+
of plain functions, no classes, small enough to learn from a cheatsheet — so we model
|
|
91
|
+
ours on it. You'll recognize the shape immediately: `initWindow`, `beginDrawing`,
|
|
92
|
+
`clearBackground`, `drawText`, and modules named core / shapes / textures / text /
|
|
93
|
+
audio / models.
|
|
94
|
+
|
|
95
|
+
That's where the relationship ends. **BornEngine's implementation is entirely independent —
|
|
96
|
+
it does not link against, embed, or call raylib.** BornEngine compiles TypeScript directly to
|
|
97
|
+
native code via Perry, our LLVM-based AOT compiler, and renders through wgpu (Metal,
|
|
98
|
+
DirectX 12, Vulkan, OpenGL, WebGPU). It is not a port or a binding — just an engine that
|
|
99
|
+
admires raylib's API design. Thanks to
|
|
100
|
+
[Ramon Santamaria (@raysan5)](https://github.com/raysan5) and the raylib community for
|
|
101
|
+
setting the bar. ([full design rationale](docs/design-api.md))
|
|
102
|
+
|
|
103
|
+
## Modules
|
|
104
|
+
|
|
105
|
+
| Module | Import | Description |
|
|
106
|
+
|--------|--------|-------------|
|
|
107
|
+
| **Core** | `@bornengine/engine/core` | Window, game loop, input, timing |
|
|
108
|
+
| **Shapes** | `@bornengine/engine/shapes` | 2D drawing + collision detection |
|
|
109
|
+
| **Textures** | `@bornengine/engine/textures` | Image loading, sprite batching |
|
|
110
|
+
| **Text** | `@bornengine/engine/text` | TTF/OTF font loading and rendering |
|
|
111
|
+
| **Audio** | `@bornengine/engine/audio` | Sound effects + music streaming |
|
|
112
|
+
| **Models** | `@bornengine/engine/models` | 3D model loading (glTF, OBJ), skeletal animation |
|
|
113
|
+
| **Math** | `@bornengine/engine/math` | Vectors, matrices, quaternions, easing |
|
|
114
|
+
| **Scene** | `@bornengine/engine/scene` | Retained scene graph, frame callbacks, lighting |
|
|
115
|
+
| **Physics** | `@bornengine/engine/physics` | Jolt-backed rigid + soft bodies, character, vehicles ([docs](docs/physics.md)) |
|
|
116
|
+
| **VFX** | `@bornengine/engine/vfx` | GPU particle systems + decals |
|
|
117
|
+
| **World** | `@bornengine/engine/world` | `.world.json` loading, validation, instantiation ([docs](docs/world-format.md)) |
|
|
118
|
+
| **Mobile** | `@bornengine/engine/mobile` | Virtual joystick/buttons, touch-input helpers |
|
|
119
|
+
|
|
120
|
+
## Platforms
|
|
121
|
+
|
|
122
|
+
| Platform | Graphics API | Input |
|
|
123
|
+
|----------|-------------|-------|
|
|
124
|
+
| macOS | Metal | Keyboard + mouse |
|
|
125
|
+
| Windows | DirectX 12 | Keyboard + mouse |
|
|
126
|
+
| Linux | Vulkan / OpenGL | Keyboard + mouse |
|
|
127
|
+
| iOS | Metal | Touch + gamepad |
|
|
128
|
+
| tvOS | Metal | Siri Remote + gamepad |
|
|
129
|
+
| watchOS | SwiftUI Canvas (2D) + SceneKit (3D) | Digital Crown + taps ([docs](docs/watchos-target.md)) |
|
|
130
|
+
| Android | Vulkan / OpenGL ES | Touch + gamepad |
|
|
131
|
+
| **Web** | **WebGPU / WebGL** | **Keyboard + mouse + touch + gamepad** |
|
|
132
|
+
|
|
133
|
+
## Architecture
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
src/ TypeScript API
|
|
137
|
+
core/ Window, input, game loop
|
|
138
|
+
shapes/ 2D shapes + collision
|
|
139
|
+
textures/ Image loading, sprites
|
|
140
|
+
text/ Font rendering
|
|
141
|
+
audio/ Sound + music
|
|
142
|
+
models/ 3D models
|
|
143
|
+
math/ Vectors, matrices, easing
|
|
144
|
+
|
|
145
|
+
native/ Rust implementations
|
|
146
|
+
shared/ Cross-platform core (wgpu, fontdue, gltf)
|
|
147
|
+
macos/ Metal + AppKit + Core Audio
|
|
148
|
+
ios/ Metal + UIKit + Core Audio
|
|
149
|
+
tvos/ Metal + UIKit + GCController
|
|
150
|
+
windows/ DirectX 12 + Win32 + WASAPI
|
|
151
|
+
linux/ Vulkan/OpenGL + X11 + ALSA
|
|
152
|
+
android/ Vulkan/OpenGL ES + NativeActivity + AAudio
|
|
153
|
+
web/ WebGPU/WebGL + Canvas + Web Audio (WASM)
|
|
154
|
+
|
|
155
|
+
examples/
|
|
156
|
+
pong/ Complete working example (~170 lines)
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Types
|
|
160
|
+
|
|
161
|
+
Plain interfaces, no classes:
|
|
162
|
+
|
|
163
|
+
```typescript
|
|
164
|
+
interface Vec2 { x: number; y: number }
|
|
165
|
+
interface Vec3 { x: number; y: number; z: number }
|
|
166
|
+
interface Color { r: number; g: number; b: number; a: number }
|
|
167
|
+
interface Rect { x: number; y: number; width: number; height: number }
|
|
168
|
+
interface Camera2D { offset: Vec2; target: Vec2; rotation: number; zoom: number }
|
|
169
|
+
interface Camera3D { position: Vec3; target: Vec3; up: Vec3; fovy: number; projection: number }
|
|
170
|
+
interface Texture { handle: number; width: number; height: number }
|
|
171
|
+
interface Sound { handle: number }
|
|
172
|
+
interface Model { handle: number }
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Fullscreen
|
|
176
|
+
|
|
177
|
+
Launch your game in fullscreen by passing `true` as the fourth argument to `initWindow`:
|
|
178
|
+
|
|
179
|
+
```typescript
|
|
180
|
+
initWindow(800, 450, "My Game", true); // launches fullscreen
|
|
181
|
+
initWindow(800, 450, "My Game"); // windowed (default)
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Toggle fullscreen at runtime:
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
if (isKeyPressed(Key.F11)) {
|
|
188
|
+
toggleFullscreen();
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Fullscreen is supported on macOS (native AppKit fullscreen), Windows (borderless fullscreen), and Linux (EWMH/X11). The width and height you pass are used as the windowed dimensions when exiting fullscreen.
|
|
193
|
+
|
|
194
|
+
## Skeletal Animation
|
|
195
|
+
|
|
196
|
+
BornEngine supports GPU-accelerated skeletal animation via glTF/GLB models. The pipeline uses 4-bone linear blend skinning with a 128-joint uniform buffer, running entirely on the GPU.
|
|
197
|
+
|
|
198
|
+
```typescript
|
|
199
|
+
import { loadModel, loadModelAnimation, updateModelAnimation, drawModel,
|
|
200
|
+
getTime, Colors } from "@bornengine/engine";
|
|
201
|
+
|
|
202
|
+
const character = loadModel("assets/models/character.glb");
|
|
203
|
+
const anim = loadModelAnimation("assets/models/character.glb");
|
|
204
|
+
|
|
205
|
+
// In your game loop:
|
|
206
|
+
updateModelAnimation(anim, 0, getTime(), 1.0, 0, 0, 0);
|
|
207
|
+
drawModel(character, { x: 0, y: 0, z: 0 }, 1.0, Colors.WHITE);
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Key functions:
|
|
211
|
+
- `loadModel(path)` -- loads GLB with skin data (JOINTS_0, WEIGHTS_0)
|
|
212
|
+
- `loadModelAnimation(path)` -- loads skeleton + animation channels from GLB
|
|
213
|
+
- `updateModelAnimation(handle, animIndex, time, scale, px, py, pz)` -- samples animation, computes joint matrices
|
|
214
|
+
- `drawModel(model, position, scale, tint)` -- renders with GPU skinning
|
|
215
|
+
|
|
216
|
+
For the full pipeline (Blender export, pitfalls, architecture), see [docs/skeletal-animation.md](docs/skeletal-animation.md).
|
|
217
|
+
|
|
218
|
+
## Made with Bloom
|
|
219
|
+
|
|
220
|
+
**[Bloom Jump](https://apps.apple.com/us/app/bloom-jump/id6761447092)** — our first shipped game and a proof point for the engine. A free retro pixel platformer with five hand-crafted levels, 60 FPS, and an original chiptune soundtrack, built entirely with Bloom from one TypeScript codebase running natively on every target.
|
|
221
|
+
|
|
222
|
+
- [App Store](https://apps.apple.com/us/app/bloom-jump/id6761447092) — iOS, macOS, tvOS, and visionOS
|
|
223
|
+
- [App Store (watchOS)](https://apps.apple.com/us/app/bloom-jump-watch/id6779528549) — Apple Watch
|
|
224
|
+
- [Google Play](https://play.google.com/store/apps/details?id=com.bloom.jump) — Android
|
|
225
|
+
|
|
226
|
+
## Links
|
|
227
|
+
|
|
228
|
+
- [bloomengine.dev](https://bloomengine.dev)
|
|
229
|
+
- [Docs](https://bloomengine.dev/docs)
|
|
230
|
+
- [Showcase](https://bloomengine.dev/showcase)
|
|
231
|
+
- [Brand Guidelines](https://github.com/Bloom-Engine/brand)
|