~ruther/CTU-FEE-B0B35APO-Semestral-project

03cc9e8040b9fdbf021a5237b8645dbca47f61ad — František Boháček 4 years ago 3044919
fix: text component respect new line
1 files changed, 8 insertions(+), 1 deletions(-)

M lib-gui/src/gui_component_text.c
M lib-gui/src/gui_component_text.c => lib-gui/src/gui_component_text.c +8 -1
@@ 31,7 31,7 @@ void gui_text_render(container_t *container, component_t *component,
    }

    int32_t remaining = strlen(state->line);
    char *line = state->line;
    const char *line = state->line;

    int16_t y = component->y;



@@ 44,6 44,13 @@ void gui_text_render(container_t *container, component_t *component,
        fit_chars = remaining;
      }

      for (int i = 0; i < fit_chars; i++) {
        if (line[i] == '\n' && lines_fit > 1) {
          fit_chars = i + 1;
          break;
        }
      }

      renderer_write_string(gui->renderer, component->x, y, fit_chars,
                            state->font, line, state->color);