Space Walk board game
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

76 lines
1.5 KiB

  1. #ifndef WINDOW_H
  2. #define WINDOW_H
  3. #define COLOR_UNSET 0
  4. #define COLOR_BLACK_BRIGHT 8
  5. #define COLOR_RED_BRIGHT 9
  6. #define COLOR_GREEN_BRIGHT 10
  7. #define COLOR_YELLOW_BRIGHT 11
  8. #define COLOR_BLUE_BRIGHT 12
  9. #define COLOR_MAGENTA_BRIGHT 13
  10. #define COLOR_CYAN_BRIGHT 14
  11. #define COLOR_WHITE_BRIGHT 15
  12. #define COLOR_GRAY 16
  13. #define PAIR_WHITE_BLACK 1
  14. #define PAIR_WHITE_BRIGHT_BLACK 2
  15. #define PAIR_RED_BLACK 3
  16. #define PAIR_BLUE_BLACK 4
  17. #define PAIR_GRAY_BLACK_BRIGHT 5
  18. #include <ncurses.h>
  19. #include <string>
  20. class Window
  21. {
  22. public:
  23. Window(int rows, int cols, int y, int x);
  24. ~Window();
  25. static void initialize();
  26. void update();
  27. void render();
  28. static void destroy();
  29. void clear();
  30. void resize();
  31. void print(std::string str, char newLine = 1);
  32. void print(std::string str, int y, int x);
  33. void print(std::string str, int y, int x, int attribute);
  34. void printCenter(std::string str);
  35. void printCenter(std::string str, int attribute);
  36. void printSide(std::string left, std::string right);
  37. void getYX(int &y, int &x);
  38. void setYX(int y, int x);
  39. void getMaXYZ(int &rows, int &cols);
  40. static void getMaXYZ(WINDOW *window, int &rows, int &cols);
  41. std::string getStr();
  42. int getMaxRows();
  43. int getMaxCols();
  44. int getRows();
  45. void setRows(int rows);
  46. int getCols();
  47. void setCols(int cols);
  48. int getY();
  49. void setY(int y);
  50. int getX();
  51. void setX(int x);
  52. void setWindow(int rows, int cols, int y, int x);
  53. protected:
  54. Window();
  55. private:
  56. int maxRows;
  57. int maxCols;
  58. int rows;
  59. int cols;
  60. int y;
  61. int x;
  62. WINDOW *window;
  63. };
  64. #endif // WINDOW_H