@box2d/debug-draw
Version:
Debug drawing helper for @box2d
89 lines • 3.13 kB
TypeScript
import { b2Transform, XY } from "./b2_math";
import { b2Readonly } from "./b2_readonly";
export interface RGB {
r: number;
g: number;
b: number;
}
export interface RGBA extends RGB {
a: number;
}
/**
* Color for debug drawing. Each value has the range [0,1].
*/
export declare class b2Color implements RGBA {
static readonly ZERO: Readonly<RGBA>;
static readonly RED: Readonly<RGBA>;
static readonly GREEN: Readonly<RGBA>;
static readonly BLUE: Readonly<RGBA>;
static readonly WHITE: Readonly<RGBA>;
static readonly BLACK: Readonly<RGBA>;
r: number;
g: number;
b: number;
a: number;
constructor(r?: number, g?: number, b?: number, a?: number);
Clone(): b2Color;
Copy(other: RGBA): this;
IsEqual(color: RGBA): boolean;
IsZero(): boolean;
SetByteRGB(r: number, g: number, b: number): this;
SetByteRGBA(r: number, g: number, b: number, a: number): this;
SetRGB(r: number, g: number, b: number): this;
SetRGBA(r: number, g: number, b: number, a: number): this;
Add(color: RGBA): this;
Subtract(color: RGBA): this;
Scale(s: number): this;
Mix(mixColor: RGBA, strength: number): void;
static Add<T extends RGBA>(colorA: RGBA, colorB: RGBA, out: T): T;
static Subtract<T extends RGBA>(colorA: RGBA, colorB: RGBA, out: T): T;
static Scale<T extends RGBA>(color: RGBA, s: number, out: T): T;
static MixColors(colorA: RGBA, colorB: RGBA, strength: number): void;
}
/**
* Implement and register this class with a b2World to provide debug drawing of physics
* entities in your game.
*/
export interface b2Draw {
PushTransform(xf: b2Readonly<b2Transform>): void;
PopTransform(xf: b2Readonly<b2Transform>): void;
/** Draw a closed polygon provided in CCW order. */
DrawPolygon(vertices: ReadonlyArray<Readonly<XY>>, vertexCount: number, color: RGBA): void;
/** Draw a solid closed polygon provided in CCW order. */
DrawSolidPolygon(vertices: ReadonlyArray<Readonly<XY>>, vertexCount: number, color: RGBA): void;
/** Draw a circle. */
DrawCircle(center: Readonly<XY>, radius: number, color: RGBA): void;
/** Draw a solid circle. */
DrawSolidCircle(center: Readonly<XY>, radius: number, axis: Readonly<XY>, color: RGBA): void;
/** Draw a line segment. */
DrawSegment(p1: Readonly<XY>, p2: Readonly<XY>, color: RGBA): void;
/**
* Draw a transform. Choose your own length scale.
* @param xf a transform.
*/
DrawTransform(xf: b2Readonly<b2Transform>): void;
/** Draw a point. */
DrawPoint(p: Readonly<XY>, size: number, color: RGBA): void;
}
export declare const debugColors: {
badBody: b2Color;
disabledBody: b2Color;
staticBody: b2Color;
kinematicBody: b2Color;
sleepingBody: b2Color;
body: b2Color;
pair: b2Color;
aabb: b2Color;
joint1: b2Color;
joint2: b2Color;
joint3: b2Color;
joint4: b2Color;
joint5: b2Color;
joint6: b2Color;
joint7: b2Color;
joint8: b2Color;
rope: b2Color;
ropePointG: b2Color;
ropePointD: b2Color;
};
//# sourceMappingURL=b2_draw.d.ts.map