deck.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include "door.h"
  2. #include <random>
  3. #include <string>
  4. #include <vector>
  5. /*
  6. I tried card_height = 5, but the cards looked a little too stretched out/tall.
  7. 3 looks good.
  8. Spacing 1 or 3. 1 is what was used before, 3 looks better, takes up more
  9. screenspace. And I have plenty, even on 80x23.
  10. */
  11. class Deck {
  12. private:
  13. door::ANSIColor cardback;
  14. vector<door::Panel *> cards;
  15. vector<door::Panel *> backs;
  16. door::Panel *card_of(int c);
  17. std::string back_char(int level);
  18. door::Panel *back_of(int level);
  19. int is_rank(int c);
  20. int is_suit(int c);
  21. void init(void);
  22. char rank_symbol(int c);
  23. std::string suit_symbol(int c);
  24. int card_height;
  25. public:
  26. enum SUIT { HEART, DIAMOND, CLUBS, SPADE };
  27. Deck(int size = 3);
  28. Deck(door::ANSIColor backcolor, int size = 3);
  29. ~Deck();
  30. door::Panel *card(int c);
  31. door::Panel *back(int level);
  32. void part(int x, int y, door::Door &d, int level, bool left);
  33. };
  34. void cardgo(int pos, int space, int h, int &x, int &y, int &level);
  35. vector<int> card_shuffle(std::seed_seq &seed, int decks = 1);