ikskuh/SDL.zig

Renderer.copy srcRect and dstRect arguments flipped

Opened this issue · 1 comments

    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

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