cubeforge 0.4.7 → 0.4.9

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/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import React__default, { CSSProperties, ReactNode, ReactElement } from 'react';
4
4
  import { Plugin, EntityId, ECSWorld, ScriptUpdateFn, NavGrid, WorldSnapshot, EventBus, AccessibilityOptions } from '@cubeforge/core';
5
- export { AccessibilityOptions, AssetProgress, Component, ECSWorld, Ease, EntityId, GameTimer, HierarchyComponent, HierarchySystem, HotReloadablePlugin, MergedRect, NavGrid, Plugin, PreloadManifest, ScriptUpdateFn, SpatialHash, TimelineEntry, TransformComponent, TweenHandle, TweenTimeline, Vec2Like, WorldSnapshot, WorldTransformComponent, announceToScreenReader, arrive, createHierarchy, createTag, createTimeline, createTimer, createTransform, definePlugin, findByTag, flee, getAccessibilityOptions, getDescendants, hmrClearState, hmrLoadState, hmrSaveState, hotReloadPlugin, mergeTileColliders, patrol, preloadManifest, removeParent, seek, setAccessibilityOptions, setParent, tween, wander } from '@cubeforge/core';
5
+ export { AccessibilityOptions, AssetProgress, Component, ECSWorld, Ease, EntityId, GameTimer, HierarchyComponent, HierarchySystem, HotReloadablePlugin, MergedRect, NavGrid, Plugin, PreloadManifest, ScriptUpdateFn, SpatialHash, TimelineEntry, TransformComponent, TweenHandle, TweenOptions, TweenTimeline, Vec2Like, WorldSnapshot, WorldTransformComponent, alignment, announceToScreenReader, arrive, cohesion, createHierarchy, createTag, createTimeline, createTimer, createTransform, definePlugin, evade, findByTag, flee, getAccessibilityOptions, getDescendants, hmrClearState, hmrLoadState, hmrSaveState, hotReloadPlugin, mergeTileColliders, patrol, preloadManifest, pursuit, removeParent, seek, separation, setAccessibilityOptions, setParent, smoothPath, tween, wander } from '@cubeforge/core';
6
6
  import { Sampling, BlendMode, SpriteShape, AnimatorStateDefinition, AnimatorParamValue, GradientType, GradientStop, MaskShape, PostProcessEffect } from '@cubeforge/renderer';
7
7
  export { AnimationClipDefinition, AnimationStateComponent, AnimatorComponent, AnimatorCondition, AnimatorParamValue, AnimatorStateDefinition, AnimatorTransition, BlendMode, CircleShapeComponent, GradientComponent, GradientStop, GradientType, LineShapeComponent, MagFilterValue, MaskComponent, MaskShape, NineSliceComponent, ParallaxLayerComponent, Particle, ParticlePoolComponent, PolygonShapeComponent, PostProcessEffect, PostProcessStack, RenderLayer, RenderLayerManager, RenderSystem, Sampling, SpriteComponent, SpriteShape, SquashStretchComponent, TextComponent, TextureFilter, TextureFilterValue, TrailComponent, chromaticAberrationEffect, createCircleShape, createGradient, createLineShape, createMask, createNineSlice, createPolygonShape, createPostProcessStack, createRenderLayerManager, createSprite, defaultLayers, scanlineEffect, vignetteEffect } from '@cubeforge/renderer';
8
8
  import { CombineRule, ColliderShape, JointType } from '@cubeforge/physics';
@@ -13,7 +13,7 @@ import { AnimationClip } from '@cubeforge/gameplay';
13
13
  export { AISteering, AnimationClip, AnimationControllerResult, BindingControls, CharacterControls, CutsceneControls, CutsceneStep, DialogueControls, DialogueLine, DialogueScript, ForceControls, GameState as GameStateDefinition, GameStateMachineResult, HealthControls, HealthOptions, KinematicBodyControls, LevelTransitionControls, ObjectPool, PathfindingControls, PlatformerControllerOptions, RestartControls, SaveControls, SaveOptions, TopDownMovementOptions, TransitionOptions, TransitionType, TweenControls, useAISteering, useAnimationController, useCharacterController, useCutscene, useDamageZone, useDialogue, useDropThrough, useForces, useGameStateMachine, useGameStore, useHealth, useKinematicBody, useLevelTransition, useObjectPool, usePathfinding, usePersistedBindings, usePlatformerController, useRestart, useSave, useTopDownMovement, useTween } from '@cubeforge/gameplay';
14
14
  import { EngineState } from '@cubeforge/context';
15
15
  export { EngineState, useCircleEnter, useCircleExit, useCircleStay, useCollidingWith, useCollisionEnter, useCollisionExit, useCollisionStay, useTriggerEnter, useTriggerExit, useTriggerStay } from '@cubeforge/context';
16
- export { AudioGroup, SoundControls, SpatialSoundControls, SpatialSoundOptions, duck, getGroupVolume, getListenerPosition, setGroupMute, setGroupVolume, setListenerPosition, setMasterVolume, stopGroup, useSound, useSpatialSound } from '@cubeforge/audio';
16
+ export { AudioGroup, MusicControls, MusicOptions, SoundControls, SoundOptions, SpatialSoundControls, SpatialSoundOptions, duck, getGroupVolume, getListenerPosition, getMasterVolume, setGroupMute, setGroupVolume, setGroupVolumeFaded, setListenerPosition, setMasterVolume, stopGroup, useMusic, useSound, useSpatialSound } from '@cubeforge/audio';
17
17
  export { DevToolsHandle } from '@cubeforge/devtools';
18
18
 
19
19
  interface GameControls {
@@ -1043,19 +1043,30 @@ interface CameraControls {
1043
1043
  */
1044
1044
  shake(intensity: number, duration: number): void;
1045
1045
  /**
1046
- * Set the world-space offset applied to the camera's follow target.
1046
+ * Set the world-space offset applied to the camera follow target.
1047
1047
  * Useful for look-ahead: `setFollowOffset(facing * 80, 0)`.
1048
1048
  */
1049
1049
  setFollowOffset(x: number, y: number): void;
1050
1050
  /**
1051
1051
  * Instantly move the camera center to a world-space position.
1052
- * Bypasses smoothing useful for instant scene cuts.
1052
+ * Bypasses smoothing - useful for instant scene cuts.
1053
1053
  */
1054
1054
  setPosition(x: number, y: number): void;
1055
+ /**
1056
+ * Returns the current camera world-space position.
1057
+ */
1058
+ getPosition(): {
1059
+ x: number;
1060
+ y: number;
1061
+ };
1055
1062
  /**
1056
1063
  * Programmatically set the camera zoom level.
1057
1064
  */
1058
1065
  setZoom(zoom: number): void;
1066
+ /**
1067
+ * Returns the current camera zoom level.
1068
+ */
1069
+ getZoom(): number;
1059
1070
  }
1060
1071
  /**
1061
1072
  * Returns controls for the active Camera2D in the scene.
@@ -1236,6 +1247,20 @@ interface CoordinateHelpers {
1236
1247
  */
1237
1248
  declare function useCoordinates(): CoordinateHelpers;
1238
1249
 
1250
+ /**
1251
+ * Reactively queries the ECS world for entities that have all the given components.
1252
+ * Re-syncs on every animation frame, returning an up-to-date array of entity IDs.
1253
+ *
1254
+ * @example
1255
+ * ```tsx
1256
+ * function EnemyCounter() {
1257
+ * const enemies = useWorldQuery('Enemy', 'Transform')
1258
+ * return <Text text={`Enemies: ${enemies.length}`} ... />
1259
+ * }
1260
+ * ```
1261
+ */
1262
+ declare function useWorldQuery(...components: string[]): EntityId[];
1263
+
1239
1264
  interface PreloadState {
1240
1265
  /** 0–1 loading progress */
1241
1266
  progress: number;
@@ -1675,6 +1700,45 @@ interface HMRControls {
1675
1700
  */
1676
1701
  declare function useHMR(hmrKey?: string): HMRControls;
1677
1702
 
1703
+ interface SquashStretchControls {
1704
+ /**
1705
+ * Manually trigger a squash-stretch effect.
1706
+ *
1707
+ * The provided scale values are applied immediately as the target for this
1708
+ * frame, then the component recovers back to 1 at its normal `recovery` speed.
1709
+ *
1710
+ * @param scaleX - Target X scale (e.g. 1.3 = 30% wider)
1711
+ * @param scaleY - Target Y scale (e.g. 0.7 = 30% shorter)
1712
+ *
1713
+ * @example
1714
+ * const ss = useSquashStretch()
1715
+ * // On jump:
1716
+ * ss.trigger(0.8, 1.3)
1717
+ * // On land:
1718
+ * ss.trigger(1.3, 0.7)
1719
+ */
1720
+ trigger(scaleX: number, scaleY: number): void;
1721
+ }
1722
+ /**
1723
+ * Provides imperative control over the SquashStretch component attached to the
1724
+ * current entity. Use alongside the `<SquashStretch />` component.
1725
+ *
1726
+ * @example
1727
+ * ```tsx
1728
+ * function Player() {
1729
+ * const ss = useSquashStretch()
1730
+ * useCollisionEnter('ground', () => ss.trigger(1.3, 0.7))
1731
+ * return (
1732
+ * <Entity>
1733
+ * <SquashStretch intensity={0.3} recovery={10} />
1734
+ * <Sprite src="player.png" width={32} height={48} />
1735
+ * </Entity>
1736
+ * )
1737
+ * }
1738
+ * ```
1739
+ */
1740
+ declare function useSquashStretch(): SquashStretchControls;
1741
+
1678
1742
  declare function playClip(world: ECSWorld, entityId: EntityId, clipName: string): void;
1679
1743
  declare function setAnimationState(world: ECSWorld, entityId: EntityId, stateName: string): void;
1680
1744
  declare function setAnimatorParam(world: ECSWorld, entityId: EntityId, name: string, value: AnimatorParamValue): void;
@@ -1704,4 +1768,4 @@ declare function setAnimatorParam(world: ECSWorld, entityId: EntityId, name: str
1704
1768
  */
1705
1769
  declare function definePrefab<D extends Record<string, unknown>>(name: string, defaults: D, render: (props: D) => ReactElement): React__default.FC<Partial<D>>;
1706
1770
 
1707
- export { type AccessibilityControls, AnimatedSprite, type AnimatedSpriteProps, Animation, type AnimationSet, Animator, AssetLoader, type BoundInputMap, BoxCollider, Camera2D, type CameraControls, CameraZone, CapsuleCollider, Checkpoint, Circle, CircleCollider, type ComboDetectorResult, CompoundCollider, ConvexCollider, type CoordinateHelpers, type CoroutineControls, type CoroutineFactory, type CoroutineYield, Entity, Game, type GameControls, type GamepadState, Gradient, type HMRControls, HalfSpaceCollider, HeightFieldCollider, type InputContextControls, Joint, Line, Mask, MovingPlatform, NineSlice, ParallaxLayer, ParticleEmitter, type ParticlePreset, type PauseControls, Polygon, type PreloadState, type ProfilerData, RigidBody, type SceneManagerControls, ScreenFlash, type ScreenFlashHandle, Script, SegmentCollider, type SnapshotControls, Sprite, type SpriteAtlas, SquashStretch, Text, type TiledLayer, type TiledObject, Tilemap, type TimerControls, type TouchControls, Trail, Transform, TriMeshCollider, TriangleCollider, type VirtualInputState, VirtualJoystick, type VirtualJoystickProps, World, createAtlas, defineAnimations, definePrefab, playClip, setAnimationState, setAnimatorParam, useAccessibility, useCamera, useComboDetector, useCoordinates, useCoroutine, useDestroyEntity, useEntity, useEvent, useEvents, useGame, useGamepad, useHMR, useInput, useInputBuffer, useInputContext, useInputMap, useInputRecorder, useLocalMultiplayer, useParent, usePause, usePlayerInput, usePostProcess, usePreload, useProfiler, useSceneManager, useSnapshot, useTimer, useTouch, useVirtualInput, wait, waitFrames, waitUntil };
1771
+ export { type AccessibilityControls, AnimatedSprite, type AnimatedSpriteProps, Animation, type AnimationSet, Animator, AssetLoader, type BoundInputMap, BoxCollider, Camera2D, type CameraControls, CameraZone, CapsuleCollider, Checkpoint, Circle, CircleCollider, type ComboDetectorResult, CompoundCollider, ConvexCollider, type CoordinateHelpers, type CoroutineControls, type CoroutineFactory, type CoroutineYield, Entity, Game, type GameControls, type GamepadState, Gradient, type HMRControls, HalfSpaceCollider, HeightFieldCollider, type InputContextControls, Joint, Line, Mask, MovingPlatform, NineSlice, ParallaxLayer, ParticleEmitter, type ParticlePreset, type PauseControls, Polygon, type PreloadState, type ProfilerData, RigidBody, type SceneManagerControls, ScreenFlash, type ScreenFlashHandle, Script, SegmentCollider, type SnapshotControls, Sprite, type SpriteAtlas, SquashStretch, type SquashStretchControls, Text, type TiledLayer, type TiledObject, Tilemap, type TimerControls, type TouchControls, Trail, Transform, TriMeshCollider, TriangleCollider, type VirtualInputState, VirtualJoystick, type VirtualJoystickProps, World, createAtlas, defineAnimations, definePrefab, playClip, setAnimationState, setAnimatorParam, useAccessibility, useCamera, useComboDetector, useCoordinates, useCoroutine, useDestroyEntity, useEntity, useEvent, useEvents, useGame, useGamepad, useHMR, useInput, useInputBuffer, useInputContext, useInputMap, useInputRecorder, useLocalMultiplayer, useParent, usePause, usePlayerInput, usePostProcess, usePreload, useProfiler, useSceneManager, useSnapshot, useSquashStretch, useTimer, useTouch, useVirtualInput, useWorldQuery, wait, waitFrames, waitUntil };