Character.h 890 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // This may look like C code, but it's really -*- C++ -*-
  2. /*
  3. * Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.
  4. *
  5. * See the LICENSE file for terms of use.
  6. */
  7. #ifndef CHARACTER_H_
  8. #define CHARACTER_H_
  9. #include <Wt/WText>
  10. using namespace Wt;
  11. /**
  12. * @addtogroup dragexample
  13. */
  14. /*@{*/
  15. /*! \brief A Matrix character that takes red and/or blue pills.
  16. *
  17. * The Character class demonstrates how to accept and react to drop
  18. * events.
  19. */
  20. class Character : public WText
  21. {
  22. public:
  23. /*! \brief Create a new character with the given name.
  24. */
  25. Character(const std::string& name, WContainerWidget *parent = 0);
  26. /*! \brief React to a drop event.
  27. */
  28. void dropEvent(WDropEvent event);
  29. private:
  30. //! The name
  31. std::string name_;
  32. //! The current number of red pills.
  33. int redDrops_;
  34. //! The current number of blue pills.
  35. int blueDrops_;
  36. };
  37. /*@}*/
  38. #endif // CHARACTER_H_