Posted to tcl by mookie at Thu Sep 17 13:40:32 GMT 2026view raw

  1. #include <ncurses.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <unistd.h>
  5. #include <time.h> // Required for time()
  6.  
  7. void draw_footer() {
  8. int row, col;
  9. getmaxyx(stdscr, row, col);
  10.  
  11. // Move to the bottom
  12. move(row - 2, 0);
  13.  
  14. // Draw a line of dashes for the top of the bar
  15. for(int i = 0; i < col; i++) {
  16. addch('-');
  17. }
  18.  
  19. // Print status text on the last line
  20. move(row - 1, 0);
  21.  
  22. // Get current time
  23. time_t t = time(NULL);
  24. struct tm *tm = localtime(&t);
  25. char time_str[20];
  26. strftime(time_str, sizeof(time_str), "%H:%M:%S", tm);
  27.  
  28. printw(" STATUS: ONLINE | CRYSTAL FOREST | TIME: %s ", time_str);
  29. }
  30.  
  31. int main() {
  32. char ip_address[50];
  33.  
  34. initscr();
  35. cbreak();
  36. keypad(stdscr, TRUE);
  37. noecho();
  38. curs_set(0); // Hide cursor for a cleaner look
  39.  
  40. // Draw the Footer first (it sits at the bottom)
  41. draw_footer();
  42.  
  43. // Draw the Title at the top
  44. mvprintw(1, (COLS - 27) / 2, "NEONCRYSTAL TUI SYSTEM v1.0");
  45. refresh();
  46.  
  47. // Draw the Connection Box in the center
  48. int height = 5;
  49. int width = 40;
  50. int starty = (LINES - height) / 2;
  51. int startx = (COLS - width) / 2;
  52.  
  53. WINDOW *my_win = newwin(height, width, starty, startx);
  54. box(my_win, 0, 0);
  55.  
  56. mvwprintw(my_win, 1, 1, "BANDIT BALLOON CONNECTION");
  57. mvwprintw(my_win, 2, 1, "Target IP:");
  58. wrefresh(my_win);
  59.  
  60. // Enable echo for typing
  61. echo();
  62. mvwgetnstr(my_win, 3, 2, ip_address, 49);
  63. noecho();
  64.  
  65. // Update Footer with connection status
  66. move(LINES - 1, 0);
  67. clrtoeol(); // Clear the previous text
  68. mvprintw(LINES - 1, 0, " STATUS: CONNECTING TO %s...", ip_address);
  69. refresh();
  70.  
  71. sleep(2); // Simulate connection
  72.  
  73. // Success
  74. mvprintw(LINES / 2, (COLS - 25) / 2, "NEONCRYSTAL WELCOMES YOU");
  75. refresh();
  76.  
  77. getch(); // Wait for input
  78. endwin();
  79. return 0;
  80. }

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