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.

39 lines
882 B

  1. #pragma once
  2. #include <curses.h>
  3. #include <string>
  4. static constexpr int UP = KEY_UP;
  5. static constexpr int DOWN = KEY_DOWN;
  6. static constexpr int LEFT = KEY_LEFT;
  7. static constexpr int RIGHT = KEY_RIGHT;
  8. static constexpr int EXIT_GAME = 'q';
  9. static constexpr int GAME_TOP_WALL_Y = 1;
  10. const int GAME_BOTTOM_WALL_Y = LINES - 4;
  11. static constexpr int GAME_LEFT_WALL_X = 1;
  12. const int GAME_RIGHT_WALL_X = COLS - 2;
  13. class Graphics {
  14. private:
  15. unsigned int sleep_time_ = 40000000;
  16. WINDOW* box_ = NULL;
  17. Graphics();
  18. void createBox();
  19. void destroyBox();
  20. public:
  21. static Graphics& get();
  22. void init(const std::string& game_name);
  23. void finalize();
  24. void refreshScreen();
  25. void printChar(int y, int x, int img);
  26. void printMsg(int y, int x, const std::string& str);
  27. char readChar(int y, int x);
  28. int readInpt();
  29. void advanceDifficulty();
  30. };