terminal.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #ifndef TERMINAL_H
  2. #define TERMINAL_H
  3. #include <string>
  4. // TODO: add class. :P
  5. struct console_details {
  6. int posx, posy;
  7. int savedx, savedy;
  8. char ansi[20]; // current ANSI command being processed.
  9. int in_ansi;
  10. int fgcolor; // 0-7 // not 0-15
  11. int bgcolor; // 0-7
  12. int status; // 0, 1 or 5 (Blink)
  13. };
  14. enum ANSI_TYPE { START, CURSOR, COLOR, CLEAR, OTHER };
  15. struct termchar {
  16. int in_ansi;
  17. ANSI_TYPE ansi; // undefined if in_ansi is false
  18. };
  19. void console_init(struct console_details *cdp);
  20. void ansi_color(struct console_details *cdp, int color);
  21. const char *color_restore(struct console_details *cdp);
  22. ANSI_TYPE console_ansi(struct console_details *cdp, const char *ansi);
  23. termchar console_char(struct console_details *cdp, char ch);
  24. void console_receive(struct console_details *cdp, std::string chars);
  25. /* // These should no longer be needed or used //
  26. void console_string(struct console_details *cdp, const char *chars);
  27. void console_receive(struct console_details *cdp, const char *chars, int len);
  28. */
  29. #endif