card.h 704 B

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef _CARD_
  2. #define _CARD_
  3. #include <stdio.h>
  4. #include "anim.h"
  5. /* Card
  6. * To use this class, there must be a pointer that points to Card.
  7. * Give pointer's address to static card double pointer (below).
  8. * Initialize pointer to point to a Card's subclass.
  9. * Use the pointer for input, update and drawing, the subclasses will
  10. * take care of changing which card it points to.
  11. */
  12. class Card
  13. {
  14. public:
  15. //Pointer to current card pointer
  16. static Card *card;
  17. //Card lifecycle
  18. Card();
  19. virtual ~Card() {}
  20. virtual void input(unsigned char key, bool pressed) = 0;
  21. virtual void update() = 0;
  22. virtual void draw();
  23. protected:
  24. //Card animation (from one card to another)
  25. Animation anim;
  26. };
  27. #endif