angry-pixel 2.0.16 → 2.0.17

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
@@ -2400,21 +2400,27 @@ declare enum TextOrientation {
2400
2400
  RightCenter = 3
2401
2401
  }
2402
2402
  interface TextRenderData extends RenderData {
2403
+ color: string;
2404
+ flipHorizontally: boolean;
2405
+ flipVertically: boolean;
2403
2406
  font: FontFace | string;
2404
- text: string;
2405
2407
  fontSize: number;
2406
- color: string;
2407
- lineSeparation: number;
2408
+ lineHeight: number;
2408
2409
  letterSpacing: number;
2410
+ opacity: number;
2409
2411
  orientation: TextOrientation;
2410
2412
  rotation: number;
2411
- opacity: number;
2413
+ shadow?: {
2414
+ color: string;
2415
+ offset: Vector2;
2416
+ opacity: number;
2417
+ };
2412
2418
  smooth: boolean;
2413
- bitmap: {
2419
+ text: string;
2420
+ textureAtlas: {
2414
2421
  charRanges: number[];
2415
2422
  fontSize: number;
2416
- margin: Vector2;
2417
- spacing: Vector2;
2423
+ spacing: number;
2418
2424
  };
2419
2425
  }
2420
2426
 
@@ -2729,86 +2735,160 @@ declare class SpriteRenderer {
2729
2735
  * @category Components
2730
2736
  */
2731
2737
  interface TextRendererOptions {
2732
- layer: string;
2733
- text: string;
2738
+ /** The text color */
2739
+ color: string;
2740
+ /** Flip the text horizontally */
2741
+ flipHorizontally: boolean;
2742
+ /** Flip the text vertically */
2743
+ flipVertically: boolean;
2744
+ /** The font family to use */
2734
2745
  font: FontFace | string;
2746
+ /** The size of the font in pixels. */
2735
2747
  fontSize: number;
2736
- width: number;
2748
+ /** The height of the invisible box where the text is rendered */
2737
2749
  height: number;
2738
- offset: Vector2;
2739
- color: string;
2740
- lineSeparation: number;
2750
+ /** The render layer */
2751
+ layer: string;
2752
+ /** The space between chars in pixels */
2741
2753
  letterSpacing: number;
2742
- charRanges: number[];
2743
- smooth: boolean;
2744
- rotation: number;
2754
+ /** The height of the line in pixels. Default value is equal to the font size */
2755
+ lineHeight: number;
2756
+ /** X-axis and Y-axis offset */
2757
+ offset: Vector2;
2758
+ /** Change the opacity between 1 and 0 */
2745
2759
  opacity: number;
2760
+ /** Direction in which the text will be rendered. */
2746
2761
  orientation: TextOrientation;
2747
- bitmapMargin: Vector2;
2748
- bitmapSpacing: Vector2;
2762
+ /** Text rotation in radians */
2763
+ rotation: number;
2764
+ /** Smoothing pixels (not recommended for bitmap fonts) */
2765
+ smooth: boolean;
2766
+ /** Shadow text configuration */
2767
+ shadow?: {
2768
+ /** Shadow text color */
2769
+ color: string;
2770
+ /** Shadow text offset in pixels */
2771
+ offset: Vector2;
2772
+ /** Shadow text opacity */
2773
+ opacity: number;
2774
+ };
2775
+ /** The text to render */
2776
+ text: string;
2777
+ /** The texture atlas configuration */
2778
+ textureAtlas: {
2779
+ /** Range of characters covered by the component defined in number pairs.
2780
+ * The default value is [32, 126, 161, 255], this means that the component
2781
+ * will render characters from 32 to 126 and from 161 to 255. */
2782
+ charRanges?: number[];
2783
+ /** The size of the font in pixels for bitmap fonts. */
2784
+ fontSize?: number;
2785
+ /** Spacing in pixels to correct badly sliced characters. */
2786
+ spacing?: number;
2787
+ };
2788
+ /** The width of the invisible box where the text is rendered */
2789
+ width: number;
2749
2790
  }
2750
2791
  /**
2751
2792
  * The TextRenderer component allows to render text using font families, colors, and other configuration options.
2752
2793
  * @public
2753
2794
  * @category Components
2795
+ * @example
2796
+ * ```typescript
2797
+ * const textRenderer = new TextRenderer({
2798
+ * text: "Hello World!",
2799
+ * color: "#FFFFFF",
2800
+ * fontSize: 24,
2801
+ * font: "Arial",
2802
+ * width: 1920,
2803
+ * height: 32,
2804
+ * layer: "TextLayer",
2805
+ * });
2806
+ * ```
2754
2807
  * @example
2755
- * ```js
2756
- * textRenderer.layer: "default";
2757
- * textRenderer.text: "Hello world!";
2758
- * textRenderer.font: "Arial";
2759
- * textRenderer.fontSize: 16;
2760
- * textRenderer.width: 160;
2761
- * textRenderer.height: 16;
2762
- * textRenderer.color: "#000000";
2763
- * textRenderer.offset: new Vector2();
2764
- * textRenderer.lineSeparation: 0;
2765
- * textRenderer.letterSpacing: 0;
2766
- * textRenderer.charRanges: [32, 126, 161, 255];
2767
- * textRenderer.smooth: false;
2768
- * textRenderer.rotation: 0;
2769
- * textRenderer.opacity: 1;
2770
- * textRenderer.orientation: TextOrientation.RightDown;
2771
- * textRenderer.bitmapMargin: new Vector2();
2772
- * textRenderer.bitmapSpacing: new Vector2();
2808
+ * ```typescript
2809
+ * const textRenderer = new TextRenderer({
2810
+ * text: "Hello World!",
2811
+ * color: "#FFFFFF",
2812
+ * fontSize: 24,
2813
+ * width: 1920,
2814
+ * height: 32,
2815
+ * opacity: 1,
2816
+ * layer: "TextLayer",
2817
+ * orientation: TextOrientation.RightCenter,
2818
+ * shadow: {
2819
+ * color: "#00FF00",
2820
+ * offset: new Vector2(3, -3),
2821
+ * opacity: 0.5,
2822
+ * },
2823
+ * textureAtlas: {
2824
+ * charRanges: [32, 126, 161, 255, 0x3040, 0x309f],
2825
+ * fontSize: 64,
2826
+ * spacing: 4,
2827
+ * },
2828
+ * font: "Arial",
2829
+ * flipHorizontally: false,
2830
+ * flipVertically: false,
2831
+ * letterSpacing: 0,
2832
+ * lineHeight: 24,
2833
+ * offset: new Vector2(0, 0),
2834
+ * rotation: 0,
2835
+ * smooth: false,
2836
+ * });
2773
2837
  * ```
2774
2838
  */
2775
2839
  declare class TextRenderer {
2776
- /** The render layer */
2777
- layer: string;
2778
- /** The text to render */
2779
- text: string;
2840
+ /** The text color */
2841
+ color: string;
2842
+ /** Flip the text horizontally */
2843
+ flipHorizontally: boolean;
2844
+ /** Flip the text vertically */
2845
+ flipVertically: boolean;
2780
2846
  /** The font family to use */
2781
2847
  font: FontFace | string;
2782
2848
  /** The size of the font in pixels. */
2783
2849
  fontSize: number;
2784
- /** The width of the invisible box where the text is rendered */
2785
- width: number;
2786
2850
  /** The height of the invisible box where the text is rendered */
2787
2851
  height: number;
2788
- /** X-axis and Y-axis offset */
2789
- offset: Vector2;
2790
- /** The text color */
2791
- color: string;
2792
- /** The separation between lines in pixels */
2793
- lineSeparation: number;
2852
+ /** The render layer */
2853
+ layer: string;
2794
2854
  /** The space between chars in pixels */
2795
2855
  letterSpacing: number;
2796
- /** Range of characters covered by the component defined in number pairs.
2797
- * The default value is [32, 126, 161, 255], this means that the component
2798
- * will render characters from 32 to 126 and from 161 to 255. */
2799
- charRanges: number[];
2800
- /** Smoothing pixels (not recommended for bitmap fonts) */
2801
- smooth: boolean;
2802
- /** Text rotation in radians */
2803
- rotation: number;
2856
+ /** The height of the line in pixels. Default value is equal to the font size */
2857
+ lineHeight: number;
2858
+ /** X-axis and Y-axis offset */
2859
+ offset: Vector2;
2804
2860
  /** Change the opacity between 1 and 0 */
2805
2861
  opacity: number;
2806
2862
  /** Direction in which the text will be rendered. */
2807
2863
  orientation: TextOrientation;
2808
- /** Margin in pixels to correct badly sliced characters. */
2809
- bitmapMargin: Vector2;
2810
- /** Spacing in pixels to correct badly sliced characters. */
2811
- bitmapSpacing: Vector2;
2864
+ /** Text rotation in radians */
2865
+ rotation: number;
2866
+ /** Shadow text configuration */
2867
+ shadow: {
2868
+ /** Shadow text color */
2869
+ color: string;
2870
+ /** Shadow text offset in pixels */
2871
+ offset: Vector2;
2872
+ /** Shadow text opacity */
2873
+ opacity: number;
2874
+ };
2875
+ /** Smoothing pixels (not recommended for bitmap fonts) */
2876
+ smooth: boolean;
2877
+ /** The text to render */
2878
+ text: string;
2879
+ /** The texture atlas configuration */
2880
+ textureAtlas: {
2881
+ /** Range of characters covered by the component defined in number pairs.
2882
+ * The default value is [32, 126, 161, 255], this means that the component
2883
+ * will render characters from 32 to 126 and from 161 to 255. */
2884
+ charRanges?: number[];
2885
+ /** The size of the font in pixels for bitmap fonts. */
2886
+ fontSize?: number;
2887
+ /** Spacing in pixels to correct badly sliced characters. */
2888
+ spacing?: number;
2889
+ };
2890
+ /** The width of the invisible box where the text is rendered */
2891
+ width: number;
2812
2892
  /** @internal */
2813
2893
  _renderData: TextRenderData;
2814
2894
  constructor(options?: Partial<TextRendererOptions>);