Posted to tcl by mookie at Tue Mar 24 01:34:44 GMT 2026view raw
- /*
- * TCL_BRIDGE.H
- * V3.5 Crystal Engine - The Dynamic Pool (Fixed)
- */
-
- #ifndef TCL_BRIDGE_H
- #define TCL_BRIDGE_H
-
- #include <SDL2/SDL.h>
- #include <stdbool.h>
- #include <tcl.h>
-
- // --- CONFIG ---
- #define MAX_WINDOWS 10
- #define MAX_ICONS 20
- #define MAX_MENU_ITEMS 10
- #define MAX_ACTIVE_WINDOWS 10
-
- // --- ICON STRUCT ---
- typedef struct {
- char *label;
- char *icon_code;
- int x, y;
- int w, h;
- } CrystalIcon;
-
- // --- WINDOW CONTAINER ---
- typedef struct {
- char *id;
- char *title;
- int x, y, w, h;
-
- // Styling
- int bg_r, bg_g, bg_b;
- int border_r, border_g, border_b;
-
- CrystalIcon icons[MAX_ICONS];
- int icon_count;
- } IconList;
-
- // --- MENU BAR STRUCT ---
- typedef struct {
- char *label;
- char *icon_code;
- char *target_window_id;
- } MenuItemData;
-
- typedef struct {
- MenuItemData items[MAX_MENU_ITEMS];
- int count;
- } MenuBarRegistry;
-
- // --- SYSTEM DROPDOWN STRUCT ---
- typedef struct {
- char *label;
- char *icon_code;
- char *target_id;
- } SystemItemData;
-
- typedef struct {
- SystemItemData items[MAX_MENU_ITEMS];
- int count;
- } SystemMenuRegistry;
-
- // --- WINDOW STATE POOL ---
- extern bool window_pool[MAX_ACTIVE_WINDOWS];
-
- typedef struct {
- char *id;
- int pool_index;
- } WindowState;
-
- extern WindowState window_states[];
- extern int window_state_count;
-
- // --- GLOBAL STATE ---
- extern IconList registry[];
- extern int registry_count;
- extern MenuBarRegistry menu_registry;
- extern SystemMenuRegistry system_registry;
- extern Tcl_Interp *interp;
-
- // --- API ---
- void init_tcl_bridge();
- void load_tcl_script(const char *filename);
-
- #endif
- ---
- Header file to the Di GHUI. Menus/labels are driven by tcl files.
- ---
- Playing voodoo has very weird phantom bugs. The args issued below segfaults if you try to add, or remove argument yet the argument count is correct for that proc. It still loads. and works in a very cool strange way. I'm tracking it down myself to ensure it's truly squished. Learning C, nothing does it best than reading the GHUI's goddess god code. A digital reality I've been long coding in Tcl before LLM's were a thing. The verbose log operations examples a menu click and a menu tile button clicked within the actual SDL's display box.
-
- [+] Fonts Loaded.
- [SYSTEM] TCL Bridge Initialized.
- [SYSTEM] Loading Script: scripts/system_menu.tcl
- [TCL ERROR] wrong # args: should be "define_window id title x y w h bg_r bg_g bg_b br_r br_g br_b"
- [SYSTEM] Loading Script: scripts/settings.tcl
- [BRIDGE] Defined Window: settings_window
- [BRIDGE] Registered Window: settings_window at index 0
- [SYSTEM] Loading Script: scripts/toy_box.tcl
- [BRIDGE] Defined Window: toy_box
- [BRIDGE] Registered Window: toy_box at index 1
- [SYSTEM] Loading Script: scripts/scan.tcl
- [BRIDGE] Defined Window: scan_window
- [BRIDGE] Registered Window: scan_window at index 2
- [SYSTEM] Loading Script: scripts/trinity.tcl
- [BRIDGE] Defined Window: trinity_window
- [BRIDGE] Registered Window: trinity_window at index 3
- [SYSTEM] Loading Script: scripts/compiler.tcl
- [BRIDGE] Defined Window: compile_window
- [BRIDGE] Registered Window: compile_window at index 4
- [SYSTEM] Loading Script: scripts/menubar.tcl
- V2.5 Dynamic Menu
- [ACTION] Clicked: System
- [SYSTEM ACTION] Settings
- [ACTION] Clicked: System
- [SYSTEM ACTION] About OurCrystal
- [SYSTEM] OurCrystal OS v3.5
- [ACTION] Clicked: Compile
- [ACTION] Clicked: Scan
- [ACTION] Clicked: Trinity
- [ACTION] Clicked: System
- [SYSTEM ACTION] Shutdown
- [SYSTEM] Shutting down...
- [SYSTEM] Initiating Shutdown Sequence...
-
Add a comment