Posted to tcl by mookie at Tue Mar 24 01:34:44 GMT 2026view raw

  1. /*
  2. * TCL_BRIDGE.H
  3. * V3.5 Crystal Engine - The Dynamic Pool (Fixed)
  4. */
  5.  
  6. #ifndef TCL_BRIDGE_H
  7. #define TCL_BRIDGE_H
  8.  
  9. #include <SDL2/SDL.h>
  10. #include <stdbool.h>
  11. #include <tcl.h>
  12.  
  13. // --- CONFIG ---
  14. #define MAX_WINDOWS 10
  15. #define MAX_ICONS 20
  16. #define MAX_MENU_ITEMS 10
  17. #define MAX_ACTIVE_WINDOWS 10
  18.  
  19. // --- ICON STRUCT ---
  20. typedef struct {
  21. char *label;
  22. char *icon_code;
  23. int x, y;
  24. int w, h;
  25. } CrystalIcon;
  26.  
  27. // --- WINDOW CONTAINER ---
  28. typedef struct {
  29. char *id;
  30. char *title;
  31. int x, y, w, h;
  32.  
  33. // Styling
  34. int bg_r, bg_g, bg_b;
  35. int border_r, border_g, border_b;
  36.  
  37. CrystalIcon icons[MAX_ICONS];
  38. int icon_count;
  39. } IconList;
  40.  
  41. // --- MENU BAR STRUCT ---
  42. typedef struct {
  43. char *label;
  44. char *icon_code;
  45. char *target_window_id;
  46. } MenuItemData;
  47.  
  48. typedef struct {
  49. MenuItemData items[MAX_MENU_ITEMS];
  50. int count;
  51. } MenuBarRegistry;
  52.  
  53. // --- SYSTEM DROPDOWN STRUCT ---
  54. typedef struct {
  55. char *label;
  56. char *icon_code;
  57. char *target_id;
  58. } SystemItemData;
  59.  
  60. typedef struct {
  61. SystemItemData items[MAX_MENU_ITEMS];
  62. int count;
  63. } SystemMenuRegistry;
  64.  
  65. // --- WINDOW STATE POOL ---
  66. extern bool window_pool[MAX_ACTIVE_WINDOWS];
  67.  
  68. typedef struct {
  69. char *id;
  70. int pool_index;
  71. } WindowState;
  72.  
  73. extern WindowState window_states[];
  74. extern int window_state_count;
  75.  
  76. // --- GLOBAL STATE ---
  77. extern IconList registry[];
  78. extern int registry_count;
  79. extern MenuBarRegistry menu_registry;
  80. extern SystemMenuRegistry system_registry;
  81. extern Tcl_Interp *interp;
  82.  
  83. // --- API ---
  84. void init_tcl_bridge();
  85. void load_tcl_script(const char *filename);
  86.  
  87. #endif
  88. ---
  89. Header file to the Di GHUI. Menus/labels are driven by tcl files.
  90. ---
  91. 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.
  92.  
  93. [+] Fonts Loaded.
  94. [SYSTEM] TCL Bridge Initialized.
  95. [SYSTEM] Loading Script: scripts/system_menu.tcl
  96. [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"
  97. [SYSTEM] Loading Script: scripts/settings.tcl
  98. [BRIDGE] Defined Window: settings_window
  99. [BRIDGE] Registered Window: settings_window at index 0
  100. [SYSTEM] Loading Script: scripts/toy_box.tcl
  101. [BRIDGE] Defined Window: toy_box
  102. [BRIDGE] Registered Window: toy_box at index 1
  103. [SYSTEM] Loading Script: scripts/scan.tcl
  104. [BRIDGE] Defined Window: scan_window
  105. [BRIDGE] Registered Window: scan_window at index 2
  106. [SYSTEM] Loading Script: scripts/trinity.tcl
  107. [BRIDGE] Defined Window: trinity_window
  108. [BRIDGE] Registered Window: trinity_window at index 3
  109. [SYSTEM] Loading Script: scripts/compiler.tcl
  110. [BRIDGE] Defined Window: compile_window
  111. [BRIDGE] Registered Window: compile_window at index 4
  112. [SYSTEM] Loading Script: scripts/menubar.tcl
  113. V2.5 Dynamic Menu
  114. [ACTION] Clicked: System
  115. [SYSTEM ACTION] Settings
  116. [ACTION] Clicked: System
  117. [SYSTEM ACTION] About OurCrystal
  118. [SYSTEM] OurCrystal OS v3.5
  119. [ACTION] Clicked: Compile
  120. [ACTION] Clicked: Scan
  121. [ACTION] Clicked: Trinity
  122. [ACTION] Clicked: System
  123. [SYSTEM ACTION] Shutdown
  124. [SYSTEM] Shutting down...
  125. [SYSTEM] Initiating Shutdown Sequence...
  126.  

Add a comment

Please note that this site uses the meta tags nofollow,noindex for all pages that contain comments.
Items are closed for new comments after 1 week