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; case .REMOVE_TEXTURE;
gCurrentTexture = null; gCurrentTexture = null;
case .FLUSH_TRI; case .FLUSH_TRI;
if !is_in_pass { // if !is_in_pass {
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() }));
is_in_pass = true; // is_in_pass = true;
} // }
sg_apply_pipeline(gPipelines.arbtri.pipeline); sg_apply_pipeline(gPipelines.arbtri.pipeline);
sg_apply_bindings(*gPipelines.arbtri.bind); sg_apply_bindings(*gPipelines.arbtri.bind);
sg_draw(xx (it.tri_offset * 3), xx (it.tri_count * 3), 1); sg_draw(xx (it.tri_offset * 3), xx (it.tri_count * 3), 1);
case .PREPARE_TEXT; case .PREPARE_TEXT;
if is_in_pass { // if is_in_pass {
sg_end_pass(); // sg_end_pass();
is_in_pass = false; // is_in_pass = false;
} // }
font := it.font; font := it.font;
text := it.text; text := it.text;
if text.count < 1 then continue; if text.count < 1 then continue;
@ -166,14 +166,15 @@ flush_arb_commands :: () {
result[gPreppedText.count] = 0; result[gPreppedText.count] = 0;
sgl_layer(layer); sgl_layer(layer);
fonsDrawText(state.fons, xx x, xx y, result, null); 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); sfons_flush(state.fons);
sgl_draw_layer(layer); sgl_draw_layer(layer);
sg_end_pass(); // sg_end_pass();
layer += 1; layer += 1;
fonsPushState(state.fons);
} }
} }
if is_in_pass { // if is_in_pass {
sg_end_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) { draw_console :: (theme: *GR.Overall_Theme) {
if console_h < 1 then return; if console_h < 1 then return;
@ -65,8 +65,7 @@ draw_console :: (theme: *GR.Overall_Theme) {
r.x -= 1*vw; r.x -= 1*vw;
r.y = r.h - ui_h(5, 4); r.y = r.h - ui_h(5, 4);
r.h = ui_h(5, 4); r.h = ui_h(5, 4);
GR.label(r, "HELLO?!! wTF=", *theme.label_theme); // GR.label(r, "HELLO?!! wTF=", *theme.label_theme);
// a, new, state := GR.text_input(r, console_input, *theme.text_input_theme); a, new, state := GR.text_input(r, console_input, *theme.text_input_theme);
if !state.active then GR.activate(state);
// if !state.active then GR.activate(state);
} }

View File

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