Skip to content

Commit

Permalink
fix: screenPos() worldPos() correctly type set functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
lajbel committed Jan 20, 2025
1 parent cc5260f commit d45d362
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/components/transform/pos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,39 +33,48 @@ export interface PosComp extends Comp {
moveTo(dest: Vec2, speed?: number): void;
moveTo(x: number, y: number, speed?: number): void;
/**
* Get the position of the object on the screen.
* Get / Set the position of the object on the screen.
*
* @since v2000.0
*/
screenPos(): Vec2 | null;
screenPos(newPos?: Vec2): Vec2 | null;
/**
* Get the position of the object relative to the root.
* Get / Set the position of the object relative to the root.
*
* @since v2000.0
*/
worldPos(): Vec2 | null;
worldPos(newPos?: Vec2): Vec2 | null;
/**
* Transform a local point (relative to this) to a screen point (relative to the camera)
*/
toScreen(this: GameObj<PosComp | FixedComp>, p: Vec2): Vec2;
/**
* Transform a local point (relative to this) to a world point (relative to the root)
*
* @since v3001.0
*/
toWorld(this: GameObj<PosComp>, p: Vec2): Vec2;
/**
* Transform a screen point (relative to the camera) to a local point (relative to this)
*
* @since v3001.0
*/
fromScreen(this: GameObj<PosComp | FixedComp>, p: Vec2): Vec2;
/**
* Transform a world point (relative to the root) to a local point (relative to this)
*
* @since v3001.0
*/
fromWorld(this: GameObj<PosComp>, p: Vec2): Vec2;
/**
* Transform a point relative to this to a point relative to other
*
* @since v3001.0
*/
toOther(this: GameObj<PosComp>, other: GameObj<PosComp>, p: Vec2): Vec2;
/**
* Transform a point relative to other to a point relative to this
*
* @since v3001.0
*/
fromOther(this: GameObj<PosComp>, other: GameObj<PosComp>, p: Vec2): Vec2;
Expand Down

0 comments on commit d45d362

Please sign in to comment.