angry-pixel 2.1.13 → 2.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/lib/index.d.ts CHANGED
@@ -3282,6 +3282,19 @@ interface RenderData {
3282
3282
  layer: string;
3283
3283
  }
3284
3284
 
3285
+ declare enum GeometricShape {
3286
+ Polygon = 0,
3287
+ Circumference = 1,
3288
+ Line = 2
3289
+ }
3290
+ interface GeometricRenderData extends RenderData {
3291
+ color: string;
3292
+ shape: GeometricShape;
3293
+ vertexModel: Vector2[];
3294
+ rotation: number;
3295
+ radius: number;
3296
+ }
3297
+
3285
3298
  /**
3286
3299
  * Mask shape: Rectangle or Circumference.
3287
3300
  * @category Components Configuration
@@ -3760,6 +3773,143 @@ declare class DarknessRenderer {
3760
3773
  constructor(options?: Partial<DarknessRendererOptions>);
3761
3774
  }
3762
3775
 
3776
+ /**
3777
+ * GeometricRenderer component configuration
3778
+ * @public
3779
+ * @category Components Configuration
3780
+ * @example
3781
+ * ```js
3782
+ * const outline = new GeometricRenderer({
3783
+ * shape: GeometricShape.Polygon,
3784
+ * color: "#00FF88",
3785
+ * layer: "Default",
3786
+ * vertexModel: [
3787
+ * new Vector2(-16, -16),
3788
+ * new Vector2(16, -16),
3789
+ * new Vector2(16, 16),
3790
+ * new Vector2(-16, 16),
3791
+ * ],
3792
+ * offset: new Vector2(0, 0),
3793
+ * rotation: 0,
3794
+ * });
3795
+ * ```
3796
+ * @example
3797
+ * ```js
3798
+ * const segments = new GeometricRenderer({
3799
+ * shape: GeometricShape.Line,
3800
+ * color: "#FFFFFF",
3801
+ * layer: "Default",
3802
+ * vertexModel: [new Vector2(0, 0), new Vector2(100, 0)],
3803
+ * offset: new Vector2(0, 0),
3804
+ * rotation: 0,
3805
+ * });
3806
+ * ```
3807
+ * @example
3808
+ * ```js
3809
+ * const ring = new GeometricRenderer({
3810
+ * shape: GeometricShape.Circumference,
3811
+ * color: "#FF6600",
3812
+ * layer: "Default",
3813
+ * radius: 32,
3814
+ * offset: new Vector2(0, 0),
3815
+ * rotation: 0,
3816
+ * });
3817
+ * ```
3818
+ */
3819
+ interface GeometricRendererOptions {
3820
+ /** Outline type: closed polygon, line segments, or circle */
3821
+ shape: GeometricShape;
3822
+ /** Stroke color as a hex string (e.g. `#RRGGBB`) */
3823
+ color: string;
3824
+ /** Render layer name; must match a layer seen by the {@link Camera} */
3825
+ layer: string;
3826
+ /**
3827
+ * Vertices in local space relative to the entity.\
3828
+ * For {@link GeometricShape.Polygon}, at least three points; drawn as a closed `LINE_LOOP`.\
3829
+ * For {@link GeometricShape.Line}, an even number of points (pairs) for `GL_LINES`.\
3830
+ * Ignored when `shape` is {@link GeometricShape.Circumference}.
3831
+ */
3832
+ vertexModel: Vector2[];
3833
+ /** Radius in pixels when `shape` is {@link GeometricShape.Circumference} */
3834
+ radius: number;
3835
+ /** Offset from the entity position, scaled by the entity `Transform`'s scale like other renderers */
3836
+ offset: Vector2;
3837
+ /** Extra rotation in radians, added to the entity `Transform`'s rotation */
3838
+ rotation: number;
3839
+ }
3840
+ /**
3841
+ * The GeometricRenderer component draws hollow (stroke-only) 2D geometry: polygon outlines,\
3842
+ * polylines, and circle outlines. It feeds the same path as debug collider drawing (`RenderDataType.Geometric`).\
3843
+ *\
3844
+ * The entity must have a {@link Transform}. World position is `Transform.localPosition` plus `offset` (with the\
3845
+ * same rotated-offset behavior as {@link MaskRenderer}). `Transform.localScale` scales `vertexModel` and,\
3846
+ * for circles, scales `radius` by the larger of `|scale.x|` and `|scale.y|`.\
3847
+ *\
3848
+ * Nothing is drawn if geometry is invalid: circumference requires `radius > 0`; polygon requires at least three\
3849
+ * vertices; line mode requires at least two vertices and an even count.
3850
+ * @public
3851
+ * @category Components
3852
+ * @example
3853
+ * ```js
3854
+ * const outline = new GeometricRenderer({
3855
+ * shape: GeometricShape.Polygon,
3856
+ * color: "#00FF88",
3857
+ * layer: "Default",
3858
+ * vertexModel: [
3859
+ * new Vector2(-16, -16),
3860
+ * new Vector2(16, -16),
3861
+ * new Vector2(16, 16),
3862
+ * new Vector2(-16, 16),
3863
+ * ],
3864
+ * offset: new Vector2(0, 0),
3865
+ * rotation: 0,
3866
+ * });
3867
+ * ```
3868
+ * @example
3869
+ * ```js
3870
+ * const segments = new GeometricRenderer({
3871
+ * shape: GeometricShape.Line,
3872
+ * color: "#FFFFFF",
3873
+ * layer: "Default",
3874
+ * vertexModel: [new Vector2(0, 0), new Vector2(100, 0)],
3875
+ * offset: new Vector2(0, 0),
3876
+ * rotation: 0,
3877
+ * });
3878
+ * ```
3879
+ * @example
3880
+ * ```js
3881
+ * const ring = new GeometricRenderer({
3882
+ * shape: GeometricShape.Circumference,
3883
+ * color: "#FF6600",
3884
+ * layer: "Default",
3885
+ * radius: 32,
3886
+ * offset: new Vector2(0, 0),
3887
+ * rotation: 0,
3888
+ * });
3889
+ * ```
3890
+ */
3891
+ declare class GeometricRenderer {
3892
+ /** Outline type: {@link GeometricShape.Polygon}, {@link GeometricShape.Line}, or {@link GeometricShape.Circumference} */
3893
+ shape: GeometricShape;
3894
+ /** Stroke color (hex) */
3895
+ color: string;
3896
+ /** Render layer */
3897
+ layer: string;
3898
+ /** Local-space vertices for polygon or line mode */
3899
+ vertexModel: Vector2[];
3900
+ /** Radius in pixels for {@link GeometricShape.Circumference} */
3901
+ radius: number;
3902
+ /** X/Y offset from the entity position */
3903
+ offset: Vector2;
3904
+ /** Additional rotation in radians (added to the Transform) */
3905
+ rotation: number;
3906
+ /** @internal */
3907
+ _renderData: GeometricRenderData;
3908
+ /** @internal */
3909
+ static componentName: string;
3910
+ constructor(options?: Partial<GeometricRendererOptions>);
3911
+ }
3912
+
3763
3913
  /**
3764
3914
  * SpriteRenderer component configuration
3765
3915
  * @public
@@ -4940,4 +5090,4 @@ declare const SYMBOLS: {
4940
5090
  TimeManager: symbol;
4941
5091
  };
4942
5092
 
4943
- export { Animation, type AnimationOptions, type AnimationSlice, Animator, type AnimatorOptions, type Archetype, AssetManager, AudioPlayer, type AudioPlayerAction, type AudioPlayerOptions, type AudioPlayerState, BallCollider, type BallColliderOptions, BoxCollider, type BoxColliderOptions, BroadPhaseMethods, Button, type ButtonOptions, ButtonShape, Camera, type CameraOptions, type Chunk, Circumference, type Collider, type Collision, type CollisionMatrix, CollisionMethods, CollisionRepository, type CollisionResolution, type Component, type ComponentType, DarknessRenderer, type DarknessRendererOptions, type DependencyName, type DependencyType, type DisabledComponent, EdgeCollider, type EdgeColliderOptions, type Entity, EntityManager, Game, type GameConfig, GameSystem, GamepadController, InputManager, type IntervalOptions, Keyboard, LightRenderer, type LightRendererOptions, MaskRenderer, type MaskRendererOptions, MaskShape, Mouse, type PlaySfxOptions, Polygon, PolygonCollider, type PolygonColliderOptions, type PropertyKey, Rectangle, RigidBody, type RigidBodyOptions, RigidBodyType, SYMBOLS, Scene, SceneManager, type SceneType, type SearchResult, type Shape, type Slice, SpriteRenderer, type SpriteRendererOptions, type System, type SystemGroup, SystemManager, type SystemType, TextAlignment, TextRenderer, type TextRendererOptions, type TiledChunk, type TiledLayer, type TiledObject, type TiledObjectLayer, type TiledProperty, type TiledTilemap, TiledWrapper, type TiledWrapperOptions, TilemapCollider, type TilemapColliderOptions, TilemapOrientation, TilemapRenderer, type TilemapRendererOptions, type Tileset, TimeManager, type TouchInteraction, TouchScreen, Transform, type TransformOptions, Vector2, type VibrationInput, VideoRenderer, type VideoRendererOptions, between, clamp, debugRenderLayer, decorate, defaultRenderLayer, defaultTextureAtlasOptions, degreesToRadians, disableComponent, fixedRound, gameLogicSystem, gamePhysicsSystem, gamePreRenderSystem, inject, injectable, playSfx, radiansToDegrees, randomFloat, randomInt, range, rgbToHex, stopSfx };
5093
+ export { Animation, type AnimationOptions, type AnimationSlice, Animator, type AnimatorOptions, type Archetype, AssetManager, AudioPlayer, type AudioPlayerAction, type AudioPlayerOptions, type AudioPlayerState, BallCollider, type BallColliderOptions, BoxCollider, type BoxColliderOptions, BroadPhaseMethods, Button, type ButtonOptions, ButtonShape, Camera, type CameraOptions, type Chunk, Circumference, type Collider, type Collision, type CollisionMatrix, CollisionMethods, CollisionRepository, type CollisionResolution, type Component, type ComponentType, DarknessRenderer, type DarknessRendererOptions, type DependencyName, type DependencyType, type DisabledComponent, EdgeCollider, type EdgeColliderOptions, type Entity, EntityManager, Game, type GameConfig, GameSystem, GamepadController, GeometricRenderer, type GeometricRendererOptions, GeometricShape, InputManager, type IntervalOptions, Keyboard, LightRenderer, type LightRendererOptions, MaskRenderer, type MaskRendererOptions, MaskShape, Mouse, type PlaySfxOptions, Polygon, PolygonCollider, type PolygonColliderOptions, type PropertyKey, Rectangle, RigidBody, type RigidBodyOptions, RigidBodyType, SYMBOLS, Scene, SceneManager, type SceneType, type SearchResult, type Shape, type Slice, SpriteRenderer, type SpriteRendererOptions, type System, type SystemGroup, SystemManager, type SystemType, TextAlignment, TextRenderer, type TextRendererOptions, type TiledChunk, type TiledLayer, type TiledObject, type TiledObjectLayer, type TiledProperty, type TiledTilemap, TiledWrapper, type TiledWrapperOptions, TilemapCollider, type TilemapColliderOptions, TilemapOrientation, TilemapRenderer, type TilemapRendererOptions, type Tileset, TimeManager, type TouchInteraction, TouchScreen, Transform, type TransformOptions, Vector2, type VibrationInput, VideoRenderer, type VideoRendererOptions, between, clamp, debugRenderLayer, decorate, defaultRenderLayer, defaultTextureAtlasOptions, degreesToRadians, disableComponent, fixedRound, gameLogicSystem, gamePhysicsSystem, gamePreRenderSystem, inject, injectable, playSfx, radiansToDegrees, randomFloat, randomInt, range, rgbToHex, stopSfx };