summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2020-11-24 17:03:23 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2020-11-24 17:03:23 -0500
commite3aa668ef358739148adb1a4965b629d07467575 (patch)
treedddffef533139b5cc380783f45f17fce054f3480 /main.c
parent55d0ece0a9072ca409bdf6ff2f3b6d0b268e2952 (diff)
loading a file
Diffstat (limited to 'main.c')
-rw-r--r--main.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/main.c b/main.c
index f2aa450..6ba157b 100644
--- a/main.c
+++ b/main.c
@@ -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;