VideoDriver.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #pragma once
  2. #include "WallpaperEngine/Input/InputContext.h"
  3. #include "WallpaperEngine/Input/MouseInput.h"
  4. #include "WallpaperEngine/Render/Drivers/Output/Output.h"
  5. #include <glm/vec2.hpp>
  6. #include <glm/vec4.hpp>
  7. #include <string>
  8. namespace WallpaperEngine::Application {
  9. class WallpaperApplication;
  10. }
  11. namespace WallpaperEngine::Input {
  12. class InputContext;
  13. class CWaylandMouseInput;
  14. }
  15. namespace WallpaperEngine::Render::Drivers {
  16. namespace Detectors {
  17. class FullScreenDetector;
  18. }
  19. class VideoDriver {
  20. public:
  21. explicit VideoDriver (WallpaperApplication& app, Input::MouseInput& mouseInput);
  22. virtual ~VideoDriver () = default;
  23. [[nodiscard]] virtual Output::Output& getOutput () = 0;
  24. [[nodiscard]] virtual float getRenderTime () const = 0;
  25. virtual bool closeRequested () = 0;
  26. virtual void resizeWindow (glm::ivec2 size) = 0;
  27. virtual void resizeWindow (glm::ivec4 positionAndSize) = 0;
  28. virtual void showWindow () = 0;
  29. virtual void hideWindow () = 0;
  30. [[nodiscard]] virtual glm::ivec2 getFramebufferSize () const = 0;
  31. [[nodiscard]] virtual uint32_t getFrameCounter () const = 0;
  32. [[nodiscard]] virtual void* getProcAddress (const char* name) const = 0;
  33. /** The wl_display, if rendering goes through Wayland (mpv needs it for zero-copy hwdec) */
  34. [[nodiscard]] virtual void* getWaylandDisplay () const { return nullptr; }
  35. /** The X11 Display, if rendering goes through X11 (mpv needs it for zero-copy hwdec) */
  36. [[nodiscard]] virtual void* getX11Display () const { return nullptr; }
  37. virtual void dispatchEventQueue () = 0;
  38. [[nodiscard]] WallpaperApplication& getApp () const;
  39. [[nodiscard]] Input::InputContext& getInputContext ();
  40. private:
  41. WallpaperApplication& m_app;
  42. Input::InputContext m_inputContext;
  43. };
  44. } // namespace WallpaperEngine::Render::Drivers