Open Source Tomb Raider Engine
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

Menu.h 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*!
  2. * \file include/Menu.h
  3. * \brief Menu 'overlay' interface
  4. *
  5. * \author xythobuz
  6. */
  7. #ifndef _MENU_H_
  8. #define _MENU_H_
  9. #include <functional>
  10. class Menu {
  11. public:
  12. virtual ~Menu() { }
  13. virtual int initialize() = 0;
  14. virtual void display() = 0;
  15. virtual void handleKeyboard(KeyboardButton key, bool pressed) = 0;
  16. virtual void handleMouseClick(unsigned int x, unsigned int y,
  17. KeyboardButton button, bool released) = 0;
  18. virtual void handleMouseScroll(int xrel, int yrel) = 0;
  19. bool isVisible() { return visible; }
  20. void setVisible(bool v) { visible = v; }
  21. protected:
  22. virtual void showDialog(std::string msg, std::string btn1, std::string btn2,
  23. std::function<int (bool state)> callback = std::function<int (bool)>());
  24. virtual void ackDialog();
  25. virtual bool handleKeyboardDialog(KeyboardButton key, bool pressed);
  26. virtual bool handleMouseClickDialog(unsigned int x, unsigned int y,
  27. KeyboardButton button, bool released);
  28. virtual bool handleMouseScrollDialog(int xrel, int yrel);
  29. virtual void displayDialog();
  30. bool dialogState;
  31. std::string dialogText;
  32. std::string dialogButton1;
  33. std::string dialogButton2;
  34. std::function<int (bool state)> dialogFunction;
  35. bool visible;
  36. };
  37. Menu& getMenu();
  38. #endif