vtgl

terminal emulator implemented in OpenGL
git clone anongit@rnpnr.xyz:vtgl.git
Log | Files | Refs | Feed | LICENSE

Commit: f96a116fb8a0d2e1a05f5cf9e0a0f751c5f395c3
Parent: 7bc8c18da4aae7937d54a4a6735b2c4c80c5ace6
Author: Randy Palamar
Date:   Mon,  2 Sep 2024 20:23:14 -0600

refactor do_debug to make GLCtx * optional

This makes it possible to reorder a few things during init to
allow for some options passed to main. Importantly it makes it
possible to determine the Cell size prior to opening the window.

Diffstat:
Mmain.c | 15++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/main.c b/main.c @@ -7,7 +7,7 @@ #include "util.h" #ifndef _DEBUG -static void do_debug(GLCtx *gl) { } +#define do_debug(...) #include "vtgl.c" #else #include <dlfcn.h> @@ -57,8 +57,10 @@ do_debug(GLCtx *gl) struct timespec sleep_time = { .tv_nsec = 100e6 }; nanosleep(&sleep_time, &sleep_time); load_library(libname); - init_callbacks(gl); - gl->flags |= NEEDS_BLIT; + if (gl) { + init_callbacks(gl); + gl->flags |= NEEDS_BLIT; + } fputs("Reloaded Main Program\n", stderr); } } @@ -276,9 +278,10 @@ main(void) Arena memory = os_new_arena(16 * MEGABYTE); Term term = {0}; - init_window(&term, memory); - do_debug(&term.gl); + do_debug(NULL); init_term(&term, &memory); + init_window(&term, memory); + init_callbacks(&term.gl); os_alloc_ring_buffer(&term.views[0].log, BACKLOG_SIZE); line_buf_alloc(&term.views[0].lines, &memory, term.views[0].log.buf, term.cursor.style, @@ -289,8 +292,6 @@ main(void) term.child = os_fork_child("/bin/sh"); - init_callbacks(&term.gl); - f32 last_time = 0; while (!glfwWindowShouldClose(term.gl.window)) { do_debug(&term.gl);