~ashn/autil

162d22298454c7f324e778ad830ccf369633cc87 — ashn 1 year, 6 months ago ee1c9f0
Run clang-format
2 files changed, 20 insertions(+), 16 deletions(-)

M aengn.h
M examples/shapes.c
M aengn.h => aengn.h +10 -8
@@ 1014,10 1014,11 @@ aengn_draw_point(int x, int y, struct aengn_rgba const* color)

    SDL_SetRenderDrawColor(
        aengn__global_.renderer, color->r, color->g, color->b, color->a);
    SDL_Rect const rect = {.x = x * aengn__global_.pixel_scale,
                           .y = y * aengn__global_.pixel_scale,
                           .w = aengn__global_.pixel_scale,
                           .h = aengn__global_.pixel_scale};
    SDL_Rect const rect = {
        .x = x * aengn__global_.pixel_scale,
        .y = y * aengn__global_.pixel_scale,
        .w = aengn__global_.pixel_scale,
        .h = aengn__global_.pixel_scale};
    int const err = SDL_RenderFillRect(aengn__global_.renderer, &rect);
    if (err) {
        autil_errorf("[%s][SDL_RenderFillRect] %s", __func__, SDL_GetError());


@@ 1126,10 1127,11 @@ aengn_draw_texture(SDL_Texture* tex, int x, int y)
    int w;
    int h;
    SDL_QueryTexture(tex, NULL, NULL, &w, &h);
    SDL_Rect dst = {.x = x * aengn__global_.pixel_scale,
                    .y = y * aengn__global_.pixel_scale,
                    .w = w * aengn__global_.pixel_scale,
                    .h = h * aengn__global_.pixel_scale};
    SDL_Rect dst = {
        .x = x * aengn__global_.pixel_scale,
        .y = y * aengn__global_.pixel_scale,
        .w = w * aengn__global_.pixel_scale,
        .h = h * aengn__global_.pixel_scale};
    int const err = SDL_RenderCopy(aengn__global_.renderer, tex, NULL, &dst);
    if (err) {
        autil_errorf("[%s][SDL_RenderCopy] %s", __func__, SDL_GetError());

M examples/shapes.c => examples/shapes.c +10 -8
@@ 65,10 65,11 @@ runtick(void* ctx)
    }
    // AENGN_MOUSEBUTTON_LEFT pressed => Finish drawing the currently selected shape.
    if (aengn_mousebutton_state(AENGN_MOUSEBUTTON_LEFT)->released) {
        struct shape const s = {.kind = selected,
                                .p1 = tmp_shape_start,
                                .p2 = (struct point){.x = aengn_mousepos_x(),
                                                     .y = aengn_mousepos_y()}};
        struct shape const s = {
            .kind = selected,
            .p1 = tmp_shape_start,
            .p2 = (struct point){
                .x = aengn_mousepos_x(), .y = aengn_mousepos_y()}};
        autil_vec_insert(shapes, autil_vec_count(shapes), &s);
    }



@@ 98,10 99,11 @@ runtick(void* ctx)
        aengn_draw_shape(autil_vec_ref(shapes, i));
    }
    if (aengn_mousebutton_state(AENGN_MOUSEBUTTON_LEFT)->down) {
        struct shape const s = {.kind = selected,
                                .p1 = tmp_shape_start,
                                .p2 = (struct point){.x = aengn_mousepos_x(),
                                                     .y = aengn_mousepos_y()}};
        struct shape const s = {
            .kind = selected,
            .p1 = tmp_shape_start,
            .p2 = (struct point){
                .x = aengn_mousepos_x(), .y = aengn_mousepos_y()}};
        // The shape itself.
        aengn_draw_shape(&s);
        // Start point.