💿🐜 Antkeeper source code https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

107 lines
2.5 KiB

  1. /*
  2. * Copyright (C) 2020 Christopher J. Howard
  3. *
  4. * This file is part of Antkeeper source code.
  5. *
  6. * Antkeeper source code is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * Antkeeper source code is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef ANTKEEPER_UI_SYSTEM_HPP
  20. #define ANTKEEPER_UI_SYSTEM_HPP
  21. #include "event/event-handler.hpp"
  22. #include "input/input-events.hpp"
  23. #include "scene/scene.hpp"
  24. #include "scene/camera.hpp"
  25. #include "scene/directional-light.hpp"
  26. #include "scene/ambient-light.hpp"
  27. #include "scene/model-instance.hpp"
  28. #include "scene/billboard.hpp"
  29. #include "renderer/material.hpp"
  30. #include <vmq/vmq.hpp>
  31. using namespace vmq::types;
  32. class control;
  33. class scene;
  34. class resource_manager;
  35. class ui_system:
  36. public event_handler<mouse_moved_event>
  37. {
  38. public:
  39. ui_system(::resource_manager* resource_manager);
  40. void update(float dt);
  41. void set_viewport(const float4& viewport);
  42. void set_tool_menu_control(control* control);
  43. const ::scene* get_scene() const;
  44. ::scene* get_scene();
  45. const ::camera* get_camera() const;
  46. ::camera* get_camera();
  47. private:
  48. virtual void handle_event(const mouse_moved_event& event);
  49. void open_tool_menu();
  50. void close_tool_menu();
  51. void open_elevator_menu();
  52. void close_elevator_menu();
  53. ::resource_manager* resource_manager;
  54. ::scene scene;
  55. ::camera camera;
  56. ambient_light indirect_light;
  57. directional_light direct_light;
  58. model_instance tool_selector_ant;
  59. billboard tool_selector_bg;
  60. material modal_bg_material;
  61. billboard modal_bg;
  62. billboard underground_bg;
  63. model_instance energy_symbol;
  64. float2 mouse_position;
  65. float4 viewport;
  66. float2 viewport_center;
  67. float2 tool_selection_vector;
  68. control* tool_menu_control;
  69. };
  70. inline const scene* ui_system::get_scene() const
  71. {
  72. return &scene;
  73. }
  74. inline scene* ui_system::get_scene()
  75. {
  76. return &scene;
  77. }
  78. inline const camera* ui_system::get_camera() const
  79. {
  80. return &camera;
  81. }
  82. inline camera* ui_system::get_camera()
  83. {
  84. return &camera;
  85. }
  86. #endif // ANTKEEPER_UI_SYSTEM_HPP