summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2020-12-27 15:48:59 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2020-12-27 15:48:59 -0500
commitc38e418286c5cc2e8af7f68de9483d9cdcf95dce (patch)
tree461a7ce91748ac506fa31e7c918ab5ba6f6d8b14 /main.c
parent0fcc0682080da33edc81fa98c450a904165d5b5a (diff)
only render visible lines
Diffstat (limited to 'main.c')
-rw-r--r--main.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/main.c b/main.c
index ae197ac..763decd 100644
--- a/main.c
+++ b/main.c
@@ -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);
}