Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renderer.copy srcRect and dstRect arguments flipped #59

Open
Gertkeno opened this issue Apr 26, 2022 · 1 comment
Open

Renderer.copy srcRect and dstRect arguments flipped #59

Gertkeno opened this issue Apr 26, 2022 · 1 comment

Comments

@Gertkeno
Copy link
Contributor

    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

@ikskuh
Copy link
Owner

ikskuh commented Apr 26, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants