play.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #ifndef PLAY_H
  2. #define PLAY_H
  3. #include "db.h"
  4. #include "deck.h"
  5. #include "door.h"
  6. #include <chrono>
  7. #include <random>
  8. class PlayCards {
  9. private:
  10. door::Door &door;
  11. DBData &db;
  12. std::mt19937 &rng;
  13. std::unique_ptr<door::Panel> spaceAceTriPeaks;
  14. std::unique_ptr<door::Panel> score_panel;
  15. std::unique_ptr<door::Panel> streak_panel;
  16. std::unique_ptr<door::Panel> left_panel;
  17. std::unique_ptr<door::Panel> cmd_panel;
  18. std::unique_ptr<door::Panel> make_score_panel();
  19. std::unique_ptr<door::Panel> make_tripeaks(void);
  20. std::unique_ptr<door::Panel> make_command_panel(void);
  21. std::unique_ptr<door::Panel> make_streak_panel(void);
  22. std::unique_ptr<door::Panel> make_left_panel(void);
  23. int hand;
  24. int total_hands;
  25. int play_card;
  26. int current_streak;
  27. int best_streak;
  28. int select_card; // the card the player selects, has state=1
  29. unsigned long score;
  30. Deck dp; // deckPanels
  31. int off_x, off_y;
  32. const int height = 3;
  33. std::chrono::_V2::system_clock::time_point play_day;
  34. door::ANSIColor deck_color;
  35. cards deck;
  36. cards state;
  37. void redraw(bool dealing);
  38. void bonus(void);
  39. public:
  40. PlayCards(door::Door &d, DBData &dbd, std::mt19937 &r);
  41. ~PlayCards();
  42. int play_cards(void);
  43. void init_values(void);
  44. door::renderFunction statusValue(door::ANSIColor status,
  45. door::ANSIColor value);
  46. door::renderFunction commandLineRender(door::ANSIColor bracket,
  47. door::ANSIColor inner,
  48. door::ANSIColor outer);
  49. };
  50. int play_cards(door::Door &door, DBData &db, std::mt19937 &rng);
  51. #endif