aboutsummaryrefslogtreecommitdiff
path: root/graphics.c
diff options
context:
space:
mode:
authorRiley Beckett <rbeckettvt@gmail.com>2025-10-23 23:53:07 -0400
committerRiley Beckett <rbeckettvt@gmail.com>2025-10-23 23:53:07 -0400
commitec67361bb19d4c43ca41df6a56beb5b29344bc6a (patch)
tree786ef12d4882884b9b8ef433f4d5616d44fa16b0 /graphics.c
parentb07d30e30de90f7cb17e7e91ed71ac5af9326722 (diff)
increase spacing for horizontal layout
Diffstat (limited to 'graphics.c')
-rw-r--r--graphics.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/graphics.c b/graphics.c
index b2fead7..f462402 100644
--- a/graphics.c
+++ b/graphics.c
@@ -185,9 +185,7 @@ void render_frame(client_state *state) {
// calculate input buffer
float input_y = state->line_height * state->lines;
- float input_width;
- if (state->lines > 0) { input_width = state->width; }
- else { input_width = state->width / 3.0f; }
+ float input_width = state->lines ? state->width : state->width / 3.0f;
// draw input buffer
if (array_size(state->filtered_items) != 0) {
@@ -210,7 +208,7 @@ void render_frame(client_state *state) {
float start;
// set up starting pen and scissor for options
- if (state->lines > 0) {
+ if (state->lines) {
glScissor(0, 0, state->width, input_y);
start = input_y - state->line_height + state->scroll;
@@ -261,7 +259,7 @@ void render_frame(client_state *state) {
item_t* item = display->item;
float x,y;
- if (state->lines > 0) {
+ if (state->lines) {
x = 0;
y = start - display->offset;
}
@@ -274,7 +272,7 @@ void render_frame(client_state *state) {
glUniform4f(state->b_color_uniform, highlight_color.r,highlight_color.g,highlight_color.b,highlight_color.a);
glUniform2f(state->b_screen_size_uniform, state->width, state->height);
glUniform2f(state->b_start_uniform, x, y);
- glUniform2f(state->b_size_uniform, (state->lines > 0) ? state->width : item->pixel_len + state->horizontal_spacing, state->line_height);
+ glUniform2f(state->b_size_uniform, (state->lines) ? state->width : item->pixel_len + state->horizontal_spacing * 2, state->line_height);
glDrawArrays(GL_TRIANGLES, 0, 6);
}
@@ -289,7 +287,7 @@ void render_frame(client_state *state) {
item_t* item = display->item;
float x,y;
- if (state->lines > 0) {
+ if (state->lines) {
x = 0;
y = start - display->offset;
}
@@ -299,7 +297,7 @@ void render_frame(client_state *state) {
}
glBindVertexArray(item->text_buffer.vao);
- glUniform2f(state->t_offset_uniform, x + state->horizontal_spacing / 2.0f, y - state->atlas.vert_shift);
+ glUniform2f(state->t_offset_uniform, x + (state->lines ? state->horizontal_spacing / 2.0f : state->horizontal_spacing), y - state->atlas.vert_shift);
glDrawElements(GL_TRIANGLES, item->text_buffer.num_elements, GL_UNSIGNED_INT, 0);
}