feat: integrate TUI module and apply professional refactoring

This commit is contained in:
2026-04-16 20:39:48 +00:00
parent 42529be0f8
commit 72e0ef4022
18 changed files with 1340 additions and 2106 deletions

29
include/tui.h Normal file
View File

@@ -0,0 +1,29 @@
#ifndef ASCII3D_TUI_H
#define ASCII3D_TUI_H
#include "renderer.h"
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
// Reconfigures standard input to be non-blocking and disables canonical mode.
// This allows us to poll the keyboard gracefully in the render loop.
int tui_init(void);
// Restores terminal to its initial state to avoid leaving users with a broken
// prompt.
void tui_cleanup(void);
// Processes pending keys and updates application state.
// Standard typing appends to the text_buffer, while specific commands alter
// settings. Returns non-zero when an exit is requested.
int tui_process_input(RotationState *rotation, RenderSettings *settings,
char *text_buffer, size_t max_text_len);
#ifdef __cplusplus
}
#endif
#endif