summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcflip <cflip@cflip.net>2023-01-12 12:28:41 -0700
committercflip <cflip@cflip.net>2023-01-12 12:28:41 -0700
commitc59f63a5be50c54ca4f38f48e2dc82d8d8fd012a (patch)
tree951cf6fd019574030909a4e36db8d4abd96c0d02
parent4c150aab138f5733d29ad4548d66764fe19ffc44 (diff)
Add a cursor
-rw-r--r--window.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/window.c b/window.c
index 9d10f85..1c300b7 100644
--- a/window.c
+++ b/window.c
@@ -105,6 +105,16 @@ void window_redraw(struct editor_state *editor)
draw_font_text(&buffer);
+ SDL_Rect cursor_rect;
+ cursor_rect.x = editor->cursor_display_x * font.width;
+ cursor_rect.y = (editor->cursor_y - editor->row_offset) * font.height;
+ cursor_rect.w = font.width;
+ cursor_rect.h = font.height;
+
+ SDL_SetRenderDrawColor(renderer, 0x7f, 0x7f, 0x7f, 0xff);
+ SDL_RenderFillRect(renderer, &cursor_rect);
+ SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0x00, 0xff);
+
SDL_RenderPresent(renderer);
SDL_UpdateWindowSurface(window);
}