#pragma once #include #include namespace metaforce { // TODO: copied from boo; should be rewritten and included from from aurora enum class EMouseButton { None = 0, Primary = 1, Secondary = 2, Middle = 3, Aux1 = 4, Aux2 = 5 }; enum class EModifierKey { None = 0, Ctrl = 1 << 0, Alt = 1 << 2, Shift = 1 << 3, Command = 1 << 4, CtrlCommand = EModifierKey::Ctrl | EModifierKey::Command }; ENABLE_BITWISE_ENUM(EModifierKey) struct SWindowCoord { std::array pixel; std::array virtualPixel; std::array norm; }; struct SScrollDelta { std::array delta{}; bool isFine = false; /* Use system-scale fine-scroll (for scrollable-trackpads) */ bool isAccelerated = false; /* System performs acceleration computation */ constexpr SScrollDelta operator+(const SScrollDelta& other) const noexcept { SScrollDelta ret; ret.delta[0] = delta[0] + other.delta[0]; ret.delta[1] = delta[1] + other.delta[1]; ret.isFine = isFine || other.isFine; ret.isAccelerated = isAccelerated || other.isAccelerated; return ret; } constexpr SScrollDelta operator-(const SScrollDelta& other) const noexcept { SScrollDelta ret; ret.delta[0] = delta[0] - other.delta[0]; ret.delta[1] = delta[1] - other.delta[1]; ret.isFine = isFine || other.isFine; ret.isAccelerated = isAccelerated || other.isAccelerated; return ret; } constexpr SScrollDelta& operator+=(const SScrollDelta& other) noexcept { delta[0] += other.delta[0]; delta[1] += other.delta[1]; isFine |= other.isFine; isAccelerated |= other.isAccelerated; return *this; } constexpr void zeroOut() noexcept { delta = {}; } constexpr bool isZero() const noexcept { return delta[0] == 0.0 && delta[1] == 0.0; } }; struct CKeyboardMouseControllerData { std::array m_charKeys{}; std::array(aurora::SpecialKey::MAX)> m_specialKeys{}; std::array m_mouseButtons{}; aurora::ModifierKey m_modMask = aurora::ModifierKey::None; SWindowCoord m_mouseCoord; SScrollDelta m_accumScroll; }; } // namespace metaforce