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

82 lines
2.3 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_SDL_WINDOW_HPP
  20. #define ANTKEEPER_APP_SDL_WINDOW_HPP
  21. #include <engine/app/window.hpp>
  22. #include <SDL2/SDL.h>
  23. #include <memory>
  24. namespace app {
  25. /**
  26. *
  27. */
  28. class sdl_window: public window
  29. {
  30. public:
  31. sdl_window
  32. (
  33. const std::string& title,
  34. const math::ivec2& windowed_position,
  35. const math::ivec2& windowed_size,
  36. bool maximized,
  37. bool fullscreen,
  38. bool v_sync
  39. );
  40. sdl_window(const sdl_window&) = delete;
  41. sdl_window(sdl_window&&) = delete;
  42. sdl_window& operator=(const sdl_window&) = delete;
  43. sdl_window& operator=(sdl_window&&) = delete;
  44. virtual ~sdl_window();
  45. void set_title(const std::string& title) override;
  46. void set_position(const math::ivec2& position) override;
  47. void set_size(const math::ivec2& size) override;
  48. void set_minimum_size(const math::ivec2& size) override;
  49. void set_maximum_size(const math::ivec2& size) override;
  50. void set_maximized(bool maximized) override;
  51. void set_fullscreen(bool fullscreen) override;
  52. void set_v_sync(bool v_sync) override;
  53. void make_current() override;
  54. void swap_buffers() override;
  55. [[nodiscard]] inline const gl::pipeline& get_graphics_pipeline() const noexcept override
  56. {
  57. return *m_graphics_pipeline;
  58. }
  59. [[nodiscard]] inline gl::pipeline& get_graphics_pipeline() noexcept override
  60. {
  61. return *m_graphics_pipeline;
  62. }
  63. private:
  64. friend class sdl_window_manager;
  65. SDL_Window* m_internal_window;
  66. SDL_GLContext m_internal_context;
  67. std::unique_ptr<gl::pipeline> m_graphics_pipeline;
  68. };
  69. } // namespace app
  70. #endif // ANTKEEPER_APP_SDL_WINDOW_HPP