Open Source Tomb Raider Engine
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

Menu.h 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. static const glm::vec4 textColor;
  22. static const glm::vec4 selectedColor;
  23. protected:
  24. virtual void showDialog(std::string msg, std::string btn1, std::string btn2,
  25. std::function<int (bool state)> callback = std::function<int (bool)>());
  26. virtual void ackDialog();
  27. virtual bool handleKeyboardDialog(KeyboardButton key, bool pressed);
  28. virtual bool handleMouseClickDialog(unsigned int x, unsigned int y,
  29. KeyboardButton button, bool released);
  30. virtual bool handleMouseScrollDialog(int xrel, int yrel);
  31. virtual void displayDialog();
  32. bool dialogState;
  33. std::string dialogText;
  34. std::string dialogButton1;
  35. std::string dialogButton2;
  36. std::function<int (bool state)> dialogFunction;
  37. bool visible;
  38. };
  39. Menu& getMenu();
  40. #endif