diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2020-12-27 15:48:59 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2020-12-27 15:48:59 -0500 |
commit | c38e418286c5cc2e8af7f68de9483d9cdcf95dce (patch) | |
tree | 461a7ce91748ac506fa31e7c918ab5ba6f6d8b14 /main.c | |
parent | 0fcc0682080da33edc81fa98c450a904165d5b5a (diff) |
only render visible lines
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -76,13 +76,17 @@ int main(void) { TextBuffer text_buffer; buffer_create(&text_buffer, font); - if (!buffer_load_file(&text_buffer, "test.txt")) + if (!buffer_load_file(&text_buffer, "buffer.c")) die("Error loading file: %s", buffer_geterr(&text_buffer)); Uint32 time_at_last_frame = SDL_GetTicks(); while (!quit) { + #if DEBUG + printf("\033[H\033[2J"); fflush(stdout); + #endif + SDL_Event event; Uint8 const *keyboard_state = SDL_GetKeyboardState(NULL); bool ctrl = keyboard_state[SDL_SCANCODE_LCTRL] || keyboard_state[SDL_SCANCODE_RCTRL]; @@ -216,10 +220,11 @@ int main(void) { } } + #if DEBUG //buffer_print_debug(&text_buffer); buffer_check_valid(&text_buffer); - printf("\033[H\033[2J"); fflush(stdout); buffer_print_undo_history(&text_buffer); + #endif SDL_GL_SwapWindow(window); } |