~mil/mepo

2e2f9f09e331b96a9d63455654e42022ca9f584d — Miles Alan 2 years ago a1adbee sdlgfx-diagnols
Use SDL2_gfx to render connecting pin lines
3 files changed, 9 insertions(+), 6 deletions(-)

M build.zig
M src/Mepo.zig
M src/sdlshim.zig
M build.zig => build.zig +1 -0
@@ 6,6 6,7 @@ fn setDependencies(b: *Builder, step: *std.build.LibExeObjStep) void {
    step.linkSystemLibrary("SDL2");
    step.linkSystemLibrary("SDL2_image");
    step.linkSystemLibrary("SDL2_ttf");
    step.linkSystemLibrary("SDL2_gfx");
    step.linkSystemLibrary("curl");
}


M src/Mepo.zig => src/Mepo.zig +7 -6
@@ 263,13 263,14 @@ fn blit_pins(mepo: *@This()) errors.SDLError!void {

        // Draw connecting line for ordered pin group
        if (mepo.pin_groups[mepo.pin_group_active].ordered and prev_x != null and prev_y != null) {
            try utilsdl.errorcheck(sdl.SDL_RenderDrawLine(
            if (0 != sdl.aalineColor(
                mepo.renderer,
                @intCast(c_int, prev_x.?),
                @intCast(c_int, prev_y.?),
                @intCast(c_int, x),
                @intCast(c_int, y),
            ));
                @intCast(i16, prev_x.?),
                @intCast(i16, prev_y.?),
                @intCast(i16, x),
                @intCast(i16, y),
                0xff0000ff,
            )) @panic("fail aaline");
        }
    }
}

M src/sdlshim.zig => src/sdlshim.zig +1 -0
@@ 2,4 2,5 @@ pub usingnamespace @cImport({
    @cInclude("SDL2/SDL.h");
    @cInclude("SDL2/SDL_image.h");
    @cInclude("SDL2/SDL_ttf.h");
    @cInclude("SDL2_gfxPrimitives.h");
});