Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
luboslenco committed Jan 18, 2025
1 parent 70751a4 commit 0f2e813
Show file tree
Hide file tree
Showing 12 changed files with 614 additions and 691 deletions.
129 changes: 0 additions & 129 deletions armorcore/sources/iron.h
Original file line number Diff line number Diff line change
Expand Up @@ -1608,17 +1608,6 @@ kinc_g4_texture_t *iron_load_image(string_t *file, bool readable) {
return texture;
}

typedef struct image {
any texture_;
any render_target_;
int format; // tex_format_t;
bool readable;
buffer_t *pixels;
int width;
int height;
int depth;
} image_t;

void iron_unload_image(image_t *image) {
if (image == NULL) {
return;
Expand Down Expand Up @@ -2247,124 +2236,6 @@ void iron_http_request(string_t *url, i32 size, void (*callback)(char *, buffer_
#endif
}

void iron_g2_init(buffer_t *image_vert, buffer_t *image_frag, buffer_t *colored_vert, buffer_t *colored_frag, buffer_t *text_vert, buffer_t *text_frag) {
arm_g2_init(image_vert->buffer, image_vert->length, image_frag->buffer, image_frag->length, colored_vert->buffer, colored_vert->length, colored_frag->buffer, colored_frag->length, text_vert->buffer, text_vert->length, text_frag->buffer, text_frag->length);
}

void iron_g2_begin() {
arm_g2_begin();
}

void iron_g2_end() {
arm_g2_end();
}

void iron_g2_draw_scaled_sub_image(image_t *image, f32 sx, f32 sy, f32 sw, f32 sh, f32 dx, f32 dy, f32 dw, f32 dh) {
#ifdef KINC_DIRECT3D12
waitAfterNextDraw = true;
#endif
if (image->texture_ != NULL) {
kinc_g4_texture_t *texture = (kinc_g4_texture_t *)image->texture_;
arm_g2_draw_scaled_sub_image(texture, sx, sy, sw, sh, dx, dy, dw, dh);
}
else {
kinc_g4_render_target_t *render_target = (kinc_g4_render_target_t *)image->render_target_;
arm_g2_draw_scaled_sub_render_target(render_target, sx, sy, sw, sh, dx, dy, dw, dh);
}
}

void iron_g2_fill_triangle(f32 x0, f32 y0, f32 x1, f32 y1, f32 x2, f32 y2) {
arm_g2_fill_triangle(x0, y0, x1, y1, x2, y2);
}

void iron_g2_fill_rect(f32 x, f32 y, f32 width, f32 height) {
arm_g2_fill_rect(x, y, width, height);
}

void iron_g2_draw_rect(f32 x, f32 y, f32 width, f32 height, f32 strength) {
arm_g2_draw_rect(x, y, width, height, strength);
}

void iron_g2_draw_line(f32 x0, f32 y0, f32 x1, f32 y1, f32 strength) {
arm_g2_draw_line(x0, y0, x1, y1, strength);
}

void iron_g2_draw_line_aa(f32 x0, f32 y0, f32 x1, f32 y1, f32 strength) {
arm_g2_draw_line_aa(x0, y0, x1, y1, strength);
}

void iron_g2_draw_string(string_t *text, f32 x, f32 y) {
arm_g2_draw_string(text, x, y);
}

void iron_g2_set_font(arm_g2_font_t *font, i32 size) {
arm_g2_set_font(font, size);
}

arm_g2_font_t *iron_g2_font_init(buffer_t *blob, i32 font_index) {
arm_g2_font_t *font = (arm_g2_font_t *)malloc(sizeof(arm_g2_font_t));
arm_g2_font_init(font, blob->buffer, font_index);
return font;
}

arm_g2_font_t *iron_g2_font_13(buffer_t *blob) {
arm_g2_font_t *font = (arm_g2_font_t *)malloc(sizeof(arm_g2_font_t));
arm_g2_font_13(font, blob->buffer);
return font;
}

void iron_g2_font_set_glyphs(i32_array_t *glyphs) {
arm_g2_font_set_glyphs(glyphs->buffer, glyphs->length);
}

i32 iron_g2_font_count(arm_g2_font_t *font) {
return arm_g2_font_count(font);
}

i32 iron_g2_font_height(arm_g2_font_t *font, i32 size) {
return (int)arm_g2_font_height(font, size);
}

i32 iron_g2_string_width(arm_g2_font_t *font, i32 size, string_t *text) {
return (int)arm_g2_string_width(font, size, text);
}

void iron_g2_set_bilinear_filter(bool bilinear) {
arm_g2_set_bilinear_filter(bilinear);
}

void iron_g2_restore_render_target() {
arm_g2_restore_render_target();
}

void iron_g2_set_render_target(kinc_g4_render_target_t *render_target) {
arm_g2_set_render_target(render_target);
}

void iron_g2_set_color(i32 color) {
arm_g2_set_color(color);
}

void iron_g2_set_pipeline(kinc_g4_pipeline_t *pipeline) {
arm_g2_set_pipeline(pipeline);
}

void iron_g2_set_transform(buffer_t *matrix) {
arm_g2_set_transform(matrix != NULL ? (kinc_matrix3x3_t *)matrix->buffer : NULL);
}

void iron_g2_fill_circle(f32 cx, f32 cy, f32 radius, i32 segments) {
arm_g2_fill_circle(cx, cy, radius, segments);
}

void iron_g2_draw_circle(f32 cx, f32 cy, f32 radius, i32 segments, f32 strength) {
arm_g2_draw_circle(cx, cy, radius, segments, strength);
}

void iron_g2_draw_cubic_bezier(f32_array_t *x, f32_array_t *y, i32 segments, f32 strength) {
arm_g2_draw_cubic_bezier(x->buffer, y->buffer, segments, strength);
}

bool _window_close_callback(void *data) {
#ifdef KINC_WINDOWS
bool save = false;
Expand Down
Loading

0 comments on commit 0f2e813

Please sign in to comment.