SDL.zig icon indicating copy to clipboard operation
SDL.zig copied to clipboard

Renderer.copy srcRect and dstRect arguments flipped

Open Gertkeno opened this issue 3 years ago • 1 comments
trafficstars

    pub fn copy(ren: Renderer, tex: Texture, dstRect: ?Rectangle, srcRect: ?Rectangle) !void {
        if (c.SDL_RenderCopy(ren.ptr, tex.ptr, if (srcRect) |r| r.getConstSdlPtr() else null, if (dstRect) |r| r.getConstSdlPtr() else null) < 0)
            return makeError();
    }

    pub fn copyF(ren: Renderer, tex: Texture, dstRect: ?RectangleF, srcRect: ?Rectangle) !void {
        if (c.SDL_RenderCopyF(ren.ptr, tex.ptr, if (srcRect) |r| r.getConstSdlPtr() else null, if (dstRect) |r| r.getConstSdlPtr() else null) < 0)
            return makeError();
    }

Seems like an odd change from the source which could be hard to debug if converting from native to wrapper bindings. Though similarly hard to debug if flipped back to match SDL2

Gertkeno avatar Apr 26 '22 00:04 Gertkeno

Yes, this is by design, as srcRect is often null. Arguments more likely to be optional are further behind.

ikskuh avatar Apr 26 '22 06:04 ikskuh