7#include "mouse_buttons.hpp"
8#include "../numeric_array.hpp"
9#include "../hires_utc_clock.hpp"
14 enum class Type { None, Entered, Exited, Move, Drag, ButtonDown, ButtonUp, Wheel };
56 event.type = mouse_event::Type::Entered;
60 static mouse_event exited() noexcept {
66 event.position = f32x4{far_, far_};
67 event.type = mouse_event::Type::Exited;
71 friend std::string to_string(mouse_event
const &rhs)
noexcept {
74 using enum mouse_event::Type;
75 case None: type_s =
"none";
break;
76 case Entered: type_s =
"entered";
break;
77 case Exited: type_s =
"exited";
break;
78 case Move: type_s =
"move";
break;
79 case Drag: type_s =
"drag";
break;
80 case ButtonDown: type_s =
"down";
break;
81 case ButtonUp: type_s =
"up";
break;
82 case Wheel: type_s =
"wheel";
break;
83 default: tt_no_default();
86 return fmt::format(
"<mouse {} {}>", type_s, rhs.position);
90 return lhs << to_string(rhs);
Definition mouse_buttons.hpp:11
Definition mouse_event.hpp:13
f32x4 downPosition
The position the last time a button was pressed.
Definition mouse_event.hpp:24
f32x4 delta() const noexcept
Get the location of the mouse relative to the start of a drag.
Definition mouse_event.hpp:49
int clickCount
Number of clicks from the last button clicked.
Definition mouse_event.hpp:36
f32x4 wheelDelta
Change in wheel rotation, in pixels.
Definition mouse_event.hpp:27
f32x4 position
The current position of the mouse pointer.
Definition mouse_event.hpp:21
mouse_buttons down
Buttons that are pressed/held down.
Definition mouse_event.hpp:33
mouse_buttons cause
Buttons which has caused this event.
Definition mouse_event.hpp:30
static constexpr numeric_array point() noexcept
Get a point at the origin.
Definition numeric_array.hpp:90