Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

tty.h 1.7KB

5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
5 år sedan
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*------------ -------------- -------- --- ----- --- -- - -
  2. * Libre Blackjack - tty interactive player
  3. *
  4. * Copyright (C) 2020 jeremy theler
  5. *
  6. * This file is part of Libre Blackjack.
  7. *
  8. * Libre Blackjack is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * Libre Blackjack is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with Libre Blackjack. If not, see <http://www.gnu.org/licenses/>.
  20. *------------------- ------------ ---- -------- -- - - -
  21. */
  22. #ifndef TTY_H
  23. #define TTY_H
  24. #include "blackjack.h"
  25. class Tty : public Player {
  26. public:
  27. Tty(Configuration &);
  28. ~Tty() { };
  29. int play() override;
  30. void info(Info = Info::None, int = 0) override;
  31. private:
  32. void renderHand(Hand *);
  33. void renderTable(void);
  34. #ifdef HAVE_LIBREADLINE
  35. char *input_buffer;
  36. #else
  37. std::string input_buffer;
  38. #endif
  39. std::string arrow;
  40. std::string prompt;
  41. int delay = 200;
  42. std::string black = "\x1B[0m";
  43. std::string red = "\x1B[31m";
  44. std::string green = "\x1B[32m";
  45. std::string yellow = "\x1B[33m";
  46. std::string blue = "\x1B[34m";
  47. std::string magenta = "\x1B[35m";
  48. std::string cyan = "\x1B[36m";
  49. std::string white = "\x1B[37m";
  50. std::string reset = "\033[0m";
  51. };
  52. #endif