summaryrefslogtreecommitdiff
path: root/window.c
diff options
context:
space:
mode:
Diffstat (limited to 'window.c')
-rw-r--r--window.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/window.c b/window.c
index 7f29abe..315e75e 100644
--- a/window.c
+++ b/window.c
@@ -97,11 +97,17 @@ static void draw_font_text(struct append_buffer *buffer)
for (int i = 0; i < buffer->length; i++) {
const char letter = buffer->buffer[i];
+
if (letter == ' ') {
dstrect.x += font.width;
continue;
}
+ if (letter == '\n') {
+ dstrect.x = 0;
+ dstrect.y += font.height;
+ continue;
+ }
int glyph_index = letter;
if (font.unicode_desc != NULL) {
@@ -117,12 +123,7 @@ static void draw_font_text(struct append_buffer *buffer)
srcrect.h = font.height;
SDL_RenderCopy(renderer, font_texture, &srcrect, &dstrect);
- if (letter == '\n') {
- dstrect.x = 0;
- dstrect.y += font.height;
- } else {
- dstrect.x += font.width;
- }
+ dstrect.x += font.width;
}
}