💿🐜 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.

89 lines
2.4 KiB

  1. /*
  2. * Copyright (C) 2021 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_ECS_UI_SYSTEM_HPP
  20. #define ANTKEEPER_ECS_UI_SYSTEM_HPP
  21. #include "event/event-handler.hpp"
  22. #include "event/input-events.hpp"
  23. #include "event/window-events.hpp"
  24. #include "scene/collection.hpp"
  25. #include "scene/camera.hpp"
  26. #include "scene/directional-light.hpp"
  27. #include "scene/ambient-light.hpp"
  28. #include "scene/model-instance.hpp"
  29. #include "scene/billboard.hpp"
  30. #include "renderer/material.hpp"
  31. #include "math/math.hpp"
  32. #include "input/control.hpp"
  33. class resource_manager;
  34. namespace ecs {
  35. class ui_system:
  36. public event_handler<mouse_moved_event>,
  37. public event_handler<window_resized_event>
  38. {
  39. public:
  40. ui_system(::resource_manager* resource_manager);
  41. void update(float dt);
  42. void set_viewport(const float4& viewport);
  43. void set_tool_menu_control(input::control* control);
  44. void set_camera(scene::camera* camera);
  45. void set_scene(scene::collection* collection);
  46. private:
  47. virtual void handle_event(const mouse_moved_event& event);
  48. virtual void handle_event(const window_resized_event& event);
  49. void update_projection();
  50. void open_tool_menu();
  51. void close_tool_menu();
  52. void open_elevator_menu();
  53. void close_elevator_menu();
  54. resource_manager* resource_manager;
  55. scene::collection* scene_collection;
  56. scene::camera* camera;
  57. scene::ambient_light indirect_light;
  58. scene::directional_light direct_light;
  59. scene::billboard tool_selector_bg;
  60. material modal_bg_material;
  61. scene::billboard modal_bg;
  62. scene::billboard underground_bg;
  63. scene::model_instance energy_symbol;
  64. float2 mouse_position;
  65. float4 viewport;
  66. float2 viewport_center;
  67. float2 tool_selection_vector;
  68. input::control* tool_menu_control;
  69. };
  70. } // namespace ecs
  71. #endif // ANTKEEPER_ECS_UI_SYSTEM_HPP