box2d-netstandard icon indicating copy to clipboard operation
box2d-netstandard copied to clipboard

DebugDraw has obsolete methods without non obsolete replacement methods

Open enriko-riba opened this issue 2 years ago • 3 comments

Description

The following methods in DebugDraw are obsolete but without new Vector2 based version:

        [Obsolete("Look out for new calls using Vector2")]
        public abstract void DrawPolygon(in Vec2[] vertices, int vertexCount, in Color color);

        [Obsolete("Look out for new calls using Vector2")]
        public abstract void DrawSolidPolygon(in Vec2[] vertices, int vertexCount, in Color color);

        [Obsolete("Look out for new calls using Vector2")]
        public abstract void DrawCircle(in Vec2 center, float radius, in Color color);

        [Obsolete("Look out for new calls using Vector2")]
        public abstract void DrawSolidCircle(in Vec2 center, float radius, in Vec2 axis, in Color color);

        [Obsolete("Look out for new calls using Vector2")]
        public abstract void DrawSegment(in Vec2 p1, in Vec2 p2, in Color color);


### How To Reproduce

Implement inherited class and compiler spits out warnings

### Expected Behavior

The abstract DebugDraw class should provide non obsolete method versions:

[Obsolete("Look out for new calls using Vector2")] public abstract void DrawPolygon(in Vec2[] vertices, int vertexCount, in Color color);

public abstract void DrawPolygon(in Vector2[] vertices, int vertexCount, in Color color);

enriko-riba avatar Oct 15 '22 12:10 enriko-riba

You're right, we should implement those.

The warnings won't stop anything from working in the mean time, and Vec2 has implicit casts to and from System.Numerics.Vector2

The casts could probably be sped up too, but I'm not sure if Unsafe.As is available with .Net Standard 2.1

HughPH avatar Jan 09 '23 00:01 HughPH

See PR https://github.com/codingben/box2d-netstandard/pull/48

thomasvt avatar Jan 09 '23 09:01 thomasvt

See PR #48

Thanks @thomasvt :)

HughPH avatar Jan 10 '23 00:01 HughPH