almost working font rendering

This commit is contained in:
Tuomas Katajisto 2025-05-03 00:21:21 +03:00
parent cf01001cc1
commit f7882ae500
3 changed files with 21 additions and 21 deletions

View File

@ -119,18 +119,18 @@ flush_arb_commands :: () {
case .REMOVE_TEXTURE;
gCurrentTexture = null;
case .FLUSH_TRI;
if !is_in_pass {
sg_begin_pass(*(sg_pass.{ action = state.pass_action, swapchain = cast,force(sg_swapchain) sglue_swapchain() }));
is_in_pass = true;
}
// if !is_in_pass {
// sg_begin_pass(*(sg_pass.{ action = state.pass_action, swapchain = cast,force(sg_swapchain) sglue_swapchain() }));
// is_in_pass = true;
// }
sg_apply_pipeline(gPipelines.arbtri.pipeline);
sg_apply_bindings(*gPipelines.arbtri.bind);
sg_draw(xx (it.tri_offset * 3), xx (it.tri_count * 3), 1);
case .PREPARE_TEXT;
if is_in_pass {
sg_end_pass();
is_in_pass = false;
}
// if is_in_pass {
// sg_end_pass();
// is_in_pass = false;
// }
font := it.font;
text := it.text;
if text.count < 1 then continue;
@ -166,14 +166,15 @@ flush_arb_commands :: () {
result[gPreppedText.count] = 0;
sgl_layer(layer);
fonsDrawText(state.fons, xx x, xx y, result, null);
sg_begin_pass(*(sg_pass.{ action = state.pass_action, swapchain = cast,force(sg_swapchain) sglue_swapchain() }));
// sg_begin_pass(*(sg_pass.{ action = state.pass_action, swapchain = cast,force(sg_swapchain) sglue_swapchain() }));
sfons_flush(state.fons);
sgl_draw_layer(layer);
sg_end_pass();
// sg_end_pass();
layer += 1;
fonsPushState(state.fons);
}
}
if is_in_pass {
sg_end_pass();
}
// if is_in_pass {
// sg_end_pass();
// }
}

View File

@ -55,7 +55,7 @@ tick_console :: () {
}
}
console_input : string = "HELLO??";
console_input : string = "HELLO??dasdasdasd";
draw_console :: (theme: *GR.Overall_Theme) {
if console_h < 1 then return;
@ -65,8 +65,7 @@ draw_console :: (theme: *GR.Overall_Theme) {
r.x -= 1*vw;
r.y = r.h - ui_h(5, 4);
r.h = ui_h(5, 4);
GR.label(r, "HELLO?!! wTF=", *theme.label_theme);
// a, new, state := GR.text_input(r, console_input, *theme.text_input_theme);
// if !state.active then GR.activate(state);
// GR.label(r, "HELLO?!! wTF=", *theme.label_theme);
a, new, state := GR.text_input(r, console_input, *theme.text_input_theme);
if !state.active then GR.activate(state);
}

View File

@ -107,7 +107,7 @@ frame :: () {
is_in_pass = true;
sg_begin_pass(*(sg_pass.{ action = state.pass_action_clear, swapchain = cast,force(sg_swapchain) sglue_swapchain() }));
arb_tri_flush();
// sg_end_pass();
sg_end_pass();
sg_commit();
input_per_frame_event_and_flag_update();