3 #include "forwarddecl/Mouse.hpp" 
    7 namespace rolmodl::mouse {
 
   20       SDL_Cursor* unsafeRaw() noexcept;
 
   24       explicit Cursor(SDL_Cursor* data) noexcept;
 
   26       friend Cursor cursor::system::create(
const cursor::system::Type t);
 
   27       friend void cursor::unsafe::useRaw(
Cursor* c) noexcept;
 
   29       void unused() noexcept;
 
   37       static Cursor* active_cursor = 
nullptr; 
 
   40       void useRaw(Cursor* c) noexcept;
 
   43     void useDefault() noexcept;
 
   46         arrow, iBeam, wait, crosshair, waitArrow, forbidden, hand,
 
   47         resize_nw_se, resize_ne_sw, resize_we, resize_ns, resize_all
 
   50       namespace type::unsafe {
 
   51         constexpr SDL_SystemCursor toSDLEnum(
const Type t) noexcept {
 
   53             return SDL_SYSTEM_CURSOR_ARROW;
 
   54           else if (t == Type::iBeam)
 
   55             return SDL_SYSTEM_CURSOR_IBEAM;
 
   56           else if (t == Type::wait)
 
   57             return SDL_SYSTEM_CURSOR_WAIT;
 
   58           else if (t == Type::crosshair)
 
   59             return SDL_SYSTEM_CURSOR_CROSSHAIR;
 
   60           else if (t == Type::waitArrow)
 
   61             return SDL_SYSTEM_CURSOR_WAITARROW;
 
   62           else if (t == Type::resize_nw_se)
 
   63             return SDL_SYSTEM_CURSOR_SIZENWSE;
 
   64           else if (t == Type::resize_ne_sw)
 
   65             return SDL_SYSTEM_CURSOR_SIZENESW;
 
   66           else if (t == Type::resize_we)
 
   67             return SDL_SYSTEM_CURSOR_SIZEWE;
 
   68           else if (t == Type::resize_ns)
 
   69             return SDL_SYSTEM_CURSOR_SIZENS;
 
   70           else if (t == Type::resize_all)
 
   71             return SDL_SYSTEM_CURSOR_SIZEALL;
 
   72           else if (t == Type::forbidden)
 
   73             return SDL_SYSTEM_CURSOR_NO;
 
   75             return SDL_SYSTEM_CURSOR_HAND;
 
   78         constexpr Type fromSDLEnum(
const SDL_SystemCursor t) noexcept {
 
   79           if (t == SDL_SYSTEM_CURSOR_ARROW)
 
   81           else if (t == SDL_SYSTEM_CURSOR_IBEAM)
 
   83           else if (t == SDL_SYSTEM_CURSOR_WAIT)
 
   85           else if (t == SDL_SYSTEM_CURSOR_CROSSHAIR)
 
   86             return Type::crosshair;
 
   87           else if (t == SDL_SYSTEM_CURSOR_WAITARROW)
 
   88             return Type::waitArrow;
 
   89           else if (t == SDL_SYSTEM_CURSOR_SIZENWSE)
 
   90             return Type::resize_nw_se;
 
   91           else if (t == SDL_SYSTEM_CURSOR_SIZENESW)
 
   92             return Type::resize_ne_sw;
 
   93           else if (t == SDL_SYSTEM_CURSOR_SIZEWE)
 
   94             return Type::resize_we;
 
   95           else if (t == SDL_SYSTEM_CURSOR_SIZENS)
 
   96             return Type::resize_ns;
 
   97           else if (t == SDL_SYSTEM_CURSOR_SIZEALL)
 
   98             return Type::resize_all;
 
   99           else if (t == SDL_SYSTEM_CURSOR_NO)
 
  100             return Type::forbidden;
 
  106       Cursor create(
const Type t);
 
  131   namespace btn::unsafe {
 
  132     constexpr uint32_t toSDLEnum(
const Btn b) noexcept {
 
  134         return SDL_BUTTON_LEFT;
 
  135       else if (b == Btn::right)
 
  136         return SDL_BUTTON_RIGHT;
 
  137       else if (b == Btn::middle)
 
  138         return SDL_BUTTON_MIDDLE;
 
  139       else if (b == Btn::x1)
 
  140         return SDL_BUTTON_X1;
 
  142         return SDL_BUTTON_X2;
 
  145     constexpr Btn fromSDLEnum(
const uint32_t b) noexcept {
 
  146       if (b == SDL_BUTTON_LEFT)
 
  148       else if (b == SDL_BUTTON_RIGHT)
 
  150       else if (b == SDL_BUTTON_MIDDLE)
 
  152       else if (b == SDL_BUTTON_X1)
 
  161       explicit constexpr 
BtnState(
const uint32_t raw) noexcept :
 
  165       constexpr 
bool left() 
const noexcept {
 
  166         return get(Btn::left);
 
  168       constexpr 
bool right() 
const noexcept {
 
  169         return get(Btn::right);
 
  171       constexpr 
bool middle() 
const noexcept {
 
  172         return get(Btn::middle);
 
  174       constexpr 
bool x1() 
const noexcept {
 
  177       constexpr 
bool x2() 
const noexcept {
 
  181       constexpr 
bool l() 
const noexcept {
return left();}
 
  182       constexpr 
bool r() 
const noexcept {
return right();}
 
  183       constexpr 
bool m() 
const noexcept {
return middle();}
 
  185       constexpr 
bool get(
const Btn b) 
const noexcept {
 
  186         return raw_ & SDL_BUTTON(btn::unsafe::toSDLEnum(b));
 
  197         const BtnState& btnState() 
const noexcept;
 
  200         explicit BaseState(
const uint32_t b) noexcept;