From 9d8db4146d025e3a967700414a9fc68fa186045e Mon Sep 17 00:00:00 2001 From: Riley Beckett Date: Thu, 23 Oct 2025 00:07:26 -0400 Subject: add basic cursor movement --- graphics.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'graphics.c') diff --git a/graphics.c b/graphics.c index 4b3e3d3..af5e955 100644 --- a/graphics.c +++ b/graphics.c @@ -2,6 +2,7 @@ #include "array.h" #include "config.h" #include "shader.h" +#include "font.h" void GLAPIENTRY MessageCallback(GLenum source, @@ -203,8 +204,8 @@ void render_frame(client_state *state) { glUseProgram(state->box_shader); glUniform4f(state->b_color_uniform, cursor_color.r,cursor_color.g,cursor_color.b,cursor_color.a); glUniform2f(state->b_screen_size_uniform, state->width, state->height); - glUniform2f(state->b_start_uniform, state->input_buffer_grafix.pixel_len + state->horizontal_spacing / 2.0f, input_y); - glUniform2f(state->b_size_uniform, state->atlas.metrics['m'].bitmap_width, state->line_height); + glUniform2f(state->b_start_uniform, atlas_get_strwidth_len(state, state->input_buffer, state->cursor_index) + state->horizontal_spacing / 2.0f, input_y); + glUniform2f(state->b_size_uniform, state->atlas.metrics['M'].bitmap_width, state->line_height); glDrawArrays(GL_TRIANGLES, 0, 6); float start; -- cgit v1.2.3