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

84 lines
2.4 KiB

  1. /*
  2. * Copyright (C) 2023 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_APP_WINDOW_MANAGER_HPP
  20. #define ANTKEEPER_APP_WINDOW_MANAGER_HPP
  21. #include <engine/app/display.hpp>
  22. #include <engine/app/window.hpp>
  23. #include <engine/math/vector.hpp>
  24. #include <string>
  25. namespace app {
  26. /**
  27. *
  28. */
  29. class window_manager
  30. {
  31. public:
  32. /**
  33. * Allocates and returns a window manager.
  34. */
  35. static window_manager* instance();
  36. /// Destructs a window manager.
  37. virtual ~window_manager() = default;
  38. /**
  39. * Updates all managed windows. This should be called once per frame.
  40. */
  41. virtual void update() = 0;
  42. /**
  43. * Constructs a window.
  44. *
  45. * @param title Title of the window.
  46. * @param windowed_position Windowed (non-maximized, non-fullscreen) position of the window, in display units.
  47. * @param windowed_size Windowed (non-maximized, non-fullscreen) size of the window, in display units.
  48. * @param maximized `true` if the window should start maximized, `false` otherwise.
  49. * @param fullscreen `true` if the window should start fullscreen, `false` otherwise.
  50. * @param v_sync `true` if v-sync should be enabled, `false` otherwise.
  51. */
  52. [[nodiscard]] virtual window* create_window
  53. (
  54. const std::string& title,
  55. const math::vector<int, 2>& windowed_position,
  56. const math::vector<int, 2>& windowed_size,
  57. bool maximized,
  58. bool fullscreen,
  59. bool v_sync
  60. ) = 0;
  61. /// Returns the number of available displays.
  62. [[nodiscard]] virtual std::size_t get_display_count() const = 0;
  63. /**
  64. * Returns the display with the given index.
  65. *
  66. * @param index Index of a display.
  67. *
  68. * @return Display with the given index.
  69. */
  70. [[nodiscard]] virtual const display& get_display(std::size_t index) const = 0;
  71. };
  72. } // namespace app
  73. #endif // ANTKEEPER_APP_WINDOW_MANAGER_HPP