rn-gamekit 0.1.0 → 0.2.1
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/CHANGELOG.md +75 -0
- package/README.md +97 -16
- package/lib/module/assets/defineAssets.js +28 -3
- package/lib/module/assets/defineAssets.js.map +1 -1
- package/lib/module/assets.js +11 -0
- package/lib/module/assets.js.map +1 -0
- package/lib/module/audio/createGameAudio.js +784 -0
- package/lib/module/audio/createGameAudio.js.map +1 -0
- package/lib/module/audio/errors.js +12 -0
- package/lib/module/audio/errors.js.map +1 -0
- package/lib/module/audio/index.js +5 -0
- package/lib/module/audio/index.js.map +1 -0
- package/lib/module/audio/resolver.js +37 -0
- package/lib/module/audio/resolver.js.map +1 -0
- package/lib/module/audio/types.js +4 -0
- package/lib/module/audio/types.js.map +1 -0
- package/lib/module/audio.js +9 -0
- package/lib/module/audio.js.map +1 -0
- package/lib/module/camera2d/bounds.js +59 -0
- package/lib/module/camera2d/bounds.js.map +1 -0
- package/lib/module/camera2d/extents.js +25 -0
- package/lib/module/camera2d/extents.js.map +1 -0
- package/lib/module/camera2d/follow.js +138 -0
- package/lib/module/camera2d/follow.js.map +1 -0
- package/lib/module/camera2d/index.js +20 -0
- package/lib/module/camera2d/index.js.map +1 -0
- package/lib/module/camera2d/interpolation.js +98 -0
- package/lib/module/camera2d/interpolation.js.map +1 -0
- package/lib/module/camera2d/shake.js +85 -0
- package/lib/module/camera2d/shake.js.map +1 -0
- package/lib/module/camera2d/transform.js +151 -0
- package/lib/module/camera2d/transform.js.map +1 -0
- package/lib/module/camera2d/types.js +4 -0
- package/lib/module/camera2d/types.js.map +1 -0
- package/lib/module/camera2d/validation.js +98 -0
- package/lib/module/camera2d/validation.js.map +1 -0
- package/lib/module/camera2d/visibility.js +138 -0
- package/lib/module/camera2d/visibility.js.map +1 -0
- package/lib/module/camera2d.js +9 -0
- package/lib/module/camera2d.js.map +1 -0
- package/lib/module/collision2d/colliders.js +266 -0
- package/lib/module/collision2d/colliders.js.map +1 -0
- package/lib/module/collision2d/debug.js +105 -0
- package/lib/module/collision2d/debug.js.map +1 -0
- package/lib/module/collision2d/filters.js +40 -0
- package/lib/module/collision2d/filters.js.map +1 -0
- package/lib/module/collision2d/index.js +12 -0
- package/lib/module/collision2d/index.js.map +1 -0
- package/lib/module/collision2d/intersections.js +67 -0
- package/lib/module/collision2d/intersections.js.map +1 -0
- package/lib/module/collision2d/manifolds.js +218 -0
- package/lib/module/collision2d/manifolds.js.map +1 -0
- package/lib/module/collision2d/segments.js +187 -0
- package/lib/module/collision2d/segments.js.map +1 -0
- package/lib/module/collision2d/spatialHash.js +167 -0
- package/lib/module/collision2d/spatialHash.js.map +1 -0
- package/lib/module/collision2d/sweeps.js +255 -0
- package/lib/module/collision2d/sweeps.js.map +1 -0
- package/lib/module/collision2d.js +9 -0
- package/lib/module/collision2d.js.map +1 -0
- package/lib/module/core/input/buttonPad.js +214 -0
- package/lib/module/core/input/buttonPad.js.map +1 -0
- package/lib/module/core/input/createInputBuffer.js +66 -14
- package/lib/module/core/input/createInputBuffer.js.map +1 -1
- package/lib/module/core/session/createGameSession.js +454 -50
- package/lib/module/core/session/createGameSession.js.map +1 -1
- package/lib/module/core/session/deepFreeze.js +92 -2
- package/lib/module/core/session/deepFreeze.js.map +1 -1
- package/lib/module/core/session/types.js +12 -0
- package/lib/module/core/session/types.js.map +1 -1
- package/lib/module/definition/defineGame.js +23 -0
- package/lib/module/definition/defineGame.js.map +1 -1
- package/lib/module/events/defineGameEvents.js +46 -0
- package/lib/module/events/defineGameEvents.js.map +1 -0
- package/lib/module/events/errors.js +16 -0
- package/lib/module/events/errors.js.map +1 -0
- package/lib/module/events/index.js +7 -0
- package/lib/module/events/index.js.map +1 -0
- package/lib/module/events/payload.js +219 -0
- package/lib/module/events/payload.js.map +1 -0
- package/lib/module/events/seed.js +33 -0
- package/lib/module/events/seed.js.map +1 -0
- package/lib/module/events/types.js +4 -0
- package/lib/module/events/types.js.map +1 -0
- package/lib/module/events.js +13 -0
- package/lib/module/events.js.map +1 -0
- package/lib/module/geometry/helpers.js +140 -0
- package/lib/module/geometry/helpers.js.map +1 -0
- package/lib/module/geometry/index.js +5 -0
- package/lib/module/geometry/index.js.map +1 -0
- package/lib/module/geometry/validation.js +104 -0
- package/lib/module/geometry/validation.js.map +1 -0
- package/lib/module/geometry.js +9 -0
- package/lib/module/geometry.js.map +1 -0
- package/lib/module/haptics/createGameHaptics.js +214 -0
- package/lib/module/haptics/createGameHaptics.js.map +1 -0
- package/lib/module/haptics/errors.js +12 -0
- package/lib/module/haptics/errors.js.map +1 -0
- package/lib/module/haptics/index.js +5 -0
- package/lib/module/haptics/index.js.map +1 -0
- package/lib/module/haptics/resolver.js +37 -0
- package/lib/module/haptics/resolver.js.map +1 -0
- package/lib/module/haptics/types.js +4 -0
- package/lib/module/haptics/types.js.map +1 -0
- package/lib/module/haptics.js +9 -0
- package/lib/module/haptics.js.map +1 -0
- package/lib/module/index.js +8 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/particles/createParticleSystem.js +481 -0
- package/lib/module/particles/createParticleSystem.js.map +1 -0
- package/lib/module/particles/defineParticleEffect.js +178 -0
- package/lib/module/particles/defineParticleEffect.js.map +1 -0
- package/lib/module/particles/errors.js +9 -0
- package/lib/module/particles/errors.js.map +1 -0
- package/lib/module/particles/index.js +8 -0
- package/lib/module/particles/index.js.map +1 -0
- package/lib/module/particles/sampling.js +121 -0
- package/lib/module/particles/sampling.js.map +1 -0
- package/lib/module/particles/types.js +4 -0
- package/lib/module/particles/types.js.map +1 -0
- package/lib/module/particles.js +4 -0
- package/lib/module/particles.js.map +1 -0
- package/lib/module/react/GameButtonPad.js +344 -0
- package/lib/module/react/GameButtonPad.js.map +1 -0
- package/lib/module/react/GamePointerInput.js +74 -16
- package/lib/module/react/GamePointerInput.js.map +1 -1
- package/lib/module/react/GameView.js +139 -60
- package/lib/module/react/GameView.js.map +1 -1
- package/lib/module/react/assets/createGameAssetStore.js +145 -95
- package/lib/module/react/assets/createGameAssetStore.js.map +1 -1
- package/lib/module/react/assets/useGameAssets.js +60 -35
- package/lib/module/react/assets/useGameAssets.js.map +1 -1
- package/lib/module/react/bindAppLifecycle.js +46 -17
- package/lib/module/react/bindAppLifecycle.js.map +1 -1
- package/lib/module/react/bindGameSession.js +13 -2
- package/lib/module/react/bindGameSession.js.map +1 -1
- package/lib/module/react/camera2d/GameLayer2D.js +50 -0
- package/lib/module/react/camera2d/GameLayer2D.js.map +1 -0
- package/lib/module/react/camera2d/defineGameCamera2D.js +30 -0
- package/lib/module/react/camera2d/defineGameCamera2D.js.map +1 -0
- package/lib/module/react/camera2d/usePresentedCameraBinding.js +177 -0
- package/lib/module/react/camera2d/usePresentedCameraBinding.js.map +1 -0
- package/lib/module/react/cleanupList.js +38 -0
- package/lib/module/react/cleanupList.js.map +1 -0
- package/lib/module/react/lifecycleSource.js +49 -0
- package/lib/module/react/lifecycleSource.js.map +1 -0
- package/lib/module/react/particles/ParticleView.js +308 -0
- package/lib/module/react/particles/ParticleView.js.map +1 -0
- package/lib/module/react/particles/culling.js +115 -0
- package/lib/module/react/particles/culling.js.map +1 -0
- package/lib/module/react/particles/index.js +7 -0
- package/lib/module/react/particles/index.js.map +1 -0
- package/lib/module/react/particles/spriteXForm.js +45 -0
- package/lib/module/react/particles/spriteXForm.js.map +1 -0
- package/lib/module/react/particles/useParticlePresentation.js +204 -0
- package/lib/module/react/particles/useParticlePresentation.js.map +1 -0
- package/lib/module/react/pointerBinding.js +55 -17
- package/lib/module/react/pointerBinding.js.map +1 -1
- package/lib/module/react/pointerCamera.js +28 -0
- package/lib/module/react/pointerCamera.js.map +1 -0
- package/lib/module/react/pointerCoalescer.js +16 -9
- package/lib/module/react/pointerCoalescer.js.map +1 -1
- package/lib/module/react/sprites/GameSprite.js +5 -17
- package/lib/module/react/sprites/GameSprite.js.map +1 -1
- package/lib/module/react/sprites/GameWorld2D.js +112 -9
- package/lib/module/react/sprites/GameWorld2D.js.map +1 -1
- package/lib/module/react/sprites/Sprite.js +48 -63
- package/lib/module/react/sprites/Sprite.js.map +1 -1
- package/lib/module/react/sprites/SpriteBatch.js +53 -28
- package/lib/module/react/sprites/SpriteBatch.js.map +1 -1
- package/lib/module/react/sprites/batchVisibility.js +58 -0
- package/lib/module/react/sprites/batchVisibility.js.map +1 -0
- package/lib/module/react/sprites/spriteSelection.js +103 -0
- package/lib/module/react/sprites/spriteSelection.js.map +1 -0
- package/lib/module/react/sprites/spriteTransform.js +46 -25
- package/lib/module/react/sprites/spriteTransform.js.map +1 -1
- package/lib/module/react/tilemap/TileMapLayer2D.js +217 -0
- package/lib/module/react/tilemap/TileMapLayer2D.js.map +1 -0
- package/lib/module/react/tilemap/tilePresentation.js +374 -0
- package/lib/module/react/tilemap/tilePresentation.js.map +1 -0
- package/lib/module/react/useGameSession.js +70 -0
- package/lib/module/react/useGameSession.js.map +1 -0
- package/lib/module/react/useGameSessionStatus.js +46 -0
- package/lib/module/react/useGameSessionStatus.js.map +1 -0
- package/lib/module/react/viewportBinding.js +5 -1
- package/lib/module/react/viewportBinding.js.map +1 -1
- package/lib/module/react.js +12 -1
- package/lib/module/react.js.map +1 -1
- package/lib/module/scene/defineScene.js +17 -0
- package/lib/module/scene/defineScene.js.map +1 -1
- package/lib/module/sprites/sampleSpriteClip.js +66 -6
- package/lib/module/sprites/sampleSpriteClip.js.map +1 -1
- package/lib/module/sprites/spriteAnimationState.js +10 -20
- package/lib/module/sprites/spriteAnimationState.js.map +1 -1
- package/lib/module/sprites.js +11 -0
- package/lib/module/sprites.js.map +1 -0
- package/lib/module/storage/adapters/asyncStorage.js +57 -0
- package/lib/module/storage/adapters/asyncStorage.js.map +1 -0
- package/lib/module/storage/adapters/memory.js +50 -0
- package/lib/module/storage/adapters/memory.js.map +1 -0
- package/lib/module/storage/errors.js +34 -0
- package/lib/module/storage/errors.js.map +1 -0
- package/lib/module/storage/index.js +11 -0
- package/lib/module/storage/index.js.map +1 -0
- package/lib/module/storage/schema.js +151 -0
- package/lib/module/storage/schema.js.map +1 -0
- package/lib/module/storage/serialization.js +249 -0
- package/lib/module/storage/serialization.js.map +1 -0
- package/lib/module/storage/store.js +387 -0
- package/lib/module/storage/store.js.map +1 -0
- package/lib/module/storage/types.js +16 -0
- package/lib/module/storage/types.js.map +1 -0
- package/lib/module/storage/validation.js +111 -0
- package/lib/module/storage/validation.js.map +1 -0
- package/lib/module/storage.js +4 -0
- package/lib/module/storage.js.map +1 -0
- package/lib/module/testing.js +4 -0
- package/lib/module/testing.js.map +1 -1
- package/lib/module/tilemap/chunkStats.js +27 -0
- package/lib/module/tilemap/chunkStats.js.map +1 -0
- package/lib/module/tilemap/definitions.js +308 -0
- package/lib/module/tilemap/definitions.js.map +1 -0
- package/lib/module/tilemap/errors.js +13 -0
- package/lib/module/tilemap/errors.js.map +1 -0
- package/lib/module/tilemap/index.js +10 -0
- package/lib/module/tilemap/index.js.map +1 -0
- package/lib/module/tilemap/movement.js +379 -0
- package/lib/module/tilemap/movement.js.map +1 -0
- package/lib/module/tilemap/queries.js +114 -0
- package/lib/module/tilemap/queries.js.map +1 -0
- package/lib/module/tilemap/tiledAdapter.js +141 -0
- package/lib/module/tilemap/tiledAdapter.js.map +1 -0
- package/lib/module/tilemap/types.js +4 -0
- package/lib/module/tilemap/types.js.map +1 -0
- package/lib/module/tilemap.js +4 -0
- package/lib/module/tilemap.js.map +1 -0
- package/lib/typescript/src/assets/defineAssets.d.ts +1 -1
- package/lib/typescript/src/assets/defineAssets.d.ts.map +1 -1
- package/lib/typescript/src/assets.d.ts +11 -0
- package/lib/typescript/src/assets.d.ts.map +1 -0
- package/lib/typescript/src/audio/createGameAudio.d.ts +5 -0
- package/lib/typescript/src/audio/createGameAudio.d.ts.map +1 -0
- package/lib/typescript/src/audio/errors.d.ts +6 -0
- package/lib/typescript/src/audio/errors.d.ts.map +1 -0
- package/lib/typescript/src/audio/index.d.ts +4 -0
- package/lib/typescript/src/audio/index.d.ts.map +1 -0
- package/lib/typescript/src/audio/resolver.d.ts +44 -0
- package/lib/typescript/src/audio/resolver.d.ts.map +1 -0
- package/lib/typescript/src/audio/types.d.ts +42 -0
- package/lib/typescript/src/audio/types.d.ts.map +1 -0
- package/lib/typescript/src/audio.d.ts +8 -0
- package/lib/typescript/src/audio.d.ts.map +1 -0
- package/lib/typescript/src/camera2d/bounds.d.ts +25 -0
- package/lib/typescript/src/camera2d/bounds.d.ts.map +1 -0
- package/lib/typescript/src/camera2d/extents.d.ts +17 -0
- package/lib/typescript/src/camera2d/extents.d.ts.map +1 -0
- package/lib/typescript/src/camera2d/follow.d.ts +24 -0
- package/lib/typescript/src/camera2d/follow.d.ts.map +1 -0
- package/lib/typescript/src/camera2d/index.d.ts +19 -0
- package/lib/typescript/src/camera2d/index.d.ts.map +1 -0
- package/lib/typescript/src/camera2d/interpolation.d.ts +17 -0
- package/lib/typescript/src/camera2d/interpolation.d.ts.map +1 -0
- package/lib/typescript/src/camera2d/shake.d.ts +20 -0
- package/lib/typescript/src/camera2d/shake.d.ts.map +1 -0
- package/lib/typescript/src/camera2d/transform.d.ts +44 -0
- package/lib/typescript/src/camera2d/transform.d.ts.map +1 -0
- package/lib/typescript/src/camera2d/types.d.ts +74 -0
- package/lib/typescript/src/camera2d/types.d.ts.map +1 -0
- package/lib/typescript/src/camera2d/validation.d.ts +30 -0
- package/lib/typescript/src/camera2d/validation.d.ts.map +1 -0
- package/lib/typescript/src/camera2d/visibility.d.ts +47 -0
- package/lib/typescript/src/camera2d/visibility.d.ts.map +1 -0
- package/lib/typescript/src/camera2d.d.ts +7 -0
- package/lib/typescript/src/camera2d.d.ts.map +1 -0
- package/lib/typescript/src/collision2d/colliders.d.ts +120 -0
- package/lib/typescript/src/collision2d/colliders.d.ts.map +1 -0
- package/lib/typescript/src/collision2d/debug.d.ts +67 -0
- package/lib/typescript/src/collision2d/debug.d.ts.map +1 -0
- package/lib/typescript/src/collision2d/filters.d.ts +28 -0
- package/lib/typescript/src/collision2d/filters.d.ts.map +1 -0
- package/lib/typescript/src/collision2d/index.d.ts +17 -0
- package/lib/typescript/src/collision2d/index.d.ts.map +1 -0
- package/lib/typescript/src/collision2d/intersections.d.ts +24 -0
- package/lib/typescript/src/collision2d/intersections.d.ts.map +1 -0
- package/lib/typescript/src/collision2d/manifolds.d.ts +39 -0
- package/lib/typescript/src/collision2d/manifolds.d.ts.map +1 -0
- package/lib/typescript/src/collision2d/segments.d.ts +24 -0
- package/lib/typescript/src/collision2d/segments.d.ts.map +1 -0
- package/lib/typescript/src/collision2d/spatialHash.d.ts +50 -0
- package/lib/typescript/src/collision2d/spatialHash.d.ts.map +1 -0
- package/lib/typescript/src/collision2d/sweeps.d.ts +60 -0
- package/lib/typescript/src/collision2d/sweeps.d.ts.map +1 -0
- package/lib/typescript/src/collision2d.d.ts +7 -0
- package/lib/typescript/src/collision2d.d.ts.map +1 -0
- package/lib/typescript/src/core/input/buttonPad.d.ts +59 -0
- package/lib/typescript/src/core/input/buttonPad.d.ts.map +1 -0
- package/lib/typescript/src/core/input/createInputBuffer.d.ts +1 -1
- package/lib/typescript/src/core/input/createInputBuffer.d.ts.map +1 -1
- package/lib/typescript/src/core/input/types.d.ts +7 -0
- package/lib/typescript/src/core/input/types.d.ts.map +1 -1
- package/lib/typescript/src/core/session/createGameSession.d.ts +4 -2
- package/lib/typescript/src/core/session/createGameSession.d.ts.map +1 -1
- package/lib/typescript/src/core/session/deepFreeze.d.ts +21 -1
- package/lib/typescript/src/core/session/deepFreeze.d.ts.map +1 -1
- package/lib/typescript/src/core/session/diagnostics.d.ts +2 -0
- package/lib/typescript/src/core/session/diagnostics.d.ts.map +1 -1
- package/lib/typescript/src/core/session/types.d.ts +69 -4
- package/lib/typescript/src/core/session/types.d.ts.map +1 -1
- package/lib/typescript/src/definition/defineGame.d.ts +12 -1
- package/lib/typescript/src/definition/defineGame.d.ts.map +1 -1
- package/lib/typescript/src/definition/types.d.ts +10 -1
- package/lib/typescript/src/definition/types.d.ts.map +1 -1
- package/lib/typescript/src/events/defineGameEvents.d.ts +26 -0
- package/lib/typescript/src/events/defineGameEvents.d.ts.map +1 -0
- package/lib/typescript/src/events/errors.d.ts +12 -0
- package/lib/typescript/src/events/errors.d.ts.map +1 -0
- package/lib/typescript/src/events/index.d.ts +6 -0
- package/lib/typescript/src/events/index.d.ts.map +1 -0
- package/lib/typescript/src/events/payload.d.ts +21 -0
- package/lib/typescript/src/events/payload.d.ts.map +1 -0
- package/lib/typescript/src/events/seed.d.ts +3 -0
- package/lib/typescript/src/events/seed.d.ts.map +1 -0
- package/lib/typescript/src/events/types.d.ts +42 -0
- package/lib/typescript/src/events/types.d.ts.map +1 -0
- package/lib/typescript/src/events.d.ts +12 -0
- package/lib/typescript/src/events.d.ts.map +1 -0
- package/lib/typescript/src/geometry/helpers.d.ts +35 -0
- package/lib/typescript/src/geometry/helpers.d.ts.map +1 -0
- package/lib/typescript/src/geometry/index.d.ts +4 -0
- package/lib/typescript/src/geometry/index.d.ts.map +1 -0
- package/lib/typescript/src/geometry/types.d.ts +49 -0
- package/lib/typescript/src/geometry/types.d.ts.map +1 -1
- package/lib/typescript/src/geometry/validation.d.ts +44 -0
- package/lib/typescript/src/geometry/validation.d.ts.map +1 -0
- package/lib/typescript/src/geometry.d.ts +7 -0
- package/lib/typescript/src/geometry.d.ts.map +1 -0
- package/lib/typescript/src/haptics/createGameHaptics.d.ts +3 -0
- package/lib/typescript/src/haptics/createGameHaptics.d.ts.map +1 -0
- package/lib/typescript/src/haptics/errors.d.ts +6 -0
- package/lib/typescript/src/haptics/errors.d.ts.map +1 -0
- package/lib/typescript/src/haptics/index.d.ts +4 -0
- package/lib/typescript/src/haptics/index.d.ts.map +1 -0
- package/lib/typescript/src/haptics/resolver.d.ts +22 -0
- package/lib/typescript/src/haptics/resolver.d.ts.map +1 -0
- package/lib/typescript/src/haptics/types.d.ts +37 -0
- package/lib/typescript/src/haptics/types.d.ts.map +1 -0
- package/lib/typescript/src/haptics.d.ts +8 -0
- package/lib/typescript/src/haptics.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +10 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/particles/createParticleSystem.d.ts +5 -0
- package/lib/typescript/src/particles/createParticleSystem.d.ts.map +1 -0
- package/lib/typescript/src/particles/defineParticleEffect.d.ts +3 -0
- package/lib/typescript/src/particles/defineParticleEffect.d.ts.map +1 -0
- package/lib/typescript/src/particles/errors.d.ts +5 -0
- package/lib/typescript/src/particles/errors.d.ts.map +1 -0
- package/lib/typescript/src/particles/index.d.ts +6 -0
- package/lib/typescript/src/particles/index.d.ts.map +1 -0
- package/lib/typescript/src/particles/sampling.d.ts +54 -0
- package/lib/typescript/src/particles/sampling.d.ts.map +1 -0
- package/lib/typescript/src/particles/types.d.ts +292 -0
- package/lib/typescript/src/particles/types.d.ts.map +1 -0
- package/lib/typescript/src/particles.d.ts +2 -0
- package/lib/typescript/src/particles.d.ts.map +1 -0
- package/lib/typescript/src/react/GameButtonPad.d.ts +84 -0
- package/lib/typescript/src/react/GameButtonPad.d.ts.map +1 -0
- package/lib/typescript/src/react/GamePointerInput.d.ts.map +1 -1
- package/lib/typescript/src/react/GameView.d.ts +27 -1
- package/lib/typescript/src/react/GameView.d.ts.map +1 -1
- package/lib/typescript/src/react/assets/createGameAssetStore.d.ts.map +1 -1
- package/lib/typescript/src/react/assets/useGameAssets.d.ts.map +1 -1
- package/lib/typescript/src/react/bindAppLifecycle.d.ts +7 -1
- package/lib/typescript/src/react/bindAppLifecycle.d.ts.map +1 -1
- package/lib/typescript/src/react/bindGameSession.d.ts.map +1 -1
- package/lib/typescript/src/react/camera2d/GameLayer2D.d.ts +24 -0
- package/lib/typescript/src/react/camera2d/GameLayer2D.d.ts.map +1 -0
- package/lib/typescript/src/react/camera2d/defineGameCamera2D.d.ts +44 -0
- package/lib/typescript/src/react/camera2d/defineGameCamera2D.d.ts.map +1 -0
- package/lib/typescript/src/react/camera2d/usePresentedCameraBinding.d.ts +22 -0
- package/lib/typescript/src/react/camera2d/usePresentedCameraBinding.d.ts.map +1 -0
- package/lib/typescript/src/react/cleanupList.d.ts +21 -0
- package/lib/typescript/src/react/cleanupList.d.ts.map +1 -0
- package/lib/typescript/src/react/instrumentation.d.ts +33 -3
- package/lib/typescript/src/react/instrumentation.d.ts.map +1 -1
- package/lib/typescript/src/react/lifecycleSource.d.ts +21 -0
- package/lib/typescript/src/react/lifecycleSource.d.ts.map +1 -0
- package/lib/typescript/src/react/particles/ParticleView.d.ts +65 -0
- package/lib/typescript/src/react/particles/ParticleView.d.ts.map +1 -0
- package/lib/typescript/src/react/particles/culling.d.ts +70 -0
- package/lib/typescript/src/react/particles/culling.d.ts.map +1 -0
- package/lib/typescript/src/react/particles/index.d.ts +7 -0
- package/lib/typescript/src/react/particles/index.d.ts.map +1 -0
- package/lib/typescript/src/react/particles/spriteXForm.d.ts +28 -0
- package/lib/typescript/src/react/particles/spriteXForm.d.ts.map +1 -0
- package/lib/typescript/src/react/particles/useParticlePresentation.d.ts +48 -0
- package/lib/typescript/src/react/particles/useParticlePresentation.d.ts.map +1 -0
- package/lib/typescript/src/react/pointerBinding.d.ts +38 -8
- package/lib/typescript/src/react/pointerBinding.d.ts.map +1 -1
- package/lib/typescript/src/react/pointerCamera.d.ts +20 -0
- package/lib/typescript/src/react/pointerCamera.d.ts.map +1 -0
- package/lib/typescript/src/react/pointerCoalescer.d.ts +17 -1
- package/lib/typescript/src/react/pointerCoalescer.d.ts.map +1 -1
- package/lib/typescript/src/react/sprites/GameSprite.d.ts +3 -10
- package/lib/typescript/src/react/sprites/GameSprite.d.ts.map +1 -1
- package/lib/typescript/src/react/sprites/GameWorld2D.d.ts +51 -6
- package/lib/typescript/src/react/sprites/GameWorld2D.d.ts.map +1 -1
- package/lib/typescript/src/react/sprites/Sprite.d.ts.map +1 -1
- package/lib/typescript/src/react/sprites/SpriteBatch.d.ts +22 -1
- package/lib/typescript/src/react/sprites/SpriteBatch.d.ts.map +1 -1
- package/lib/typescript/src/react/sprites/batchVisibility.d.ts +28 -0
- package/lib/typescript/src/react/sprites/batchVisibility.d.ts.map +1 -0
- package/lib/typescript/src/react/sprites/spriteSelection.d.ts +58 -0
- package/lib/typescript/src/react/sprites/spriteSelection.d.ts.map +1 -0
- package/lib/typescript/src/react/sprites/spriteTransform.d.ts +27 -12
- package/lib/typescript/src/react/sprites/spriteTransform.d.ts.map +1 -1
- package/lib/typescript/src/react/tilemap/TileMapLayer2D.d.ts +69 -0
- package/lib/typescript/src/react/tilemap/TileMapLayer2D.d.ts.map +1 -0
- package/lib/typescript/src/react/tilemap/tilePresentation.d.ts +217 -0
- package/lib/typescript/src/react/tilemap/tilePresentation.d.ts.map +1 -0
- package/lib/typescript/src/react/useGameSession.d.ts +48 -0
- package/lib/typescript/src/react/useGameSession.d.ts.map +1 -0
- package/lib/typescript/src/react/useGameSessionStatus.d.ts +23 -0
- package/lib/typescript/src/react/useGameSessionStatus.d.ts.map +1 -0
- package/lib/typescript/src/react/viewportBinding.d.ts +5 -1
- package/lib/typescript/src/react/viewportBinding.d.ts.map +1 -1
- package/lib/typescript/src/react.d.ts +18 -1
- package/lib/typescript/src/react.d.ts.map +1 -1
- package/lib/typescript/src/scene/defineScene.d.ts +22 -2
- package/lib/typescript/src/scene/defineScene.d.ts.map +1 -1
- package/lib/typescript/src/scene/types.d.ts +24 -4
- package/lib/typescript/src/scene/types.d.ts.map +1 -1
- package/lib/typescript/src/sprites/sampleSpriteClip.d.ts +26 -2
- package/lib/typescript/src/sprites/sampleSpriteClip.d.ts.map +1 -1
- package/lib/typescript/src/sprites/spriteAnimationState.d.ts +6 -7
- package/lib/typescript/src/sprites/spriteAnimationState.d.ts.map +1 -1
- package/lib/typescript/src/sprites.d.ts +10 -0
- package/lib/typescript/src/sprites.d.ts.map +1 -0
- package/lib/typescript/src/storage/adapters/asyncStorage.d.ts +18 -0
- package/lib/typescript/src/storage/adapters/asyncStorage.d.ts.map +1 -0
- package/lib/typescript/src/storage/adapters/memory.d.ts +16 -0
- package/lib/typescript/src/storage/adapters/memory.d.ts.map +1 -0
- package/lib/typescript/src/storage/errors.d.ts +37 -0
- package/lib/typescript/src/storage/errors.d.ts.map +1 -0
- package/lib/typescript/src/storage/index.d.ts +11 -0
- package/lib/typescript/src/storage/index.d.ts.map +1 -0
- package/lib/typescript/src/storage/schema.d.ts +22 -0
- package/lib/typescript/src/storage/schema.d.ts.map +1 -0
- package/lib/typescript/src/storage/serialization.d.ts +23 -0
- package/lib/typescript/src/storage/serialization.d.ts.map +1 -0
- package/lib/typescript/src/storage/store.d.ts +3 -0
- package/lib/typescript/src/storage/store.d.ts.map +1 -0
- package/lib/typescript/src/storage/types.d.ts +69 -0
- package/lib/typescript/src/storage/types.d.ts.map +1 -0
- package/lib/typescript/src/storage/validation.d.ts +24 -0
- package/lib/typescript/src/storage/validation.d.ts.map +1 -0
- package/lib/typescript/src/storage.d.ts +2 -0
- package/lib/typescript/src/storage.d.ts.map +1 -0
- package/lib/typescript/src/testing.d.ts +1 -0
- package/lib/typescript/src/testing.d.ts.map +1 -1
- package/lib/typescript/src/tilemap/chunkStats.d.ts +14 -0
- package/lib/typescript/src/tilemap/chunkStats.d.ts.map +1 -0
- package/lib/typescript/src/tilemap/definitions.d.ts +38 -0
- package/lib/typescript/src/tilemap/definitions.d.ts.map +1 -0
- package/lib/typescript/src/tilemap/errors.d.ts +7 -0
- package/lib/typescript/src/tilemap/errors.d.ts.map +1 -0
- package/lib/typescript/src/tilemap/index.d.ts +8 -0
- package/lib/typescript/src/tilemap/index.d.ts.map +1 -0
- package/lib/typescript/src/tilemap/movement.d.ts +52 -0
- package/lib/typescript/src/tilemap/movement.d.ts.map +1 -0
- package/lib/typescript/src/tilemap/queries.d.ts +21 -0
- package/lib/typescript/src/tilemap/queries.d.ts.map +1 -0
- package/lib/typescript/src/tilemap/tiledAdapter.d.ts +32 -0
- package/lib/typescript/src/tilemap/tiledAdapter.d.ts.map +1 -0
- package/lib/typescript/src/tilemap/types.d.ts +127 -0
- package/lib/typescript/src/tilemap/types.d.ts.map +1 -0
- package/lib/typescript/src/tilemap.d.ts +2 -0
- package/lib/typescript/src/tilemap.d.ts.map +1 -0
- package/package.json +100 -10
- package/src/assets/defineAssets.ts +31 -5
- package/src/assets.ts +27 -0
- package/src/audio/createGameAudio.ts +749 -0
- package/src/audio/errors.ts +12 -0
- package/src/audio/index.ts +9 -0
- package/src/audio/resolver.ts +74 -0
- package/src/audio/types.ts +47 -0
- package/src/audio.ts +13 -0
- package/src/camera2d/bounds.ts +69 -0
- package/src/camera2d/extents.ts +25 -0
- package/src/camera2d/follow.ts +165 -0
- package/src/camera2d/index.ts +29 -0
- package/src/camera2d/interpolation.ts +113 -0
- package/src/camera2d/shake.ts +90 -0
- package/src/camera2d/transform.ts +148 -0
- package/src/camera2d/types.ts +73 -0
- package/src/camera2d/validation.ts +126 -0
- package/src/camera2d/visibility.ts +181 -0
- package/src/camera2d.ts +6 -0
- package/src/collision2d/colliders.ts +292 -0
- package/src/collision2d/debug.ts +133 -0
- package/src/collision2d/filters.ts +48 -0
- package/src/collision2d/index.ts +74 -0
- package/src/collision2d/intersections.ts +82 -0
- package/src/collision2d/manifolds.ts +191 -0
- package/src/collision2d/segments.ts +176 -0
- package/src/collision2d/spatialHash.ts +211 -0
- package/src/collision2d/sweeps.ts +269 -0
- package/src/collision2d.ts +6 -0
- package/src/core/input/buttonPad.ts +235 -0
- package/src/core/input/createInputBuffer.ts +95 -14
- package/src/core/input/types.ts +7 -0
- package/src/core/session/createGameSession.ts +480 -53
- package/src/core/session/deepFreeze.ts +104 -3
- package/src/core/session/diagnostics.ts +2 -0
- package/src/core/session/types.ts +77 -4
- package/src/definition/defineGame.ts +61 -3
- package/src/definition/types.ts +10 -0
- package/src/events/defineGameEvents.ts +46 -0
- package/src/events/errors.ts +14 -0
- package/src/events/index.ts +14 -0
- package/src/events/payload.ts +234 -0
- package/src/events/seed.ts +33 -0
- package/src/events/types.ts +53 -0
- package/src/events.ts +20 -0
- package/src/geometry/helpers.ts +136 -0
- package/src/geometry/index.ts +14 -0
- package/src/geometry/types.ts +54 -0
- package/src/geometry/validation.ts +131 -0
- package/src/geometry.ts +6 -0
- package/src/haptics/createGameHaptics.ts +214 -0
- package/src/haptics/errors.ts +12 -0
- package/src/haptics/index.ts +3 -0
- package/src/haptics/resolver.ts +58 -0
- package/src/haptics/types.ts +48 -0
- package/src/haptics.ts +7 -0
- package/src/index.ts +37 -1
- package/src/particles/createParticleSystem.ts +505 -0
- package/src/particles/defineParticleEffect.ts +164 -0
- package/src/particles/errors.ts +6 -0
- package/src/particles/index.ts +5 -0
- package/src/particles/sampling.ts +141 -0
- package/src/particles/types.ts +327 -0
- package/src/particles.ts +1 -0
- package/src/react/GameButtonPad.tsx +436 -0
- package/src/react/GamePointerInput.tsx +73 -8
- package/src/react/GameView.tsx +160 -61
- package/src/react/assets/createGameAssetStore.ts +140 -107
- package/src/react/assets/useGameAssets.ts +63 -31
- package/src/react/bindAppLifecycle.ts +55 -19
- package/src/react/bindGameSession.ts +12 -2
- package/src/react/camera2d/GameLayer2D.tsx +43 -0
- package/src/react/camera2d/defineGameCamera2D.ts +59 -0
- package/src/react/camera2d/usePresentedCameraBinding.ts +185 -0
- package/src/react/cleanupList.ts +48 -0
- package/src/react/instrumentation.ts +31 -3
- package/src/react/lifecycleSource.ts +58 -0
- package/src/react/particles/ParticleView.tsx +358 -0
- package/src/react/particles/culling.ts +145 -0
- package/src/react/particles/index.ts +6 -0
- package/src/react/particles/spriteXForm.ts +72 -0
- package/src/react/particles/useParticlePresentation.ts +261 -0
- package/src/react/pointerBinding.ts +74 -16
- package/src/react/pointerCamera.ts +33 -0
- package/src/react/pointerCoalescer.ts +36 -10
- package/src/react/sprites/GameSprite.tsx +4 -33
- package/src/react/sprites/GameWorld2D.tsx +113 -7
- package/src/react/sprites/Sprite.tsx +51 -72
- package/src/react/sprites/SpriteBatch.tsx +74 -22
- package/src/react/sprites/batchVisibility.ts +76 -0
- package/src/react/sprites/spriteSelection.ts +133 -0
- package/src/react/sprites/spriteTransform.ts +46 -26
- package/src/react/tilemap/TileMapLayer2D.tsx +274 -0
- package/src/react/tilemap/tilePresentation.ts +491 -0
- package/src/react/useGameSession.ts +90 -0
- package/src/react/useGameSessionStatus.ts +53 -0
- package/src/react/viewportBinding.ts +5 -1
- package/src/react.ts +18 -1
- package/src/scene/defineScene.ts +47 -5
- package/src/scene/types.ts +37 -3
- package/src/sprites/sampleSpriteClip.ts +82 -14
- package/src/sprites/spriteAnimationState.ts +29 -25
- package/src/sprites.ts +22 -0
- package/src/storage/adapters/asyncStorage.ts +77 -0
- package/src/storage/adapters/memory.ts +58 -0
- package/src/storage/errors.ts +88 -0
- package/src/storage/index.ts +18 -0
- package/src/storage/schema.ts +147 -0
- package/src/storage/serialization.ts +248 -0
- package/src/storage/store.ts +380 -0
- package/src/storage/types.ts +76 -0
- package/src/storage/validation.ts +102 -0
- package/src/storage.ts +1 -0
- package/src/testing.ts +4 -0
- package/src/tilemap/chunkStats.ts +24 -0
- package/src/tilemap/definitions.ts +327 -0
- package/src/tilemap/errors.ts +11 -0
- package/src/tilemap/index.ts +10 -0
- package/src/tilemap/movement.ts +368 -0
- package/src/tilemap/queries.ts +136 -0
- package/src/tilemap/tiledAdapter.ts +165 -0
- package/src/tilemap/types.ts +119 -0
- package/src/tilemap.ts +1 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
4
|
+
import { useSharedValue } from 'react-native-reanimated';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* What the presentation hook hands to views (T15-SF1): a SCALAR active-time
|
|
8
|
+
* clock written every running frame, plus the bounded emission registry
|
|
9
|
+
* transferred only when membership changes. No per-frame bulk arrays cross
|
|
10
|
+
* the runtime boundary.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const EMPTY_REGISTRY = Object.freeze({
|
|
14
|
+
registryRevision: -1,
|
|
15
|
+
activeClock: 0,
|
|
16
|
+
effects: Object.freeze({})
|
|
17
|
+
});
|
|
18
|
+
function defaultSchedule(tick) {
|
|
19
|
+
const id = requestAnimationFrame(tick);
|
|
20
|
+
return () => cancelAnimationFrame(id);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Own THE exclusive presentation clock for one system (T15-F1/T15-RF3).
|
|
25
|
+
*
|
|
26
|
+
* Per-frame runtime work is ONE scalar write (`clock.value`); the bounded
|
|
27
|
+
* emission registry is transferred only when membership changes (T15-SF1).
|
|
28
|
+
*
|
|
29
|
+
* Pause sources are applied through ONE effect-owned control so transitions
|
|
30
|
+
* stop/start the scheduler immediately — including while the driver is idle
|
|
31
|
+
* or asleep (T15-SF3). Scheduling runs only when the system is running AND
|
|
32
|
+
* at least one particle is active; it fully stops otherwise and restarts
|
|
33
|
+
* from resume/wake transitions.
|
|
34
|
+
*/
|
|
35
|
+
export function useParticlePresentation(system, options) {
|
|
36
|
+
const binding = useMemo(() => system.bindPresentation(), [system]);
|
|
37
|
+
const clock = useSharedValue(binding.activeClock);
|
|
38
|
+
const registry = useSharedValue(EMPTY_REGISTRY);
|
|
39
|
+
// T20F-R2: the driver effect must key ONLY on ownership inputs. Shared
|
|
40
|
+
// values are stable in Reanimated; the refs keep the effect closures
|
|
41
|
+
// pointing at the latest instance even where mocks hand back fresh objects.
|
|
42
|
+
const clockRef = useRef(clock);
|
|
43
|
+
const registryRef = useRef(registry);
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
clockRef.current = clock;
|
|
46
|
+
registryRef.current = registry;
|
|
47
|
+
}, [clock, registry]);
|
|
48
|
+
|
|
49
|
+
// Latest-source refs (frame loop + reactive callbacks read these).
|
|
50
|
+
const lifecycleRef = useRef(options?.lifecycle);
|
|
51
|
+
lifecycleRef.current = options?.lifecycle;
|
|
52
|
+
const sessionRef = useRef(options?.sessionStatus);
|
|
53
|
+
sessionRef.current = options?.sessionStatus;
|
|
54
|
+
const manualReaderRef = useRef(options?.manualPaused);
|
|
55
|
+
manualReaderRef.current = options?.manualPaused;
|
|
56
|
+
const scheduleRef = useRef(options?.schedule ?? defaultSchedule);
|
|
57
|
+
const nowRef = useRef(options?.now ?? (() => Date.now()));
|
|
58
|
+
// Manual pause lives OUTSIDE render so the imperative setter is stable and
|
|
59
|
+
// reactive without depending on animation frames.
|
|
60
|
+
const manualPausedRef = useRef(false);
|
|
61
|
+
|
|
62
|
+
// Stable control ref owned by the effect (T15-TF2): the public setter and
|
|
63
|
+
// every pause transition route through this without capturing stale state.
|
|
64
|
+
const controlRef = useRef({
|
|
65
|
+
applyPause: () => {},
|
|
66
|
+
syncRegistry: () => {},
|
|
67
|
+
updateScheduling: () => {}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// T20F-R2: STABLE across re-renders — it reads only refs plus `system`, so
|
|
71
|
+
// the driver effect below keeps a single acquire/subscription for the
|
|
72
|
+
// lifetime of one system instead of rebinding on every parent render.
|
|
73
|
+
const applyCombinedPause = useCallback(() => {
|
|
74
|
+
if (system.status === 'disposed') return;
|
|
75
|
+
const session = lifecycleRef.current ? lifecycleRef.current.getStatus() : sessionRef.current?.() ?? 'running';
|
|
76
|
+
const effectivePaused = manualPausedRef.current || (manualReaderRef.current?.() ?? false) || session === 'paused' || session === 'disposed';
|
|
77
|
+
if (effectivePaused) system.pauseIfRunning();else system.resumeIfPaused();
|
|
78
|
+
}, [system]);
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
const driver = binding.acquireDriver();
|
|
81
|
+
let cancelled = false;
|
|
82
|
+
let cancelSchedule = null;
|
|
83
|
+
let last = nowRef.current();
|
|
84
|
+
const stopScheduling = () => {
|
|
85
|
+
if (cancelSchedule) {
|
|
86
|
+
cancelSchedule();
|
|
87
|
+
cancelSchedule = null;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
const startScheduling = () => {
|
|
91
|
+
if (cancelled || cancelSchedule !== null) return;
|
|
92
|
+
last = nowRef.current();
|
|
93
|
+
let canceller = null;
|
|
94
|
+
// The executed tick clears its own handle so the next frame may be
|
|
95
|
+
// scheduled from inside stepFrame (self-perpetuating loop).
|
|
96
|
+
canceller = scheduleRef.current(() => {
|
|
97
|
+
if (cancelSchedule === canceller) cancelSchedule = null;
|
|
98
|
+
stepFrame();
|
|
99
|
+
});
|
|
100
|
+
cancelSchedule = canceller ?? null;
|
|
101
|
+
};
|
|
102
|
+
const syncRegistry = () => {
|
|
103
|
+
if (binding.registryRevision !== registryRef.current.value.registryRevision) {
|
|
104
|
+
// Bounded transfer: only on membership changes (T15-SF1). Expiration
|
|
105
|
+
// bumps the revision too, so the terminal prune ships (T15-TF1).
|
|
106
|
+
registryRef.current.value = binding.buildUiRegistry();
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
const stepFrame = () => {
|
|
110
|
+
if (cancelled) return;
|
|
111
|
+
const now = nowRef.current();
|
|
112
|
+
const dt = Math.max(0, Math.min((now - last) / 1000, 0.1));
|
|
113
|
+
last = now;
|
|
114
|
+
applyCombinedPause();
|
|
115
|
+
driver.step(dt);
|
|
116
|
+
syncRegistry();
|
|
117
|
+
|
|
118
|
+
// ALWAYS publish the terminal scalar — including the step that
|
|
119
|
+
// transitions to zero actives, so renderers hide the expired record
|
|
120
|
+
// before we sleep (T15-TF1).
|
|
121
|
+
clockRef.current.value = binding.activeClock;
|
|
122
|
+
|
|
123
|
+
// T20L-R2: the frame path enforces the same running guard as the
|
|
124
|
+
// reactive path — a paused step cannot expire particles, so scheduling
|
|
125
|
+
// another frame while paused would spin the driver forever.
|
|
126
|
+
if (system.status === 'running' && !driver.isIdle()) {
|
|
127
|
+
startScheduling();
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
// Paused or idle: fully stop; resume transitions and emissions restart us.
|
|
131
|
+
stopScheduling();
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
// Effect-owned scheduling control (T15-TF2): pause transitions call this
|
|
135
|
+
// synchronously via the stable ref.
|
|
136
|
+
controlRef.current = {
|
|
137
|
+
applyPause: applyCombinedPause,
|
|
138
|
+
syncRegistry,
|
|
139
|
+
updateScheduling() {
|
|
140
|
+
applyCombinedPause();
|
|
141
|
+
syncRegistry();
|
|
142
|
+
if (cancelled || system.status === 'disposed') {
|
|
143
|
+
stopScheduling();
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
// Schedule only when running AND something is active.
|
|
147
|
+
if (system.status === 'running' && !driver.isIdle()) {
|
|
148
|
+
startScheduling();
|
|
149
|
+
} else {
|
|
150
|
+
stopScheduling();
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
// Reactive pause application + registry sync + reschedule.
|
|
156
|
+
driver.setWakeListener(() => controlRef.current.updateScheduling());
|
|
157
|
+
|
|
158
|
+
// Initial synchronous application at bind time.
|
|
159
|
+
applyCombinedPause();
|
|
160
|
+
stepFrame();
|
|
161
|
+
return () => {
|
|
162
|
+
cancelled = true;
|
|
163
|
+
driver.setWakeListener(null);
|
|
164
|
+
stopScheduling();
|
|
165
|
+
driver.release();
|
|
166
|
+
};
|
|
167
|
+
}, [system, binding, applyCombinedPause]);
|
|
168
|
+
|
|
169
|
+
// T20F-R2: the lifecycle subscription is keyed by the SOURCE identity, not
|
|
170
|
+
// by render — one subscribe/detach per system generation. Status changes
|
|
171
|
+
// route through the effect-owned control so pause transitions stay
|
|
172
|
+
// synchronous without rebinding the driver.
|
|
173
|
+
const lifecycleSource = options?.lifecycle ?? null;
|
|
174
|
+
const legacySubscribe = options?.sessionSubscribe ?? null;
|
|
175
|
+
useEffect(() => {
|
|
176
|
+
const onSessionStatus = status => {
|
|
177
|
+
sessionRef.current = () => status;
|
|
178
|
+
controlRef.current.updateScheduling();
|
|
179
|
+
};
|
|
180
|
+
const detach = lifecycleSource !== null ? lifecycleSource.subscribe(onSessionStatus) : legacySubscribe?.(onSessionStatus);
|
|
181
|
+
// T20F-R2 re-review: a REPLACED source may already be paused (or running)
|
|
182
|
+
// — apply its current status immediately instead of waiting for its next
|
|
183
|
+
// transition, so paused emissions are never accepted in between.
|
|
184
|
+
controlRef.current.updateScheduling();
|
|
185
|
+
return detach;
|
|
186
|
+
}, [lifecycleSource, legacySubscribe]);
|
|
187
|
+
|
|
188
|
+
// Initial registry transfer at bind time.
|
|
189
|
+
useEffect(() => {
|
|
190
|
+
registryRef.current.value = binding.buildUiRegistry();
|
|
191
|
+
}, [binding]);
|
|
192
|
+
const setManualPaused = useCallback(paused => {
|
|
193
|
+
manualPausedRef.current = paused;
|
|
194
|
+
// Route through the effect-owned control: applies combined sources AND
|
|
195
|
+
// stops/starts the scheduler immediately (T15-TF2).
|
|
196
|
+
controlRef.current.updateScheduling();
|
|
197
|
+
}, []);
|
|
198
|
+
return {
|
|
199
|
+
clock,
|
|
200
|
+
registry,
|
|
201
|
+
setManualPaused
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=useParticlePresentation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useEffect","useMemo","useRef","useSharedValue","EMPTY_REGISTRY","Object","freeze","registryRevision","activeClock","effects","defaultSchedule","tick","id","requestAnimationFrame","cancelAnimationFrame","useParticlePresentation","system","options","binding","bindPresentation","clock","registry","clockRef","registryRef","current","lifecycleRef","lifecycle","sessionRef","sessionStatus","manualReaderRef","manualPaused","scheduleRef","schedule","nowRef","now","Date","manualPausedRef","controlRef","applyPause","syncRegistry","updateScheduling","applyCombinedPause","status","session","getStatus","effectivePaused","pauseIfRunning","resumeIfPaused","driver","acquireDriver","cancelled","cancelSchedule","last","stopScheduling","startScheduling","canceller","stepFrame","value","buildUiRegistry","dt","Math","max","min","step","isIdle","setWakeListener","release","lifecycleSource","legacySubscribe","sessionSubscribe","onSessionStatus","detach","subscribe","setManualPaused","paused"],"sourceRoot":"../../../../src","sources":["react/particles/useParticlePresentation.ts"],"mappings":";;AAAA,S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,EAAE,CAAClD,MAAM,EAAEE,OAAO,EAAEuB,kBAAkB,CAAC,CAAC;;EAEzC;EACA;EACA;EACA;EACA,MAAM0B,eAAe,GAAGlD,OAAO,EAAES,SAAS,IAAI,IAAI;EAClD,MAAM0C,eAAe,GAAGnD,OAAO,EAAEoD,gBAAgB,IAAI,IAAI;EACzDrE,SAAS,CAAC,MAAM;IACd,MAAMsE,eAAe,GAAI5B,MAAqB,IAAW;MACvDf,UAAU,CAACH,OAAO,GAAG,MAAMkB,MAAM;MACjCL,UAAU,CAACb,OAAO,CAACgB,gBAAgB,CAAC,CAAC;IACvC,CAAC;IACD,MAAM+B,MAAM,GACVJ,eAAe,KAAK,IAAI,GACpBA,eAAe,CAACK,SAAS,CAACF,eAAe,CAAC,GAC1CF,eAAe,GAAGE,eAAe,CAAC;IACxC;IACA;IACA;IACAjC,UAAU,CAACb,OAAO,CAACgB,gBAAgB,CAAC,CAAC;IACrC,OAAO+B,MAAM;EACf,CAAC,EAAE,CAACJ,eAAe,EAAEC,eAAe,CAAC,CAAC;;EAEtC;EACApE,SAAS,CAAC,MAAM;IACduB,WAAW,CAACC,OAAO,CAACiC,KAAK,GAAGvC,OAAO,CAACwC,eAAe,CAAC,CAAC;EACvD,CAAC,EAAE,CAACxC,OAAO,CAAC,CAAC;EAEb,MAAMuD,eAAe,GAAG1E,WAAW,CAChC2E,MAAe,IAAW;IACzBtC,eAAe,CAACZ,OAAO,GAAGkD,MAAM;IAChC;IACA;IACArC,UAAU,CAACb,OAAO,CAACgB,gBAAgB,CAAC,CAAC;EACvC,CAAC,EACD,EACF,CAAC;EAED,OAAO;IAAEpB,KAAK;IAAEC,QAAQ;IAAEoD;EAAgB,CAAC;AAC7C","ignoreList":[]}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { logicalToWorld2D } from "../camera2d.js";
|
|
3
4
|
import { containsSurfacePoint, surfaceToWorld } from "../viewport2d/index.js";
|
|
5
|
+
/** One accepted surface -> world conversion with its exact inputs (T12-TF3). */
|
|
4
6
|
|
|
5
7
|
/**
|
|
6
8
|
* A coalesced pointer event stamped with the binding epoch it was scheduled
|
|
@@ -8,6 +10,12 @@ import { containsSurfacePoint, surfaceToWorld } from "../viewport2d/index.js";
|
|
|
8
10
|
* replacement carry the old epoch and are rejected on the RN runtime, so a
|
|
9
11
|
* stale begin cannot reacquire input with old coordinates and a stale
|
|
10
12
|
* terminal edge cannot release a newer capture that reused the pointer id.
|
|
13
|
+
*
|
|
14
|
+
* T12-F4: the packet also carries the presented camera cut sampled AT
|
|
15
|
+
* EVENT TIME on the UI runtime. JS inverts through that stamp — never a
|
|
16
|
+
* later lazy read — so the world coordinate matches the camera under the
|
|
17
|
+
* finger when the touch happened, even while the camera follows, zooms,
|
|
18
|
+
* rotates, or shakes.
|
|
11
19
|
*/
|
|
12
20
|
|
|
13
21
|
/** Monotonic generation source for factory-created bindings (F3). */
|
|
@@ -22,7 +30,7 @@ let nextFactoryGeneration = 1;
|
|
|
22
30
|
* it and create a fresh binding. Returns whether a new binding was created.
|
|
23
31
|
*/
|
|
24
32
|
export function createPointerBinding(identity, getViewport, previous) {
|
|
25
|
-
if (previous !== undefined && previous.identity.input === identity.input && previous.identity.action === identity.action && previous.identity.viewport === identity.viewport) {
|
|
33
|
+
if (previous !== undefined && previous.identity.input === identity.input && previous.identity.action === identity.action && previous.identity.viewport === identity.viewport && previous.identity.camera === identity.camera) {
|
|
26
34
|
return {
|
|
27
35
|
entry: previous,
|
|
28
36
|
created: false
|
|
@@ -44,9 +52,11 @@ export function createPointerBinding(identity, getViewport, previous) {
|
|
|
44
52
|
* Platform-neutral pointer binding seam.
|
|
45
53
|
*
|
|
46
54
|
* It converts gesture positions from surface coordinates into logical world
|
|
47
|
-
* coordinates through the current resolved viewport
|
|
55
|
+
* coordinates through the current resolved viewport (T12.4: and through the
|
|
56
|
+
* currently presented camera when the game has one), rejects begins that
|
|
48
57
|
* start in `fit` letterbox space, and forwards semantic events into the
|
|
49
|
-
* session input buffer.
|
|
58
|
+
* session input buffer. Containment always happens BEFORE camera inversion:
|
|
59
|
+
* letterbox space is rejected regardless of the camera. The high-level `handleTouches*` methods mirror the
|
|
50
60
|
* adapter's touch dispatch (including forwarding the final up position) so
|
|
51
61
|
* the full adapter behavior is testable without mounting native gesture
|
|
52
62
|
* views. Ownership and neutralization live in the input buffer.
|
|
@@ -55,15 +65,43 @@ export class PointerBinding {
|
|
|
55
65
|
#action;
|
|
56
66
|
#input;
|
|
57
67
|
#getViewport;
|
|
68
|
+
#onSample;
|
|
58
69
|
#generation;
|
|
59
70
|
#disposed = false;
|
|
60
|
-
constructor(action, input, getViewport, generation) {
|
|
71
|
+
constructor(action, input, getViewport, generation, onSample) {
|
|
61
72
|
this.#action = action;
|
|
62
73
|
this.#input = input;
|
|
63
74
|
this.#getViewport = getViewport;
|
|
75
|
+
this.#onSample = onSample;
|
|
64
76
|
this.#generation = generation;
|
|
65
77
|
}
|
|
66
78
|
|
|
79
|
+
/**
|
|
80
|
+
* Surface -> world through the viewport and the EVENT-TIME camera cut
|
|
81
|
+
* (T12.4, T12-F4).
|
|
82
|
+
*
|
|
83
|
+
* The frozen order: inverse viewport first, then inverse camera, using
|
|
84
|
+
* the camera stamp sampled by the UI worklet when the touch happened —
|
|
85
|
+
* the same camera the renderer drew at that moment. Without a camera
|
|
86
|
+
* stamp this is exactly `surfaceToWorld`.
|
|
87
|
+
*/
|
|
88
|
+
#toWorld(viewport, point, camera) {
|
|
89
|
+
const logical = surfaceToWorld(viewport, point);
|
|
90
|
+
const world = camera === undefined ? logical : logicalToWorld2D(logical, camera.camera, viewport.visibleLogicalBounds);
|
|
91
|
+
// T12-TF3: report one accepted conversion with its exact inputs and
|
|
92
|
+
// output — the lab measures the round trip from the real pipeline.
|
|
93
|
+
this.#onSample?.({
|
|
94
|
+
surface: {
|
|
95
|
+
x: point.x,
|
|
96
|
+
y: point.y
|
|
97
|
+
},
|
|
98
|
+
viewport,
|
|
99
|
+
camera,
|
|
100
|
+
world
|
|
101
|
+
});
|
|
102
|
+
return world;
|
|
103
|
+
}
|
|
104
|
+
|
|
67
105
|
/**
|
|
68
106
|
* The monotonic adapter-owned generation this binding belongs to (F3).
|
|
69
107
|
* Generations never reset to zero, so a replacement binding and the
|
|
@@ -89,13 +127,13 @@ export class PointerBinding {
|
|
|
89
127
|
}
|
|
90
128
|
switch (packet.kind) {
|
|
91
129
|
case 'begin':
|
|
92
|
-
this.handleTouchesDown(packet.pointerId, packet.x, packet.y);
|
|
130
|
+
this.handleTouchesDown(packet.pointerId, packet.x, packet.y, packet.camera);
|
|
93
131
|
break;
|
|
94
132
|
case 'move':
|
|
95
|
-
this.handleTouchesMove(packet.pointerId, packet.x, packet.y);
|
|
133
|
+
this.handleTouchesMove(packet.pointerId, packet.x, packet.y, packet.camera);
|
|
96
134
|
break;
|
|
97
135
|
case 'end':
|
|
98
|
-
this.handleTouchesUp(packet.pointerId, packet.x, packet.y);
|
|
136
|
+
this.handleTouchesUp(packet.pointerId, packet.x, packet.y, packet.camera);
|
|
99
137
|
break;
|
|
100
138
|
case 'cancel':
|
|
101
139
|
this.handleTouchesCancelled();
|
|
@@ -110,7 +148,7 @@ export class PointerBinding {
|
|
|
110
148
|
* Returns `false` when the layout is invalid or the point starts in
|
|
111
149
|
* letterbox space; the gesture must be rejected and never becomes the owner.
|
|
112
150
|
*/
|
|
113
|
-
begin(pointerId, surfacePoint) {
|
|
151
|
+
begin(pointerId, surfacePoint, camera) {
|
|
114
152
|
if (this.#disposed) {
|
|
115
153
|
return false;
|
|
116
154
|
}
|
|
@@ -121,12 +159,12 @@ export class PointerBinding {
|
|
|
121
159
|
if (!containsSurfacePoint(viewport, surfacePoint)) {
|
|
122
160
|
return false;
|
|
123
161
|
}
|
|
124
|
-
this.#input.begin(this.#action, pointerId,
|
|
162
|
+
this.#input.begin(this.#action, pointerId, this.#toWorld(viewport, surfacePoint, camera));
|
|
125
163
|
return true;
|
|
126
164
|
}
|
|
127
165
|
|
|
128
166
|
/** Move a pointer. Conversion remains unbounded outside content bounds. */
|
|
129
|
-
move(pointerId, surfacePoint) {
|
|
167
|
+
move(pointerId, surfacePoint, camera) {
|
|
130
168
|
if (this.#disposed) {
|
|
131
169
|
return;
|
|
132
170
|
}
|
|
@@ -134,7 +172,7 @@ export class PointerBinding {
|
|
|
134
172
|
if (viewport === undefined) {
|
|
135
173
|
return;
|
|
136
174
|
}
|
|
137
|
-
this.#input.move(this.#action, pointerId,
|
|
175
|
+
this.#input.move(this.#action, pointerId, this.#toWorld(viewport, surfacePoint, camera));
|
|
138
176
|
}
|
|
139
177
|
|
|
140
178
|
/** End a pointer. The owning pointer is released by the input buffer. */
|
|
@@ -154,19 +192,19 @@ export class PointerBinding {
|
|
|
154
192
|
}
|
|
155
193
|
|
|
156
194
|
/** Handle a touch-down gesture event with a surface position. */
|
|
157
|
-
handleTouchesDown(pointerId, x, y) {
|
|
195
|
+
handleTouchesDown(pointerId, x, y, camera) {
|
|
158
196
|
return this.begin(pointerId, {
|
|
159
197
|
x,
|
|
160
198
|
y
|
|
161
|
-
});
|
|
199
|
+
}, camera);
|
|
162
200
|
}
|
|
163
201
|
|
|
164
202
|
/** Handle a touch-move gesture event with a surface position. */
|
|
165
|
-
handleTouchesMove(pointerId, x, y) {
|
|
203
|
+
handleTouchesMove(pointerId, x, y, camera) {
|
|
166
204
|
this.move(pointerId, {
|
|
167
205
|
x,
|
|
168
206
|
y
|
|
169
|
-
});
|
|
207
|
+
}, camera);
|
|
170
208
|
}
|
|
171
209
|
|
|
172
210
|
/**
|
|
@@ -175,11 +213,11 @@ export class PointerBinding {
|
|
|
175
213
|
* The final position is forwarded before ownership ends so the documented
|
|
176
214
|
* release frame contains the actual point where the pointer lifted.
|
|
177
215
|
*/
|
|
178
|
-
handleTouchesUp(pointerId, x, y) {
|
|
216
|
+
handleTouchesUp(pointerId, x, y, camera) {
|
|
179
217
|
this.move(pointerId, {
|
|
180
218
|
x,
|
|
181
219
|
y
|
|
182
|
-
});
|
|
220
|
+
}, camera);
|
|
183
221
|
this.end(pointerId);
|
|
184
222
|
}
|
|
185
223
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["containsSurfacePoint","surfaceToWorld","nextFactoryGeneration","createPointerBinding","identity","getViewport","previous","undefined","input","action","viewport","entry","created","binding","dispose","PointerBinding","generation","disposed","constructor","
|
|
1
|
+
{"version":3,"names":["logicalToWorld2D","containsSurfacePoint","surfaceToWorld","nextFactoryGeneration","createPointerBinding","identity","getViewport","previous","undefined","input","action","viewport","camera","entry","created","binding","dispose","PointerBinding","onSample","generation","disposed","constructor","toWorld","#toWorld","point","logical","world","visibleLogicalBounds","surface","x","y","dispatch","packet","kind","handleTouchesDown","pointerId","handleTouchesMove","handleTouchesUp","handleTouchesCancelled","begin","surfacePoint","move","end","cancel"],"sourceRoot":"../../../src","sources":["react/pointerBinding.ts"],"mappings":";;AACA,SAASA,gBAAgB,QAAQ,gBAAa;AAG9C,SAASC,oBAAoB,EAAEC,cAAc,QAAiC,wBAAe;AAC7F;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAcA;AACA,IAAIC,qBAAqB,GAAG,CAAC;;AAE7B;;AAgBA;;AAMA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAClCC,QAAuC,EACvCC,WAAiD,EACjDC,QAAgD,EAC2B;EAC3E,IACEA,QAAQ,KAAKC,SAAS,IACtBD,QAAQ,CAACF,QAAQ,CAACI,KAAK,KAAKJ,QAAQ,CAACI,KAAK,IAC1CF,QAAQ,CAACF,QAAQ,CAACK,MAAM,KAAKL,QAAQ,CAACK,MAAM,IAC5CH,QAAQ,CAACF,QAAQ,CAACM,QAAQ,KAAKN,QAAQ,CAACM,QAAQ,IAChDJ,QAAQ,CAACF,QAAQ,CAACO,MAAM,KAAKP,QAAQ,CAACO,MAAM,EAC5C;IACA,OAAO;MAAEC,KAAK,EAAEN,Q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AClC;;EAEA;EACAwB,iBAAiBA,CAACC,SAAiB,EAAEN,CAAS,EAAEC,CAAS,EAAElB,MAAoB,EAAW;IACxF,OAAO,IAAI,CAAC2B,KAAK,CAACJ,SAAS,EAAE;MAAEN,CAAC;MAAEC;IAAE,CAAC,EAAElB,MAAM,CAAC;EAChD;;EAEA;EACAwB,iBAAiBA,CAACD,SAAiB,EAAEN,CAAS,EAAEC,CAAS,EAAElB,MAAoB,EAAQ;IACrF,IAAI,CAAC6B,IAAI,CAACN,SAAS,EAAE;MAAEN,CAAC;MAAEC;IAAE,CAAC,EAAElB,MAAM,CAAC;EACxC;;EAEA;AACF;AACA;AACA;AACA;AACA;EACEyB,eAAeA,CAACF,SAAiB,EAAEN,CAAS,EAAEC,CAAS,EAAElB,MAAoB,EAAQ;IACnF,IAAI,CAAC6B,IAAI,CAACN,SAAS,EAAE;MAAEN,CAAC;MAAEC;IAAE,CAAC,EAAElB,MAAM,CAAC;IACtC,IAAI,CAAC8B,GAAG,CAACP,SAAS,CAAC;EACrB;;EAEA;EACAG,sBAAsBA,CAAA,EAAS;IAC7B,IAAI,CAACK,MAAM,CAAC,CAAC;EACf;;EAEA;EACA3B,OAAOA,CAAA,EAAS;IACd,IAAI,CAAC,CAACI,QAAQ,GAAG,IAAI;EACvB;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Event-time camera selection for pointer packets (T12-SF1, T12-TF1).
|
|
5
|
+
*
|
|
6
|
+
* Internal module (not part of the public barrel): the ONE rule that pairs
|
|
7
|
+
* a forwarded pointer event with the presented camera at the event's own
|
|
8
|
+
* native sample. `GamePointerInput` and the focused tests import the same
|
|
9
|
+
* function, so the test can never drift from production.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** A move's explicit capture: `captured: true` even when the value is
|
|
13
|
+
* undefined, so a captured-undefined camera is distinguishable from "no
|
|
14
|
+
* stamp" and never falls back to a later presentation (T12-SF1). */
|
|
15
|
+
|
|
16
|
+
/** The event-time camera for one forwarded event (worklet-safe). */
|
|
17
|
+
export function packetCameraFor(forwarded, presented) {
|
|
18
|
+
'worklet';
|
|
19
|
+
|
|
20
|
+
if (forwarded.kind === 'move') {
|
|
21
|
+
const stamp = forwarded.stamp;
|
|
22
|
+
// A move ALWAYS carries its capture (possibly undefined): a captured
|
|
23
|
+
// undefined stays undefined — never fall back to a later camera.
|
|
24
|
+
return stamp !== undefined ? stamp.value : presented;
|
|
25
|
+
}
|
|
26
|
+
return presented;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=pointerCamera.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["packetCameraFor","forwarded","presented","kind","stamp","undefined","value"],"sourceRoot":"../../../src","sources":["react/pointerCamera.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;;AAMA;AACA,OAAO,SAASA,eAAeA,CAC7BC,SAAgC,EAChCC,SAAkC,EACT;EACzB,SAAS;;EACT,IAAID,SAAS,CAACE,IAAI,KAAK,MAAM,EAAE;IAC7B,MAAMC,KAAK,GAAGH,SAAS,CAACG,KAA2C;IACnE;IACA;IACA,OAAOA,KAAK,KAAKC,SAAS,GAAGD,KAAK,CAACE,KAAK,GAAGJ,SAAS;EACtD;EACA,OAAOA,SAAS;AAClB","ignoreList":[]}
|
|
@@ -124,7 +124,8 @@ export function reducePointerCoalescer(state, input) {
|
|
|
124
124
|
kind: 'move',
|
|
125
125
|
pointerId: active.pointerId,
|
|
126
126
|
x: active.pendingMove.x,
|
|
127
|
-
y: active.pendingMove.y
|
|
127
|
+
y: active.pendingMove.y,
|
|
128
|
+
stamp: active.pendingMove.stamp
|
|
128
129
|
}]
|
|
129
130
|
};
|
|
130
131
|
}
|
|
@@ -149,13 +150,18 @@ export function reducePointerCoalescer(state, input) {
|
|
|
149
150
|
}]
|
|
150
151
|
};
|
|
151
152
|
}
|
|
152
|
-
|
|
153
|
+
|
|
154
|
+
// The remaining branch is the move input (down/up/cancel/flush/reset
|
|
155
|
+
// returned above); its optional stamp rides with the sample.
|
|
156
|
+
const moveInput = input;
|
|
157
|
+
const shouldForward = moveInput.nowMs - active.lastForwardMs >= state.maxMoveIntervalMs;
|
|
153
158
|
const nextActive = {
|
|
154
|
-
pointerId:
|
|
155
|
-
lastForwardMs: shouldForward ?
|
|
159
|
+
pointerId: moveInput.pointerId,
|
|
160
|
+
lastForwardMs: shouldForward ? moveInput.nowMs : active.lastForwardMs,
|
|
156
161
|
pendingMove: shouldForward ? undefined : {
|
|
157
|
-
x:
|
|
158
|
-
y:
|
|
162
|
+
x: moveInput.x,
|
|
163
|
+
y: moveInput.y,
|
|
164
|
+
stamp: moveInput.stamp
|
|
159
165
|
}
|
|
160
166
|
};
|
|
161
167
|
return {
|
|
@@ -165,9 +171,10 @@ export function reducePointerCoalescer(state, input) {
|
|
|
165
171
|
},
|
|
166
172
|
events: shouldForward ? [{
|
|
167
173
|
kind: 'move',
|
|
168
|
-
pointerId:
|
|
169
|
-
x:
|
|
170
|
-
y:
|
|
174
|
+
pointerId: moveInput.pointerId,
|
|
175
|
+
x: moveInput.x,
|
|
176
|
+
y: moveInput.y,
|
|
177
|
+
stamp: moveInput.stamp
|
|
171
178
|
}] : []
|
|
172
179
|
};
|
|
173
180
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createPointerCoalescerState","maxMoveIntervalMs","active","undefined","reducePointerCoalescer","state","input","kind","events","pointerId","lastForwardMs","nowMs","pendingMove","x","y","shouldForward","nextActive","createPointerCoalescer","dispatch","transition","coalescer","down","move","flush","up","cancel","reset","Object","freeze"],"sourceRoot":"../../../src","sources":["react/pointerCoalescer.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;
|
|
1
|
+
{"version":3,"names":["createPointerCoalescerState","maxMoveIntervalMs","active","undefined","reducePointerCoalescer","state","input","kind","events","pointerId","lastForwardMs","nowMs","pendingMove","x","y","stamp","moveInput","shouldForward","nextActive","createPointerCoalescer","dispatch","transition","coalescer","down","move","flush","up","cancel","reset","Object","freeze"],"sourceRoot":"../../../src","sources":["react/pointerCoalescer.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA2CA;;AAMA;;AAsBA;;AAMA;AACA,OAAO,SAASA,2BAA2BA,CACzCC,iBAAyB,EACF;EACvB,SAAS;;EACT,OAAO;IAAEA,iBAAiB;IAAEC,MAAM,EAAEC;EAAU,CAAC;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,CACpCC,KAA4B,EAC5BC,KAA4B,EACA;EAC5B,SAAS;;EACT,IAAIA,KAAK,CAACC,IAAI,KAAK,OAAO,EAAE;IAC1B,OAAO;MAAEF,KAAK,EAAEL,2BAA2B,CAACK,KAAK,CAACJ,iBAAiB,CAAC;MAAEO,MAAM,EAAE;IAAG,CAAC;EACpF;EAEA,IAAIF,KAAK,CAACC,IAAI,KAAK,MAAM,EAAE;IACzB,IAAIF,KAAK,CAACH,MAAM,KAAKC,SAAS,EAAE;MAC9B,OAAO;QAAEE,KAAK;QAAEG,MAAM,EAAE;MAAG,CAAC;IAC9B;IACA,OAAO;MACLH,KAAK,EAAE;QACL,GAAGA,KAAK;QACRH,MAAM,EAAE;UACNO,SAAS,EAAEH,KAAK,CAACG,SAAS;UAC1BC,aAAa,EAAEJ,KAAK,CAACK,KAAK;UAC1BC,WAAW,EAAET;QACf;MACF,CAAC;MACDK,MAAM,EAAE,CACN;QACED,IAAI,EAAE,OAAO;QACbE,SAAS,EAAEH,KAAK,CAACG,SAAS;QAC1BI,CAAC,E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sB,MAAM,CAACC,MAAM,CAACR,SAAS,CAAC;AACjC","ignoreList":[]}
|
|
@@ -10,29 +10,17 @@
|
|
|
10
10
|
* snapshot without casts.
|
|
11
11
|
*/
|
|
12
12
|
import { useDerivedValue } from 'react-native-reanimated';
|
|
13
|
+
import { spriteFrameNameForClip } from "../../sprites/sampleSpriteClip.js";
|
|
13
14
|
import { Sprite } from "./Sprite.js";
|
|
14
15
|
|
|
16
|
+
/** Re-exported from the single sampler contract (GS-ANIMATION-01). */
|
|
17
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
|
+
export { spriteFrameNameForClip };
|
|
19
|
+
|
|
15
20
|
/** Interpolation context for the select mapper. */
|
|
16
21
|
|
|
17
22
|
/** The discrete + interpolated presentation selection. */
|
|
18
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
|
-
/**
|
|
20
|
-
* Select the frame name for a clip + elapsed time (loop/once semantics).
|
|
21
|
-
* Reads the descriptor's animation table; the result is resolved against
|
|
22
|
-
* the frame rectangles by the caller. Reuses the pure sampler's semantics.
|
|
23
|
-
*/
|
|
24
|
-
export function spriteFrameNameForClip(animations, clip, elapsedMs) {
|
|
25
|
-
'worklet';
|
|
26
23
|
|
|
27
|
-
const animation = animations[clip];
|
|
28
|
-
if (animation === undefined || animation.frames.length === 0) {
|
|
29
|
-
return clip;
|
|
30
|
-
}
|
|
31
|
-
const duration = animation.frameDurationMs;
|
|
32
|
-
const count = animation.frames.length;
|
|
33
|
-
const index = animation.mode === 'once' ? Math.min(Math.floor(elapsedMs / duration), count - 1) : Math.floor(elapsedMs / duration) % count;
|
|
34
|
-
return animation.frames[index] ?? animation.frames[0] ?? clip;
|
|
35
|
-
}
|
|
36
24
|
export function GameSprite({
|
|
37
25
|
scene,
|
|
38
26
|
commit,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useDerivedValue","
|
|
1
|
+
{"version":3,"names":["useDerivedValue","spriteFrameNameForClip","Sprite","jsx","_jsx","GameSprite","scene","commit","alpha","source","anchor","select","selection","envelope","value","undefined","current","context","previous","x","y","rotation","scale","opacity","flipX","flipY","visible","frameName","selectionValue","frame","clip","descriptor","kind","sheet","animations","elapsedMs","animated","props"],"sourceRoot":"../../../../src","sources":["react/sprites/GameSprite.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,eAAe,QAA0B,yBAAyB;AAM3E,SAASC,sBAAsB,QAAQ,mCAAgC;AACvE,SAASC,MAAM,QAA+E,aAAU;;AAExG;AAAA,SAAAC,GAAA,IAAAC,IAAA;AACA,SAASH,sBAAsB;;AAE/B;;AAaA;;AA0CA,OAAO,SAASI,UAAUA,CAGxB;EACAC,KAAK;EACLC,MAAM;EACNC,KAAK;EACLC,MAAM;EACNC,MAAM;EACNC;AACoC,CAAC,EAAE;EACvC,MAAMC,SAAS,GAAGZ,eAAe,CAAC,MAAM;IACtC,SAAS;;IACT,MAAMa,QAAQ,GAAGN,MAAM,CAACO,KAAK;IAC7B,IAAID,QAAQ,CAACP,KAAK,KAAKA,KAAK,EAAE;MAC5B,OAAOS,SAAS;IAClB;IACA,MAAMC,OAAO,GAAGH,QAAQ,CAACG,OAAsD;IAC/E,IAAIA,OAAO,KAAKD,SAAS,EAAE;MACzB;MACA;MACA,OAAOA,SAAS;IAClB;IACA,MAAME,OAAO,GAAG;MACd;MACA;MACAC,QAAQ,EACLL,QAAQ,CAACK,QAAQ,IAAIL,QAAQ,CAACG,OAAuD;MACxFA,OAAO;MACPR,KAAK,EAAEA,KAAK,CAACM;IACf,CAAiD;IACjD,OAAOH,MAAM,CAACM,OAAO,CAAC;EACxB,CAAC,EAAE,CAACV,MAAM,EAAEC,KAAK,EAAEF,KAAK,EAAEK,MAAM,CAAC,CAAC;EAElC,MAAMQ,CAAC,GAAGnB,eAAe,CAAC,MAAMY,SAAS,CAACE,KAAK,EAAEK,CAAC,IAAI,CAAC,CAAC;EACxD,MAAMC,CAAC,GAAGpB,e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