diff options
author | cflip <cflip@cflip.net> | 2023-01-12 12:28:41 -0700 |
---|---|---|
committer | cflip <cflip@cflip.net> | 2023-01-12 12:28:41 -0700 |
commit | c59f63a5be50c54ca4f38f48e2dc82d8d8fd012a (patch) | |
tree | 951cf6fd019574030909a4e36db8d4abd96c0d02 | |
parent | 4c150aab138f5733d29ad4548d66764fe19ffc44 (diff) |
Add a cursor
-rw-r--r-- | window.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -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); } |