CGLFWMouseInput.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #pragma once
  2. #include "WallpaperEngine/Input/CMouseInput.h"
  3. #include <glm/vec2.hpp>
  4. namespace WallpaperEngine::Render::Drivers {
  5. class CGLFWOpenGLDriver;
  6. }
  7. namespace WallpaperEngine::Input::Drivers {
  8. /**
  9. * Handles mouse input for the background
  10. */
  11. class CGLFWMouseInput final : public CMouseInput {
  12. public:
  13. explicit CGLFWMouseInput (Render::Drivers::CGLFWOpenGLDriver* driver);
  14. /**
  15. * Takes current mouse position and updates it
  16. */
  17. void update () override;
  18. /**
  19. * The virtual pointer's position
  20. */
  21. [[nodiscard]] glm::dvec2 position () const override;
  22. /**
  23. * @return The status of the mouse's left click
  24. */
  25. [[nodiscard]] MouseClickStatus leftClick () const override;
  26. /**
  27. * @return The status of the mouse's right click
  28. */
  29. [[nodiscard]] MouseClickStatus rightClick () const override;
  30. private:
  31. Render::Drivers::CGLFWOpenGLDriver* m_driver;
  32. /**
  33. * The current mouse position
  34. */
  35. glm::dvec2 m_mousePosition;
  36. glm::dvec2 m_reportedPosition;
  37. MouseClickStatus m_leftClick;
  38. MouseClickStatus m_rightClick;
  39. };
  40. } // namespace WallpaperEngine::Input::Drivers