SdlWindowApi.hpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * author: Patrick-Christopher Mattulat
  3. * e-mail: webmaster@lynarstudios.com
  4. */
  5. #ifndef LS_ATLANTIS_ENGINE_WINDOW_SDL_WINDOW_API_HPP
  6. #define LS_ATLANTIS_ENGINE_WINDOW_SDL_WINDOW_API_HPP
  7. #include <Export.hpp>
  8. #include <interface/AStatusCode.hpp>
  9. #include <interface/ISdlApi.hpp>
  10. #include <interface/IWindowApi.hpp>
  11. #include <functional>
  12. #include <memory>
  13. namespace ls::atlantis::window
  14. {
  15. class LS_ATLANTIS_DYNAMIC_GOAL SdlWindowApi : public ls::atlantis::interfaces::IWindowApi
  16. {
  17. public:
  18. SdlWindowApi();
  19. explicit SdlWindowApi(const ::std::shared_ptr<ls::atlantis::interfaces::ISdlApi> &_sdlApi);
  20. ~SdlWindowApi() override;
  21. [[nodiscard]] ::std::shared_ptr<ls::atlantis::interfaces::AStatusCode> init() override;
  22. private:
  23. [[nodiscard]] ::std::shared_ptr<ls::atlantis::interfaces::AStatusCode> _createWindow();
  24. [[nodiscard]] ::std::shared_ptr<ls::atlantis::interfaces::AStatusCode> _initApi() const;
  25. ::std::shared_ptr<ls::atlantis::interfaces::ISdlApi> sdlApi{};
  26. ::std::unique_ptr<SDL_Window, ::std::function<void(SDL_Window *)>> window{nullptr, [](SDL_Window *) {}};
  27. };
  28. }
  29. #endif