diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2020-11-24 17:03:23 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2020-11-24 17:03:23 -0500 |
commit | e3aa668ef358739148adb1a4965b629d07467575 (patch) | |
tree | dddffef533139b5cc380783f45f17fce054f3480 /main.c | |
parent | 55d0ece0a9072ca409bdf6ff2f3b6d0b268e2952 (diff) |
loading a file
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -5,6 +5,7 @@ no_warn_end #include <GL/gl.h> #include <locale.h> #include "text.h" +#include "buffer.c" static void die(char const *fmt, ...) { char buf[256] = {0}; @@ -47,6 +48,18 @@ int main(void) { } bool quit = false; + TextBuffer text_buffer; + + { + FILE *fp = fopen("main.c", "r"); + assert(fp); + bool success = text_buffer_load_file(&text_buffer, fp); + fclose(fp); + if (!success) + die("Error loading file."); + } + + while (!quit) { SDL_Event event; while (SDL_PollEvent(&event)) { @@ -77,12 +90,15 @@ int main(void) { break; } + //text_buffer_print_debug(&text_buffer); + SDL_GL_SwapWindow(window); } SDL_GL_DeleteContext(glctx); SDL_DestroyWindow(window); SDL_Quit(); + text_buffer_free(&text_buffer); text_font_free(font); return 0; |