angry-pixel 2.0.18 → 2.0.20

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
@@ -372,6 +372,11 @@ declare class Rectangle {
372
372
  * @param min min value
373
373
  * @param max max value
374
374
  * @returns clamped value
375
+ * @example
376
+ * ```js
377
+ * clamp(10, 0, 5); // 5
378
+ * clamp(10, 0, 15); // 10
379
+ * ```
375
380
  */
376
381
  declare const clamp: (value: number, min: number, max: number) => number;
377
382
  /**
@@ -381,6 +386,10 @@ declare const clamp: (value: number, min: number, max: number) => number;
381
386
  * @param min min value
382
387
  * @param max max value
383
388
  * @returns the random int value
389
+ * @example
390
+ * ```js
391
+ * randomInt(0, 10); // 5
392
+ * ```
384
393
  */
385
394
  declare const randomInt: (min: number, max: number) => number;
386
395
  /**
@@ -390,6 +399,11 @@ declare const randomInt: (min: number, max: number) => number;
390
399
  * @param min min value
391
400
  * @param max max value
392
401
  * @returns the random float value
402
+ * @example
403
+ * ```js
404
+ * randomFloat(0, 10); // 5.23
405
+ * randomFloat(0, 10, 4); // 5.2345
406
+ * ```
393
407
  */
394
408
  declare const randomFloat: (min: number, max: number, decimals?: number) => number;
395
409
  /**
@@ -399,6 +413,10 @@ declare const randomFloat: (min: number, max: number, decimals?: number) => numb
399
413
  * @param value the value to round
400
414
  * @param decimals the number of decimals
401
415
  * @returns the rounded value
416
+ * @example
417
+ * ```js
418
+ * fixedRound(5.2345, 2); // 5.23
419
+ * ```
402
420
  */
403
421
  declare const fixedRound: (value: number, decimals: number) => number;
404
422
  /**
@@ -409,6 +427,11 @@ declare const fixedRound: (value: number, decimals: number) => number;
409
427
  * @param end the end value
410
428
  * @param steps the steps to move
411
429
  * @returns number range
430
+ * @example
431
+ * ```js
432
+ * range(0, 5); // [0, 1, 2, 3, 4, 5]
433
+ * range(0, 10, 2); // [0, 2, 4, 6, 8, 10]
434
+ * ```
412
435
  */
413
436
  declare const range: (start: number, end: number, steps?: number) => number[];
414
437
  /**
@@ -419,12 +442,23 @@ declare const range: (start: number, end: number, steps?: number) => number[];
419
442
  * @param min min value
420
443
  * @param max max value
421
444
  * @returns true if the number is between the min and the max, false instead
445
+ * @example
446
+ * ```js
447
+ * between(5, 0, 10); // true
448
+ * between(5, 0, 4); // false
449
+ * ```
422
450
  */
423
451
  declare const between: (value: number, min: number, max: number) => boolean;
424
452
  /**
425
453
  * Converts the given radians to degrees.
426
454
  * @param radians
427
455
  * @returns degrees
456
+ * @category Math
457
+ * @public
458
+ * @example
459
+ * ```js
460
+ * radiansToDegrees(Math.PI); // 180
461
+ * ```
428
462
  */
429
463
  declare const radiansToDegrees: (radians: number) => number;
430
464
  /**
@@ -433,8 +467,35 @@ declare const radiansToDegrees: (radians: number) => number;
433
467
  * @returns radians
434
468
  * @category Math
435
469
  * @public
470
+ * @example
471
+ * ```js
472
+ * degreesToRadians(180); // 3.141592653589793
473
+ * ```
436
474
  */
437
475
  declare const degreesToRadians: (degrees: number) => number;
476
+ /**
477
+ * Convert RGB to HEX as string
478
+ * @param rgb
479
+ * @param prefix default is "#"
480
+ * @returns string
481
+ * @public
482
+ * @category Math
483
+ * @example
484
+ * ```js
485
+ * // default prefix "#"
486
+ * rgbToHex({ r: 255, g: 255, b: 255 }); // #ffffff
487
+ * ```
488
+ * @example
489
+ * ```js
490
+ * // no prefix
491
+ * rgbToHex({ r: 0, g: 255, b: 0 }, ""); // 00ff00
492
+ * ```
493
+ */
494
+ declare const rgbToHex: ({ r, g, b }: {
495
+ r: number;
496
+ g: number;
497
+ b: number;
498
+ }, prefix?: string) => string;
438
499
 
439
500
  /** @internal */
440
501
  interface Shape {
@@ -2586,6 +2647,7 @@ interface CameraOptions {
2586
2647
  layers: string[];
2587
2648
  zoom: number;
2588
2649
  depth: number;
2650
+ debug: boolean;
2589
2651
  }
2590
2652
  /**
2591
2653
  * @public
@@ -3631,4 +3693,4 @@ declare const Symbols: {
3631
3693
  TimeManager: symbol;
3632
3694
  };
3633
3695
 
3634
- export { Animation, type AnimationSlice, Animator, type AnimatorOptions, AssetManager, AudioPlayer, type AudioPlayerAction, type AudioPlayerOptions, BallCollider, type BallColliderOptions, BoxCollider, type BoxColliderOptions, BroadPhaseMethods, Button, type ButtonOptions, ButtonShape, Camera, type CameraOptions, Children, type Chunk, Circumference, type Collider, type Collision, type CollisionMatrix, CollisionMethods, CollisionRepository, type CollisionResolution, type Component, type ComponentType, type DependencyName, type DependencyType, EdgeCollider, type EdgeColliderOptions, type Entity, EntityManager, Game, type GameConfig, GameSystem, GamepadController, InputManager, type IntervalOptions, Keyboard, LightRenderer, type LightRendererOptions, MaskRenderer, type MaskRendererOptions, MaskShape, Mouse, Parent, Polygon, PolygonCollider, type PolygonColliderOptions, Rectangle, RigidBody, type RigidBodyOptions, RigidBodyType, Scene, SceneManager, type SceneType, type SearchCriteria, type SearchResult, ShadowRenderer, type ShadowRendererOptions, type Shape, type Slice, SpriteRenderer, type SpriteRendererOptions, Symbols, type System, type SystemGroup, SystemManager, type SystemType, TextOrientation, 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, fixedRound, gameLogicSystem, gamePhysicsSystem, gamePreRenderSystem, inject, injectable, radiansToDegrees, randomFloat, randomInt, range };
3696
+ export { Animation, type AnimationSlice, Animator, type AnimatorOptions, AssetManager, AudioPlayer, type AudioPlayerAction, type AudioPlayerOptions, BallCollider, type BallColliderOptions, BoxCollider, type BoxColliderOptions, BroadPhaseMethods, Button, type ButtonOptions, ButtonShape, Camera, type CameraOptions, Children, type Chunk, Circumference, type Collider, type Collision, type CollisionMatrix, CollisionMethods, CollisionRepository, type CollisionResolution, type Component, type ComponentType, type DependencyName, type DependencyType, EdgeCollider, type EdgeColliderOptions, type Entity, EntityManager, Game, type GameConfig, GameSystem, GamepadController, InputManager, type IntervalOptions, Keyboard, LightRenderer, type LightRendererOptions, MaskRenderer, type MaskRendererOptions, MaskShape, Mouse, Parent, Polygon, PolygonCollider, type PolygonColliderOptions, Rectangle, RigidBody, type RigidBodyOptions, RigidBodyType, Scene, SceneManager, type SceneType, type SearchCriteria, type SearchResult, ShadowRenderer, type ShadowRendererOptions, type Shape, type Slice, SpriteRenderer, type SpriteRendererOptions, Symbols, type System, type SystemGroup, SystemManager, type SystemType, TextOrientation, 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, fixedRound, gameLogicSystem, gamePhysicsSystem, gamePreRenderSystem, inject, injectable, radiansToDegrees, randomFloat, randomInt, range, rgbToHex };