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
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,81 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to React Native GameKit will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## Unreleased
|
|
6
|
+
|
|
7
|
+
No changes yet.
|
|
8
|
+
|
|
9
|
+
## 0.2.1 - 2026-09-27
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- Validated native-peer floors track the current SDK 57 line: `expo ~57.0.25`, `expo-asset ~57.0.18`, `react-native ~0.86.3`, and `@react-native-async-storage/async-storage ^2.2.0`. No runtime changes; behavior is identical to 0.2.0.
|
|
14
|
+
- Skia (`2.11.0`), Gesture Handler (`~3.1.0`), Reanimated (`4.5.3`), and Worklets (`0.10.3`) remain intentionally ahead of the SDK 57 template — consuming apps exclude them via `expo.install.exclude` (see Installation).
|
|
15
|
+
|
|
16
|
+
## 0.2.0 - 2026-09-27
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- Package entry points normalized: `rn-gamekit/geometry`, `rn-gamekit/collision2d`, `rn-gamekit/camera2d`, `rn-gamekit/events`, `rn-gamekit/assets`, and `rn-gamekit/sprites` are now explicit subpaths of the single `rn-gamekit` package (one version, one tarball, `exports` map). Existing `import { … } from 'rn-gamekit'` compatibility re-exports remain and reference the same symbols (`===` / `instanceof` preserved); the new subpaths are the preferred organization (additive, no breaking change). Headless subpaths import no React/Skia/native peers.
|
|
21
|
+
- `useGameSession(definition)` from `rn-gamekit/react`: React-owned session
|
|
22
|
+
creation and terminal disposal, safe under Strict Mode, with exact
|
|
23
|
+
scene/input type inference from the game definition.
|
|
24
|
+
- Observable pause/resume lifecycle: `GameSession.addStatusListener()` with
|
|
25
|
+
queued, snapshot-delivered notifications, and `useGameSessionStatus()`
|
|
26
|
+
from `rn-gamekit/react`.
|
|
27
|
+
- Paused-input policy: gameplay input is cancelled on pause and rejected
|
|
28
|
+
while paused at the shared session/input boundary (never replayed).
|
|
29
|
+
- `GameView` presentation follows core status; app backgrounding pauses and
|
|
30
|
+
foregrounding resumes only the lifecycle-owned pause, and an external
|
|
31
|
+
start while inactive is returned to paused.
|
|
32
|
+
- `GameButtonPad` and `GameButton` provide multi-touch-safe button controls
|
|
33
|
+
through the same semantic input boundary as pointer input.
|
|
34
|
+
- Collision2D: canonical 2D geometry (`Aabb2D`, `Circle2D`, `Segment2D`,
|
|
35
|
+
`Vector2D`), static predicates and contact manifolds, swept circle-AABB and
|
|
36
|
+
AABB-AABB queries, segment crossings, symmetric category/mask filtering,
|
|
37
|
+
local/world collider records with typed placement, a deterministic spatial
|
|
38
|
+
hash broad phase, and headless debug projections.
|
|
39
|
+
- Camera2D: one presented camera owned by `GameView` that drives rendering
|
|
40
|
+
and pointer input through the same generation, headless helpers for follow
|
|
41
|
+
behavior, clamped bounds, deterministic shake, interpolation, visibility
|
|
42
|
+
culling, and parallax layers via `GameLayer2D`.
|
|
43
|
+
- Typed game events: `defineGameEvents` / `gameEvent` declarations, typed
|
|
44
|
+
envelopes with payload limits, deterministic seeding, and an update-scoped
|
|
45
|
+
emitter on every scene update.
|
|
46
|
+
- Particles: headless `defineParticleEffect` / `createParticleSystem`
|
|
47
|
+
simulation with presentation-only Skia rendering (`ParticleView`,
|
|
48
|
+
`useParticlePresentation`) and camera-aware culling.
|
|
49
|
+
- Audio (opt-in `rn-gamekit/audio`): `createGameAudio` with one shared
|
|
50
|
+
`AudioContext`, fixed category gains, fire-and-forget SFX, and a single
|
|
51
|
+
music channel.
|
|
52
|
+
- Haptics (opt-in `rn-gamekit/haptics`): `createGameHaptics` with bounded
|
|
53
|
+
presets over Pulsar, mute, capability checks, and rate limits.
|
|
54
|
+
- Tilemaps: `defineTileSet2D` / `defineTileLayer2D` / `defineTileMap2D` with chunked storage, `movePlatformerBody2D` tunable platformer resolver, `TileMapLayer2D` atlas rendering with culling, and Tiled JSON adapter.
|
|
55
|
+
- Versioned storage (opt-in `rn-gamekit/storage`): `defineGameSave` / `createGameSaveStore` with `createMemoryStorageAdapter` and optional `createGameStorageAdapter` (`@react-native-async-storage/async-storage@2.1.2`), envelope `rn-gamekit.save`, per-slot serialized queue, `flush()` / `dispose()`, migrations, bounded plain-data serialization (256 KiB, depth 16), and explicit `GameStorageError` codes.
|
|
56
|
+
|
|
57
|
+
### Changed
|
|
58
|
+
|
|
59
|
+
- Pausing a session now cancels active gameplay input and rejects new input
|
|
60
|
+
until the session resumes. Paused input is never replayed.
|
|
61
|
+
- Running scene transitions now commit on the next frame-driver callback,
|
|
62
|
+
even when no fixed simulation step is due. The new scene first updates on
|
|
63
|
+
the next due fixed step.
|
|
64
|
+
- Scene snapshots now accept only bounded plain records, arrays, and scalar
|
|
65
|
+
values. Unsupported mutable or executable values fail before publication
|
|
66
|
+
with a path-aware `SnapshotDomainError`.
|
|
67
|
+
- Asset, sprite, session, lifecycle, particle, tilemap, audio, haptics, and
|
|
68
|
+
storage ownership paths now fail closed and clean up accepted work exactly
|
|
69
|
+
once.
|
|
70
|
+
|
|
71
|
+
### Dependencies
|
|
72
|
+
|
|
73
|
+
- Replaced the unused `expo-audio` and `expo-haptics` peer declarations with
|
|
74
|
+
optional `react-native-audio-api` and `react-native-pulsar` peers.
|
|
75
|
+
- Added optional `@react-native-async-storage/async-storage` support for the
|
|
76
|
+
persistent storage adapter.
|
|
77
|
+
- Removed `react-native-safe-area-context` from the package peer requirements;
|
|
78
|
+
applications can still install it for their own HUD and screen layouts.
|
|
79
|
+
|
|
5
80
|
## 0.1.0 - 2026-08-12
|
|
6
81
|
|
|
7
82
|
First public preview.
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
A headless-first 2D game toolkit for React Native and Expo, built for phones
|
|
4
4
|
and tablets.
|
|
5
5
|
|
|
6
|
-
> **0.
|
|
6
|
+
> **0.2 preview:** React Native GameKit is usable for small 2D games and
|
|
7
7
|
> prototypes, but its API may change before 1.0.
|
|
8
8
|
|
|
9
9
|
## What is included
|
|
@@ -15,17 +15,20 @@ and tablets.
|
|
|
15
15
|
- React Native Skia rendering with Reanimated interpolation;
|
|
16
16
|
- typed local images, sprite sheets, animation clips, and asset loading;
|
|
17
17
|
- retained sprites and Atlas-backed sprite batching;
|
|
18
|
+
- geometry, Collision2D, Camera2D, and deterministic game events;
|
|
19
|
+
- bounded particles, tilemaps, and platformer movement helpers;
|
|
20
|
+
- opt-in audio, haptics, and versioned storage;
|
|
18
21
|
- a native-free root entry for headless tests.
|
|
19
22
|
|
|
20
23
|
## Requirements
|
|
21
24
|
|
|
22
|
-
Version 0.
|
|
25
|
+
Version 0.2 targets the Expo SDK 57 compatibility set:
|
|
23
26
|
|
|
24
27
|
| Package | Supported version |
|
|
25
28
|
| --- | --- |
|
|
26
|
-
| React Native | `~0.86.
|
|
29
|
+
| React Native | `~0.86.3` |
|
|
27
30
|
| React | `^19.2.3` |
|
|
28
|
-
| Expo | `~57.0.
|
|
31
|
+
| Expo | `~57.0.25` |
|
|
29
32
|
| React Native Skia | `2.11.0` |
|
|
30
33
|
| Gesture Handler | `~3.1.0` |
|
|
31
34
|
| Reanimated | `4.5.3` |
|
|
@@ -42,6 +45,19 @@ npx expo install expo-asset @shopify/react-native-skia react-native-gesture-hand
|
|
|
42
45
|
npx expo prebuild
|
|
43
46
|
```
|
|
44
47
|
|
|
48
|
+
Install optional native peers only for the systems you use:
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
# rn-gamekit/audio
|
|
52
|
+
npx expo install react-native-audio-api@0.13.3
|
|
53
|
+
|
|
54
|
+
# rn-gamekit/haptics
|
|
55
|
+
npx expo install react-native-pulsar@1.7.0
|
|
56
|
+
|
|
57
|
+
# Persistent rn-gamekit/storage adapter
|
|
58
|
+
npx expo install @react-native-async-storage/async-storage@2.2.0
|
|
59
|
+
```
|
|
60
|
+
|
|
45
61
|
Wrap the application with Gesture Handler's root view:
|
|
46
62
|
|
|
47
63
|
```tsx
|
|
@@ -97,24 +113,79 @@ const session = createGameSession(game);
|
|
|
97
113
|
session.start();
|
|
98
114
|
```
|
|
99
115
|
|
|
100
|
-
|
|
116
|
+
In React, own the session with `useGameSession` and hand it to the native
|
|
117
|
+
entry point:
|
|
101
118
|
|
|
102
119
|
```tsx
|
|
103
120
|
import {
|
|
104
121
|
GamePointerInput,
|
|
105
122
|
GameView,
|
|
123
|
+
useGameSession,
|
|
106
124
|
} from 'rn-gamekit/react';
|
|
107
125
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
126
|
+
function GameScreen() {
|
|
127
|
+
const session = useGameSession(game);
|
|
128
|
+
|
|
129
|
+
if (session === undefined) {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return (
|
|
134
|
+
<GameView game={session} renderer={GameRenderer}>
|
|
135
|
+
<GamePointerInput game={session} action="move" />
|
|
136
|
+
</GameView>
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
The hook creates the session, disposes it exactly once on replacement or
|
|
142
|
+
unmount, and is safe under Strict Mode. `GameView` borrows the session: it
|
|
143
|
+
starts it while mounted, pauses it on unmount and backgrounding, and never
|
|
144
|
+
disposes it. For headless tests and non-React owners, keep the imperative
|
|
145
|
+
`createGameSession()` / `try/finally dispose()` path shown above.
|
|
146
|
+
|
|
147
|
+
Pause and resume are the same commands everywhere: `session.pause()` freezes
|
|
148
|
+
the simulation and holds the last frame, `session.start()` resumes with a
|
|
149
|
+
fresh clock baseline, gameplay input is cancelled and rejected while paused,
|
|
150
|
+
and `useGameSessionStatus(session)` drives pause UI without a second state
|
|
151
|
+
source.
|
|
152
|
+
|
|
153
|
+
`rn-gamekit` is one npm package. Paths like `rn-gamekit/collision2d` are
|
|
154
|
+
package export subpaths. They aren't separately versioned or published; they
|
|
155
|
+
share the same version, peer policy, exports map, and tarball.
|
|
156
|
+
|
|
157
|
+
### Entry points (one package, one install)
|
|
158
|
+
|
|
159
|
+
| Entry point | What lives there | Must not load |
|
|
160
|
+
| --- | --- | --- |
|
|
161
|
+
| `rn-gamekit` | Game & scene definitions, session creation, viewport contracts, and compatibility re-exports for all headless systems | — |
|
|
162
|
+
| `rn-gamekit/geometry` | Points, vectors, AABBs, circles, segments, immutable geometry helpers, `GeometryError` | React / Skia / native peers |
|
|
163
|
+
| `rn-gamekit/collision2d` | Predicates, manifolds, sweeps, filters, colliders, spatial hash, debug projections | React / Skia / physics backends |
|
|
164
|
+
| `rn-gamekit/camera2d` | Pure camera values, transforms, follow, clamp, shake, interpolation, visibility | React hooks / Skia / Reanimated |
|
|
165
|
+
| `rn-gamekit/events` | `defineGameEvents` / `gameEvent`, envelopes, `PAYLOAD_LIMITS`, `seedGameEvent`, `GameEventError` | Effect consumers / React / native peers |
|
|
166
|
+
| `rn-gamekit/assets` | `defineAssets` / `image` / `spriteSheet`, descriptor & loaded-value types, `GameAssetError` | React hooks / Skia decoding / Expo Asset |
|
|
167
|
+
| `rn-gamekit/sprites` | `sampleSpriteClip*` & playback-state helpers (`start/advance/…SpriteAnimation`) | React components / Skia Atlas |
|
|
168
|
+
| `rn-gamekit/storage` | Versioned settings and save projections (`defineGameSave`, `createGameSaveStore`, `createMemoryStorageAdapter` / `createGameStorageAdapter`, `GameStorageError`, `STORAGE_LIMITS`) | React / Skia / native peers except optional `async-storage` peer |
|
|
169
|
+
| `rn-gamekit/react` | `GameView`, `GameWorld2D`, `Sprite`, `GameSprite`, `SpriteBatch`, `defineGameCamera2D`, asset/particle/tilemap rendering, pointer input, hooks | — |
|
|
170
|
+
| `rn-gamekit/audio` · `rn-gamekit/haptics` · `rn-gamekit/particles` · `rn-gamekit/tilemap` | Audio, haptics, particle effects, tilemaps (existing ownership) | — |
|
|
171
|
+
| `rn-gamekit/testing` | Deterministic frame drivers for Node tests (test-only, never production) | — |
|
|
172
|
+
|
|
173
|
+
Headless entries (`geometry`, `collision2d`, `camera2d`, `events`, `assets`, `sprites`, `storage`) import no React, React Native, Skia, Reanimated, Worklets, Expo Asset, or optional native peers. `rn-gamekit/react` is the only entry that loads Skia/Reanimated/Gesture Handler.
|
|
174
|
+
|
|
175
|
+
**Preferred imports (new code):**
|
|
176
|
+
|
|
177
|
+
```ts
|
|
178
|
+
import type { Aabb2D } from 'rn-gamekit/geometry';
|
|
179
|
+
import { collideCircleAabb2D } from 'rn-gamekit/collision2d';
|
|
180
|
+
import { createCamera2D } from 'rn-gamekit/camera2d';
|
|
181
|
+
import { defineGameEvents, gameEvent } from 'rn-gamekit/events';
|
|
182
|
+
import { defineAssets, image, spriteSheet } from 'rn-gamekit/assets';
|
|
183
|
+
import { sampleSpriteClipFrame, startSpriteAnimation } from 'rn-gamekit/sprites';
|
|
184
|
+
import { createGameSaveStore, defineGameSave } from 'rn-gamekit/storage';
|
|
185
|
+
import { GameView, GameWorld2D, Sprite } from 'rn-gamekit/react';
|
|
111
186
|
```
|
|
112
187
|
|
|
113
|
-
`rn-gamekit`
|
|
114
|
-
asset-manifest, and animation APIs. `rn-gamekit/react` contains the
|
|
115
|
-
Skia renderer, native pointer adapter, asset loader, sprites, and sprite
|
|
116
|
-
batching. `rn-gamekit/testing` contains deterministic frame drivers
|
|
117
|
-
for Node tests.
|
|
188
|
+
**Compatibility:** `import { collideCircleAabb2D } from 'rn-gamekit'` and other existing root imports continue to work. Root and subpath exports reference the same underlying symbols (`===` and `instanceof` preserved, no duplicate state). No deprecation or removal is announced in this release — the new subpaths are the preferred organization, not a breaking change.
|
|
118
189
|
|
|
119
190
|
See the [repository documentation](https://github.com/OrekuD/react-native-gamekit/tree/main/apps/docs/content/docs)
|
|
120
191
|
and [Expo playground](https://github.com/OrekuD/react-native-gamekit/tree/main/apps/playground)
|
|
@@ -122,10 +193,20 @@ for complete examples.
|
|
|
122
193
|
|
|
123
194
|
## Current scope
|
|
124
195
|
|
|
125
|
-
The 0.
|
|
126
|
-
|
|
127
|
-
|
|
196
|
+
The 0.2 release focuses on performant 2D foundations and the core systems
|
|
197
|
+
needed by small games. Physics simulation and 3D rendering aren't part of the
|
|
198
|
+
public package. Tilemaps, audio, haptics, events, particles, and versioned
|
|
199
|
+
storage are included.
|
|
128
200
|
|
|
129
201
|
## License
|
|
130
202
|
|
|
131
203
|
MIT
|
|
204
|
+
|
|
205
|
+
## Credits
|
|
206
|
+
|
|
207
|
+
The playground demo games use third-party asset packs (not part of the `rn-gamekit` package). Follow each pack's license terms if you redistribute them:
|
|
208
|
+
|
|
209
|
+
- [Mossy Cavern](https://maaot.itch.io/mossy-cavern) by maaot
|
|
210
|
+
- [Pixel Adventure 1](https://pixelfrog-assets.itch.io/pixel-adventure-1) by Pixel Frog
|
|
211
|
+
- [Brackeys' Platformer Bundle](https://brackeysgames.itch.io/brackeys-platformer-bundle) by Brackeys Games
|
|
212
|
+
- [Mixkit Game Sound Effects](https://mixkit.co/free-sound-effects/game/) — free SFX for the audio demos (see [mixkit.co/license](https://mixkit.co/license/))
|
|
@@ -6,6 +6,14 @@
|
|
|
6
6
|
* `image(...)` and `spriteSheet(...)` build immutable descriptors;
|
|
7
7
|
* `defineAssets(...)` groups them into a deeply immutable typed manifest.
|
|
8
8
|
* Definition performs no I/O and allocates no native handle.
|
|
9
|
+
*
|
|
10
|
+
* Ownership decision (GS-ASSET-04): declaration helpers CLONE the
|
|
11
|
+
* author-supplied structure and freeze the clone. Caller-owned spec
|
|
12
|
+
* records, frame/clip objects, and group maps are never frozen in place,
|
|
13
|
+
* so one reusable author record can back several declarations and later
|
|
14
|
+
* edits cannot reach an already-built manifest. Descriptor objects are
|
|
15
|
+
* expected from `image(...)`/`spriteSheet(...)` and are shared already
|
|
16
|
+
* immutable; the helpers never take ownership of caller input.
|
|
9
17
|
*/
|
|
10
18
|
import { createDeepFreeze } from "../core/session/deepFreeze.js";
|
|
11
19
|
import { validateImageSource, validateManifest, validateSpriteSheet } from "./validation.js";
|
|
@@ -25,12 +33,23 @@ export function image(source) {
|
|
|
25
33
|
*/
|
|
26
34
|
export function spriteSheet(source, spec) {
|
|
27
35
|
validateSpriteSheet(source, spec);
|
|
36
|
+
// Clone the author records before freezing: the caller's spec stays
|
|
37
|
+
// owned by the caller and reusable for further declarations.
|
|
38
|
+
const frames = Object.fromEntries(Object.entries(spec.frames).map(([name, rect]) => [name, {
|
|
39
|
+
...rect
|
|
40
|
+
}]));
|
|
41
|
+
const animations = Object.fromEntries(Object.entries(spec.animations).map(([name, clip]) => [name, {
|
|
42
|
+
...clip,
|
|
43
|
+
frames: [...clip.frames]
|
|
44
|
+
}])
|
|
45
|
+
// The shape was validated above; the clone preserves every value.
|
|
46
|
+
);
|
|
28
47
|
const freezer = createDeepFreeze();
|
|
29
48
|
return freezer({
|
|
30
49
|
kind: 'sprite-sheet',
|
|
31
50
|
source,
|
|
32
|
-
frames
|
|
33
|
-
animations
|
|
51
|
+
frames,
|
|
52
|
+
animations
|
|
34
53
|
});
|
|
35
54
|
}
|
|
36
55
|
|
|
@@ -42,7 +61,13 @@ export function spriteSheet(source, spec) {
|
|
|
42
61
|
*/
|
|
43
62
|
export function defineAssets(groups) {
|
|
44
63
|
validateManifest(groups);
|
|
64
|
+
// Clone the group/asset maps before freezing: the caller's object stays
|
|
65
|
+
// owned by the caller. Descriptor values are shared — they are expected
|
|
66
|
+
// from image()/spriteSheet() and are already immutable.
|
|
67
|
+
const groupsCopy = Object.fromEntries(Object.entries(groups).map(([group, assets]) => [group, {
|
|
68
|
+
...assets
|
|
69
|
+
}]));
|
|
45
70
|
const freezer = createDeepFreeze();
|
|
46
|
-
return freezer(
|
|
71
|
+
return freezer(groupsCopy);
|
|
47
72
|
}
|
|
48
73
|
//# sourceMappingURL=defineAssets.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createDeepFreeze","validateImageSource","validateManifest","validateSpriteSheet","image","source","Object","freeze","kind","spriteSheet","spec","
|
|
1
|
+
{"version":3,"names":["createDeepFreeze","validateImageSource","validateManifest","validateSpriteSheet","image","source","Object","freeze","kind","spriteSheet","spec","frames","fromEntries","entries","map","name","rect","animations","clip","freezer","defineAssets","groups","groupsCopy","group","assets"],"sourceRoot":"../../../src","sources":["assets/defineAssets.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,gBAAgB,QAAQ,+BAA4B;AAC7D,SAASC,mBAAmB,EAAEC,gBAAgB,EAAEC,mBAAmB,QAAQ,iBAAc;AAUzF;AACA,OAAO,SAASC,KAAKA,CAACC,MAAc,EAAmB;EACrDJ,mBAAmB,CAACI,MAAM,CAAC;EAC3B,OAAOC,MAAM,CAACC,MAAM,CAAC;IAAEC,IAAI,EAAE,OAAO;IAAEH;EAAO,CAAC,CAAC;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,WAAWA,CAIzBJ,MAAc,EACdK,IAGC,EACuC;EACxCP,mBAAmB,CAACE,MAAM,EAAEK,IAAI,CAAC;EACjC;EACA;EACA,MAAMC,MAAM,GAAGL,MAAM,CAACM,WAAW,CAC/BN,MAAM,CAACO,OAAO,CAACH,IAAI,CAACC,MAAM,CAAC,CAACG,GAAG,CAAC,CAAC,CAACC,IAAI,EAAEC,IAAI,CAAC,KAAK,CAACD,IAAI,EAAE;IAAE,GAAGC;EAAK,CAAC,CAAC,CACvE,CAAY;EACZ,MAAMC,UAAU,GAAGX,MAAM,CAACM,WAAW,CACnCN,MAAM,CAACO,OAAO,CAACH,IAAI,CAACO,UAAU,CAAC,CAACH,GAAG,CAAC,CAAC,CAACC,IAAI,EAAEG,IAAI,CAAC,KAAK,CACpDH,IAAI,EACJ;IAAE,GAAGG,IAAI;IAAEP,MAAM,EAAE,CAAC,GAAGO,IAAI,CAACP,MAAM;EAAE,CAAC,CACtC;EACD;EACF,CAAsB;EACtB,MAAMQ,OAAO,GAAGnB,gBAAgB,CAAC,CAAC;EAClC,OAAOmB,OAAO,CAAC;IACbX,IAAI,EAAE,cAAc;IACpBH,MAAM;IACNM,MAAM;IACNM;EACF,CAAC,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,YAAYA,CAC1BC,MAAe,EACa;EAC5BnB,gBAAgB,CAACmB,MAAM,CAAC;EACxB;EACA;EACA;EACA,MAAMC,UAAU,GAAGhB,MAAM,CAACM,WAAW,CACnCN,MAAM,CAACO,OAAO,CAACQ,MAAM,CAAC,CAACP,GAAG,CAAC,CAAC,CAACS,KAAK,EAAEC,MAAM,CAAC,KAAK,CAACD,KAAK,EAAE;IAAE,GAAGC;EAAO,CAAC,CAAC,CACxE,CAAY;EACZ,MAAML,OAAO,GAAGnB,gBAAgB,CAAC,CAAC;EAClC,OAAOmB,OAAO,CAACG,UAAU,CAAC;AAC5B","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Subpath entry for `rn-gamekit/assets`.
|
|
5
|
+
*
|
|
6
|
+
* Asset manifest definitions and public descriptor types — no React hooks,
|
|
7
|
+
* Skia decoding, or Expo Asset acquisition.
|
|
8
|
+
*/
|
|
9
|
+
export { defineAssets, image, spriteSheet } from "./assets/defineAssets.js";
|
|
10
|
+
export { GameAssetError } from "./assets/errors.js";
|
|
11
|
+
//# sourceMappingURL=assets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["defineAssets","image","spriteSheet","GameAssetError"],"sourceRoot":"../../src","sources":["assets.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,YAAY,EAAEC,KAAK,EAAEC,WAAW,QAAQ,0BAAuB;AACxE,SAASC,cAAc,QAAQ,oBAAiB","ignoreList":[]}
|