@dill-pixel/plugin-crunch-physics
Version:
Crunch Physics
63 lines • 1.9 kB
TypeScript
import { PhysicsEntityConfig } from './types';
/**
* Utility functions for resolving entity positions and sizes from various input formats.
* These functions handle the conversion of different coordinate and size specifications
* into standardized formats used by the physics system.
*/
/**
* Resolves an entity's position from various input formats.
* Supports direct x/y values or a position object/array.
*
* @param config - Entity configuration containing position information
* @returns Resolved {x, y} coordinates
*
* @example
* ```typescript
* // Using direct x/y values
* resolveEntityPosition({ x: 100, y: 200 })
* // → { x: 100, y: 200 }
*
* // Using position array
* resolveEntityPosition({ position: [100, 200] })
* // → { x: 100, y: 200 }
*
* // Using position object
* resolveEntityPosition({ position: { x: 100, y: 200 } })
* // → { x: 100, y: 200 }
* ```
*/
export declare function resolveEntityPosition(config: PhysicsEntityConfig): {
x: number;
y: number;
};
/**
* Resolves an entity's size from various input formats.
* Supports direct width/height values or a size object/array.
*
* @param config - Entity configuration containing size information
* @returns Resolved {width, height} dimensions
*
* @example
* ```typescript
* // Using direct width/height values
* resolveEntitySize({ width: 100, height: 200 })
* // → { width: 100, height: 200 }
*
* // Using size array
* resolveEntitySize({ size: [100, 200] })
* // → { width: 100, height: 200 }
*
* // Using size object
* resolveEntitySize({ size: { width: 100, height: 200 } })
* // → { width: 100, height: 200 }
*
* // Using defaults
* resolveEntitySize({})
* // → { width: 32, height: 32 }
* ```
*/
export declare function resolveEntitySize(config: PhysicsEntityConfig): {
width: number;
height: number;
};
//# sourceMappingURL=utils.d.ts.map