diff --git a/include/wups/button_combo/WUPSButtonCombo.h b/include/wups/button_combo/WUPSButtonCombo.h index 56cedb0..a50b805 100644 --- a/include/wups/button_combo/WUPSButtonCombo.h +++ b/include/wups/button_combo/WUPSButtonCombo.h @@ -4,54 +4,55 @@ #include "defines.h" -#include #include -class WUPSButtonCombo { -public: - static std::optional Create(const WUPSButtonCombo_ComboOptions &options, +namespace WUPSButtonComboAPI { + class ButtonCombo { + public: + static std::optional Create(const WUPSButtonCombo_ComboOptions &options, WUPSButtonCombo_ComboStatus &outStatus, WUPSButtonCombo_Error &outError) noexcept; - static WUPSButtonCombo Create(const WUPSButtonCombo_ComboOptions &options, + static ButtonCombo Create(const WUPSButtonCombo_ComboOptions &options, WUPSButtonCombo_ComboStatus &outStatus); - ~WUPSButtonCombo(); - WUPSButtonCombo(const WUPSButtonCombo &) = delete; + ~ButtonCombo(); + ButtonCombo(const ButtonCombo &) = delete; - WUPSButtonCombo(WUPSButtonCombo &&other) noexcept; + ButtonCombo(ButtonCombo &&other) noexcept; - WUPSButtonCombo &operator=(const WUPSButtonCombo &) = delete; + ButtonCombo &operator=(const ButtonCombo &) = delete; - WUPSButtonCombo &operator=(WUPSButtonCombo &&other) noexcept; + ButtonCombo &operator=(ButtonCombo &&other) noexcept; - [[nodiscard]] WUPSButtonCombo_ComboHandle getHandle() const; + [[nodiscard]] WUPSButtonCombo_ComboHandle getHandle() const; - WUPSButtonCombo_Error GetButtonComboStatus(WUPSButtonCombo_ComboStatus &outStatus) const; + WUPSButtonCombo_Error GetButtonComboStatus(WUPSButtonCombo_ComboStatus &outStatus) const; - [[nodiscard]] WUPSButtonCombo_Error UpdateButtonComboMeta(const WUPSButtonCombo_MetaOptions &metaOptions) const; + [[nodiscard]] WUPSButtonCombo_Error UpdateButtonComboMeta(const WUPSButtonCombo_MetaOptions &metaOptions) const; - [[nodiscard]] WUPSButtonCombo_Error UpdateButtonComboCallback(const WUPSButtonCombo_CallbackOptions &callbackOptions) const; + [[nodiscard]] WUPSButtonCombo_Error UpdateButtonComboCallback(const WUPSButtonCombo_CallbackOptions &callbackOptions) const; - [[nodiscard]] WUPSButtonCombo_Error UpdateControllerMask(WUPSButtonCombo_ControllerTypes controllerMask, - WUPSButtonCombo_ComboStatus &outStatus) const; + [[nodiscard]] WUPSButtonCombo_Error UpdateControllerMask(WUPSButtonCombo_ControllerTypes controllerMask, + WUPSButtonCombo_ComboStatus &outStatus) const; - [[nodiscard]] WUPSButtonCombo_Error UpdateButtonCombo(WUPSButtonCombo_Buttons combo, - WUPSButtonCombo_ComboStatus &outStatus) const; + [[nodiscard]] WUPSButtonCombo_Error UpdateButtonCombo(WUPSButtonCombo_Buttons combo, + WUPSButtonCombo_ComboStatus &outStatus) const; - [[nodiscard]] WUPSButtonCombo_Error UpdateHoldDuration(uint32_t holdDurationInFrames) const; + [[nodiscard]] WUPSButtonCombo_Error UpdateHoldDuration(uint32_t holdDurationInFrames) const; - [[nodiscard]] WUPSButtonCombo_Error GetButtonComboMeta(WUPSButtonCombo_MetaOptionsOut &outOptions) const; + [[nodiscard]] WUPSButtonCombo_Error GetButtonComboMeta(WUPSButtonCombo_MetaOptionsOut &outOptions) const; - WUPSButtonCombo_Error GetButtonComboCallback(WUPSButtonCombo_CallbackOptions &outOptions) const; + WUPSButtonCombo_Error GetButtonComboCallback(WUPSButtonCombo_CallbackOptions &outOptions) const; - WUPSButtonCombo_Error GetButtonComboInfoEx(WUPSButtonCombo_ButtonComboInfoEx &outOptions) const; + WUPSButtonCombo_Error GetButtonComboInfoEx(WUPSButtonCombo_ButtonComboInfoEx &outOptions) const; -private: - void ReleaseButtonComboHandle(); + private: + void ReleaseButtonComboHandle(); - explicit WUPSButtonCombo(WUPSButtonCombo_ComboHandle handle); + explicit ButtonCombo(WUPSButtonCombo_ComboHandle handle); - WUPSButtonCombo_ComboHandle mHandle = WUPSButtonCombo_ComboHandle(nullptr); -}; + WUPSButtonCombo_ComboHandle mHandle = WUPSButtonCombo_ComboHandle(nullptr); + }; +} // namespace WUPSButtonComboAPI #endif \ No newline at end of file diff --git a/include/wups/button_combo/api.h b/include/wups/button_combo/api.h index 64ee231..7b36b7f 100644 --- a/include/wups/button_combo/api.h +++ b/include/wups/button_combo/api.h @@ -1,9 +1,8 @@ #pragma once -#include "WUPSButtonCombo.h" -#include +#include "defines.h" + #include -#include #ifdef __cplusplus extern "C" { @@ -156,103 +155,106 @@ WUPSButtonCombo_Error WUPSButtonComboAPI_DetectButtonCombo_Blocking(const WUPSBu #endif #ifdef __cplusplus -namespace WUPSButtonComboAPI { +#include "WUPSButtonCombo.h" +#include +#include +namespace WUPSButtonComboAPI { std::string_view GetStatusStr(WUPSButtonCombo_Error status); - std::optional CreateComboPressDownEx(std::string_view label, - WUPSButtonCombo_ControllerTypes controllerMask, - WUPSButtonCombo_Buttons combo, - WUPSButtonCombo_ComboCallback callback, - void *context, - bool observer, - WUPSButtonCombo_ComboStatus &outStatus, - WUPSButtonCombo_Error &outError) noexcept; - - std::optional CreateComboPressDown(std::string_view label, - WUPSButtonCombo_Buttons combo, - WUPSButtonCombo_ComboCallback callback, - void *context, - WUPSButtonCombo_ComboStatus &outStatus, - WUPSButtonCombo_Error &outError) noexcept; - - std::optional CreateComboPressDownObserver(std::string_view label, - WUPSButtonCombo_Buttons combo, - WUPSButtonCombo_ComboCallback callback, - void *context, - WUPSButtonCombo_ComboStatus &outStatus, - WUPSButtonCombo_Error &outError) noexcept; - - std::optional CreateComboHoldEx(std::string_view label, - WUPSButtonCombo_ControllerTypes controllerMask, - WUPSButtonCombo_Buttons combo, - uint32_t holdDurationInMs, - WUPSButtonCombo_ComboCallback callback, - void *context, - bool observer, - WUPSButtonCombo_ComboStatus &outStatus, - WUPSButtonCombo_Error &outError) noexcept; - - std::optional CreateComboHold(std::string_view label, - WUPSButtonCombo_Buttons combo, - uint32_t holdDurationInMs, - WUPSButtonCombo_ComboCallback callback, - void *context, - WUPSButtonCombo_ComboStatus &outStatus, - WUPSButtonCombo_Error &outError) noexcept; - - std::optional CreateComboHoldObserver(std::string_view label, - WUPSButtonCombo_Buttons combo, - uint32_t holdDurationInMs, - WUPSButtonCombo_ComboCallback callback, - void *context, - WUPSButtonCombo_ComboStatus &outStatus, - WUPSButtonCombo_Error &outError) noexcept; - - - WUPSButtonCombo CreateComboPressDownEx(std::string_view label, - WUPSButtonCombo_ControllerTypes controllerMask, - WUPSButtonCombo_Buttons combo, - WUPSButtonCombo_ComboCallback callback, - void *context, - bool observer, - WUPSButtonCombo_ComboStatus &outStatus); - - WUPSButtonCombo CreateComboPressDown(std::string_view label, - WUPSButtonCombo_Buttons combo, - WUPSButtonCombo_ComboCallback callback, - void *context, - WUPSButtonCombo_ComboStatus &outStatus); - - WUPSButtonCombo CreateComboPressDownObserver(std::string_view label, + std::optional CreateComboPressDownEx(std::string_view label, + WUPSButtonCombo_ControllerTypes controllerMask, + WUPSButtonCombo_Buttons combo, + WUPSButtonCombo_ComboCallback callback, + void *context, + bool observer, + WUPSButtonCombo_ComboStatus &outStatus, + WUPSButtonCombo_Error &outError) noexcept; + + std::optional CreateComboPressDown(std::string_view label, + WUPSButtonCombo_Buttons combo, + WUPSButtonCombo_ComboCallback callback, + void *context, + WUPSButtonCombo_ComboStatus &outStatus, + WUPSButtonCombo_Error &outError) noexcept; + + std::optional CreateComboPressDownObserver(std::string_view label, + WUPSButtonCombo_Buttons combo, + WUPSButtonCombo_ComboCallback callback, + void *context, + WUPSButtonCombo_ComboStatus &outStatus, + WUPSButtonCombo_Error &outError) noexcept; + + std::optional CreateComboHoldEx(std::string_view label, + WUPSButtonCombo_ControllerTypes controllerMask, WUPSButtonCombo_Buttons combo, + uint32_t holdDurationInMs, WUPSButtonCombo_ComboCallback callback, void *context, - WUPSButtonCombo_ComboStatus &outStatus); - - WUPSButtonCombo CreateComboHoldEx(std::string_view label, - WUPSButtonCombo_ControllerTypes controllerMask, - WUPSButtonCombo_Buttons combo, - uint32_t holdDurationInMs, - WUPSButtonCombo_ComboCallback callback, - void *context, - bool observer, - WUPSButtonCombo_ComboStatus &outStatus); - - WUPSButtonCombo CreateComboHold(std::string_view label, - WUPSButtonCombo_Buttons combo, - uint32_t holdDurationInMs, - WUPSButtonCombo_ComboCallback callback, - void *context, - WUPSButtonCombo_ComboStatus &outStatus); - - WUPSButtonCombo CreateComboHoldObserver(std::string_view label, - WUPSButtonCombo_Buttons combo, - uint32_t holdDurationInMs, - WUPSButtonCombo_ComboCallback callback, - void *context, - WUPSButtonCombo_ComboStatus &outStatus); + bool observer, + WUPSButtonCombo_ComboStatus &outStatus, + WUPSButtonCombo_Error &outError) noexcept; + + std::optional CreateComboHold(std::string_view label, + WUPSButtonCombo_Buttons combo, + uint32_t holdDurationInMs, + WUPSButtonCombo_ComboCallback callback, + void *context, + WUPSButtonCombo_ComboStatus &outStatus, + WUPSButtonCombo_Error &outError) noexcept; + + std::optional CreateComboHoldObserver(std::string_view label, + WUPSButtonCombo_Buttons combo, + uint32_t holdDurationInMs, + WUPSButtonCombo_ComboCallback callback, + void *context, + WUPSButtonCombo_ComboStatus &outStatus, + WUPSButtonCombo_Error &outError) noexcept; + + + ButtonCombo CreateComboPressDownEx(std::string_view label, + WUPSButtonCombo_ControllerTypes controllerMask, + WUPSButtonCombo_Buttons combo, + WUPSButtonCombo_ComboCallback callback, + void *context, + bool observer, + WUPSButtonCombo_ComboStatus &outStatus); + + ButtonCombo CreateComboPressDown(std::string_view label, + WUPSButtonCombo_Buttons combo, + WUPSButtonCombo_ComboCallback callback, + void *context, + WUPSButtonCombo_ComboStatus &outStatus); + + ButtonCombo CreateComboPressDownObserver(std::string_view label, + WUPSButtonCombo_Buttons combo, + WUPSButtonCombo_ComboCallback callback, + void *context, + WUPSButtonCombo_ComboStatus &outStatus); + + ButtonCombo CreateComboHoldEx(std::string_view label, + WUPSButtonCombo_ControllerTypes controllerMask, + WUPSButtonCombo_Buttons combo, + uint32_t holdDurationInMs, + WUPSButtonCombo_ComboCallback callback, + void *context, + bool observer, + WUPSButtonCombo_ComboStatus &outStatus); + + ButtonCombo CreateComboHold(std::string_view label, + WUPSButtonCombo_Buttons combo, + uint32_t holdDurationInMs, + WUPSButtonCombo_ComboCallback callback, + void *context, + WUPSButtonCombo_ComboStatus &outStatus); + + ButtonCombo CreateComboHoldObserver(std::string_view label, + WUPSButtonCombo_Buttons combo, + uint32_t holdDurationInMs, + WUPSButtonCombo_ComboCallback callback, + void *context, + WUPSButtonCombo_ComboStatus &outStatus); WUPSButtonCombo_Error CheckComboAvailable(const WUPSButtonCombo_ButtonComboOptions &options, WUPSButtonCombo_ComboStatus &outStatus); diff --git a/libraries/libwups/WUPSButtonCombo.cpp b/libraries/libwups/WUPSButtonCombo.cpp index dee6a16..bf40ac1 100644 --- a/libraries/libwups/WUPSButtonCombo.cpp +++ b/libraries/libwups/WUPSButtonCombo.cpp @@ -4,100 +4,101 @@ #include #include - -std::optional WUPSButtonCombo::Create(const WUPSButtonCombo_ComboOptions &options, - WUPSButtonCombo_ComboStatus &outStatus, - WUPSButtonCombo_Error &outError) noexcept { - WUPSButtonCombo_ComboHandle handle; - if (outError = WUPSButtonComboAPI_AddButtonCombo(&options, &handle, &outStatus); outError == WUPS_BUTTON_COMBO_ERROR_SUCCESS) { - return WUPSButtonCombo(handle); - } - return {}; -} - -WUPSButtonCombo WUPSButtonCombo::Create(const WUPSButtonCombo_ComboOptions &options, - WUPSButtonCombo_ComboStatus &outStatus) { - WUPSButtonCombo_Error error; - auto res = Create(options, outStatus, error); - if (!res) { - throw std::runtime_error{std::string("Failed to create button combo: ").append(WUPSButtonComboAPI_GetStatusStr(error))}; - } - return std::move(*res); -} - -WUPSButtonCombo::~WUPSButtonCombo() { - ReleaseButtonComboHandle(); -} - -void WUPSButtonCombo::ReleaseButtonComboHandle() { - if (mHandle != nullptr) { - if (const auto res = WUPSButtonComboAPI_RemoveButtonCombo(mHandle); res != WUPS_BUTTON_COMBO_ERROR_SUCCESS) { - OSReport("WUPSButtonCombo::ReleaseButtonComboHandle(): WUPSButtonComboAPI_RemoveButtonCombo for %08X returned: %s\n", mHandle, WUPSButtonComboAPI_GetStatusStr(res)); +namespace WUPSButtonComboAPI { + std::optional ButtonCombo::Create(const WUPSButtonCombo_ComboOptions &options, + WUPSButtonCombo_ComboStatus &outStatus, + WUPSButtonCombo_Error &outError) noexcept { + WUPSButtonCombo_ComboHandle handle; + if (outError = WUPSButtonComboAPI_AddButtonCombo(&options, &handle, &outStatus); outError == WUPS_BUTTON_COMBO_ERROR_SUCCESS) { + return ButtonCombo(handle); } - mHandle = WUPSButtonCombo_ComboHandle(nullptr); + return {}; } -} -WUPSButtonCombo::WUPSButtonCombo(WUPSButtonCombo &&src) noexcept { - ReleaseButtonComboHandle(); + ButtonCombo ButtonCombo::Create(const WUPSButtonCombo_ComboOptions &options, + WUPSButtonCombo_ComboStatus &outStatus) { + WUPSButtonCombo_Error error; + auto res = Create(options, outStatus, error); + if (!res) { + throw std::runtime_error{std::string("Failed to create button combo: ").append(WUPSButtonComboAPI_GetStatusStr(error))}; + } + return std::move(*res); + } - mHandle = src.mHandle; + ButtonCombo::~ButtonCombo() { + ReleaseButtonComboHandle(); + } - src.mHandle = WUPSButtonCombo_ComboHandle(nullptr); -} + void ButtonCombo::ReleaseButtonComboHandle() { + if (mHandle != nullptr) { + if (const auto res = WUPSButtonComboAPI_RemoveButtonCombo(mHandle); res != WUPS_BUTTON_COMBO_ERROR_SUCCESS) { + OSReport("ButtonCombo::ReleaseButtonComboHandle(): WUPSButtonComboAPI_RemoveButtonCombo for %08X returned: %s\n", mHandle, WUPSButtonComboAPI_GetStatusStr(res)); + } + mHandle = WUPSButtonCombo_ComboHandle(nullptr); + } + } -WUPSButtonCombo &WUPSButtonCombo::operator=(WUPSButtonCombo &&src) noexcept { - if (this != &src) { + ButtonCombo::ButtonCombo(ButtonCombo &&src) noexcept { ReleaseButtonComboHandle(); mHandle = src.mHandle; src.mHandle = WUPSButtonCombo_ComboHandle(nullptr); } - return *this; -} -[[nodiscard]] WUPSButtonCombo_ComboHandle WUPSButtonCombo::getHandle() const { - return mHandle; -} + ButtonCombo &ButtonCombo::operator=(ButtonCombo &&src) noexcept { + if (this != &src) { + ReleaseButtonComboHandle(); + + mHandle = src.mHandle; -WUPSButtonCombo_Error WUPSButtonCombo::GetButtonComboStatus(WUPSButtonCombo_ComboStatus &outStatus) const { - return WUPSButtonComboAPI_GetButtonComboStatus(mHandle, &outStatus); -} + src.mHandle = WUPSButtonCombo_ComboHandle(nullptr); + } + return *this; + } -[[nodiscard]] WUPSButtonCombo_Error WUPSButtonCombo::UpdateButtonComboMeta(const WUPSButtonCombo_MetaOptions &metaOptions) const { - return WUPSButtonComboAPI_UpdateButtonComboMeta(mHandle, &metaOptions); -} + [[nodiscard]] WUPSButtonCombo_ComboHandle ButtonCombo::getHandle() const { + return mHandle; + } -[[nodiscard]] WUPSButtonCombo_Error WUPSButtonCombo::UpdateButtonComboCallback(const WUPSButtonCombo_CallbackOptions &callbackOptions) const { - return WUPSButtonComboAPI_UpdateButtonComboCallback(mHandle, &callbackOptions); -} + WUPSButtonCombo_Error ButtonCombo::GetButtonComboStatus(WUPSButtonCombo_ComboStatus &outStatus) const { + return WUPSButtonComboAPI_GetButtonComboStatus(mHandle, &outStatus); + } -[[nodiscard]] WUPSButtonCombo_Error WUPSButtonCombo::UpdateControllerMask(const WUPSButtonCombo_ControllerTypes controllerMask, + [[nodiscard]] WUPSButtonCombo_Error ButtonCombo::UpdateButtonComboMeta(const WUPSButtonCombo_MetaOptions &metaOptions) const { + return WUPSButtonComboAPI_UpdateButtonComboMeta(mHandle, &metaOptions); + } + + [[nodiscard]] WUPSButtonCombo_Error ButtonCombo::UpdateButtonComboCallback(const WUPSButtonCombo_CallbackOptions &callbackOptions) const { + return WUPSButtonComboAPI_UpdateButtonComboCallback(mHandle, &callbackOptions); + } + + [[nodiscard]] WUPSButtonCombo_Error ButtonCombo::UpdateControllerMask(const WUPSButtonCombo_ControllerTypes controllerMask, WUPSButtonCombo_ComboStatus &outStatus) const { - return WUPSButtonComboAPI_UpdateControllerMask(mHandle, controllerMask, &outStatus); -} + return WUPSButtonComboAPI_UpdateControllerMask(mHandle, controllerMask, &outStatus); + } -[[nodiscard]] WUPSButtonCombo_Error WUPSButtonCombo::UpdateButtonCombo(const WUPSButtonCombo_Buttons combo, + [[nodiscard]] WUPSButtonCombo_Error ButtonCombo::UpdateButtonCombo(const WUPSButtonCombo_Buttons combo, WUPSButtonCombo_ComboStatus &outStatus) const { - return WUPSButtonComboAPI_UpdateButtonCombo(mHandle, combo, &outStatus); -} + return WUPSButtonComboAPI_UpdateButtonCombo(mHandle, combo, &outStatus); + } -[[nodiscard]] WUPSButtonCombo_Error WUPSButtonCombo::UpdateHoldDuration(const uint32_t holdDurationInFrames) const { - return WUPSButtonComboAPI_UpdateHoldDuration(mHandle, holdDurationInFrames); -} + [[nodiscard]] WUPSButtonCombo_Error ButtonCombo::UpdateHoldDuration(const uint32_t holdDurationInFrames) const { + return WUPSButtonComboAPI_UpdateHoldDuration(mHandle, holdDurationInFrames); + } -[[nodiscard]] WUPSButtonCombo_Error WUPSButtonCombo::GetButtonComboMeta(WUPSButtonCombo_MetaOptionsOut &outOptions) const { - return WUPSButtonComboAPI_GetButtonComboMeta(mHandle, &outOptions); -} + [[nodiscard]] WUPSButtonCombo_Error ButtonCombo::GetButtonComboMeta(WUPSButtonCombo_MetaOptionsOut &outOptions) const { + return WUPSButtonComboAPI_GetButtonComboMeta(mHandle, &outOptions); + } -WUPSButtonCombo_Error WUPSButtonCombo::GetButtonComboCallback(WUPSButtonCombo_CallbackOptions &outOptions) const { - return WUPSButtonComboAPI_GetButtonComboCallback(mHandle, &outOptions); -} + WUPSButtonCombo_Error ButtonCombo::GetButtonComboCallback(WUPSButtonCombo_CallbackOptions &outOptions) const { + return WUPSButtonComboAPI_GetButtonComboCallback(mHandle, &outOptions); + } -WUPSButtonCombo_Error WUPSButtonCombo::GetButtonComboInfoEx(WUPSButtonCombo_ButtonComboInfoEx &outOptions) const { - return WUPSButtonComboAPI_GetButtonComboInfoEx(mHandle, &outOptions); -} + WUPSButtonCombo_Error ButtonCombo::GetButtonComboInfoEx(WUPSButtonCombo_ButtonComboInfoEx &outOptions) const { + return WUPSButtonComboAPI_GetButtonComboInfoEx(mHandle, &outOptions); + } -WUPSButtonCombo::WUPSButtonCombo(const WUPSButtonCombo_ComboHandle handle) : mHandle(handle) { -} + ButtonCombo::ButtonCombo(const WUPSButtonCombo_ComboHandle handle) : mHandle(handle) { + } +} // namespace WUPSButtonComboAPI \ No newline at end of file diff --git a/libraries/libwups/button_comboCPP.cpp b/libraries/libwups/button_comboCPP.cpp index a7b5e87..c14d4c3 100644 --- a/libraries/libwups/button_comboCPP.cpp +++ b/libraries/libwups/button_comboCPP.cpp @@ -7,14 +7,14 @@ namespace WUPSButtonComboAPI { return WUPSButtonComboAPI_GetStatusStr(status); } - std::optional CreateComboPressDownEx(const std::string_view label, - const WUPSButtonCombo_ControllerTypes controllerMask, - const WUPSButtonCombo_Buttons combo, - const WUPSButtonCombo_ComboCallback callback, - void *context, - const bool observer, - WUPSButtonCombo_ComboStatus &outStatus, - WUPSButtonCombo_Error &outError) noexcept { + std::optional CreateComboPressDownEx(const std::string_view label, + const WUPSButtonCombo_ControllerTypes controllerMask, + const WUPSButtonCombo_Buttons combo, + const WUPSButtonCombo_ComboCallback callback, + void *context, + const bool observer, + WUPSButtonCombo_ComboStatus &outStatus, + WUPSButtonCombo_Error &outError) noexcept { WUPSButtonCombo_ComboOptions options = {}; options.metaOptions.label = label.data(); options.callbackOptions = {.callback = callback, .context = context}; @@ -22,37 +22,37 @@ namespace WUPSButtonComboAPI { options.buttonComboOptions.basicCombo.combo = combo; options.buttonComboOptions.basicCombo.controllerMask = controllerMask; - return WUPSButtonCombo::Create(options, outStatus, outError); + return ButtonCombo::Create(options, outStatus, outError); } - std::optional CreateComboPressDown(const std::string_view label, - const WUPSButtonCombo_Buttons combo, - const WUPSButtonCombo_ComboCallback callback, - void *context, - WUPSButtonCombo_ComboStatus &outStatus, - WUPSButtonCombo_Error &outError) noexcept { + std::optional CreateComboPressDown(const std::string_view label, + const WUPSButtonCombo_Buttons combo, + const WUPSButtonCombo_ComboCallback callback, + void *context, + WUPSButtonCombo_ComboStatus &outStatus, + WUPSButtonCombo_Error &outError) noexcept { return CreateComboPressDownEx(label, WUPS_BUTTON_COMBO_CONTROLLER_ALL, combo, callback, context, false, outStatus, outError); } - std::optional CreateComboPressDownObserver(const std::string_view label, - const WUPSButtonCombo_Buttons combo, - const WUPSButtonCombo_ComboCallback callback, - void *context, - WUPSButtonCombo_ComboStatus &outStatus, - WUPSButtonCombo_Error &outError) noexcept { + std::optional CreateComboPressDownObserver(const std::string_view label, + const WUPSButtonCombo_Buttons combo, + const WUPSButtonCombo_ComboCallback callback, + void *context, + WUPSButtonCombo_ComboStatus &outStatus, + WUPSButtonCombo_Error &outError) noexcept { return CreateComboPressDownEx(label, WUPS_BUTTON_COMBO_CONTROLLER_ALL, combo, callback, context, true, outStatus, outError); } - std::optional CreateComboHoldEx(const std::string_view label, - const WUPSButtonCombo_ControllerTypes controllerMask, - const WUPSButtonCombo_Buttons combo, - const uint32_t holdDurationInMs, - const WUPSButtonCombo_ComboCallback callback, - void *context, - const bool observer, - WUPSButtonCombo_ComboStatus &outStatus, - WUPSButtonCombo_Error &outError) noexcept { + std::optional CreateComboHoldEx(const std::string_view label, + const WUPSButtonCombo_ControllerTypes controllerMask, + const WUPSButtonCombo_Buttons combo, + const uint32_t holdDurationInMs, + const WUPSButtonCombo_ComboCallback callback, + void *context, + const bool observer, + WUPSButtonCombo_ComboStatus &outStatus, + WUPSButtonCombo_Error &outError) noexcept { WUPSButtonCombo_ComboOptions options = {}; options.metaOptions.label = label.data(); options.callbackOptions = {.callback = callback, .context = context}; @@ -61,36 +61,36 @@ namespace WUPSButtonComboAPI { options.buttonComboOptions.basicCombo.controllerMask = controllerMask; options.buttonComboOptions.optionalHoldForXMs = holdDurationInMs; - return WUPSButtonCombo::Create(options, outStatus, outError); + return ButtonCombo::Create(options, outStatus, outError); } - std::optional CreateComboHold(const std::string_view label, - const WUPSButtonCombo_Buttons combo, - const uint32_t holdDurationInMs, - const WUPSButtonCombo_ComboCallback callback, - void *context, - WUPSButtonCombo_ComboStatus &outStatus, - WUPSButtonCombo_Error &outError) noexcept { + std::optional CreateComboHold(const std::string_view label, + const WUPSButtonCombo_Buttons combo, + const uint32_t holdDurationInMs, + const WUPSButtonCombo_ComboCallback callback, + void *context, + WUPSButtonCombo_ComboStatus &outStatus, + WUPSButtonCombo_Error &outError) noexcept { return CreateComboHoldEx(label, WUPS_BUTTON_COMBO_CONTROLLER_ALL, combo, holdDurationInMs, callback, context, false, outStatus, outError); } - std::optional CreateComboHoldObserver(const std::string_view label, - const WUPSButtonCombo_Buttons combo, - const uint32_t holdDurationInMs, - const WUPSButtonCombo_ComboCallback callback, - void *context, - WUPSButtonCombo_ComboStatus &outStatus, - WUPSButtonCombo_Error &outError) noexcept { + std::optional CreateComboHoldObserver(const std::string_view label, + const WUPSButtonCombo_Buttons combo, + const uint32_t holdDurationInMs, + const WUPSButtonCombo_ComboCallback callback, + void *context, + WUPSButtonCombo_ComboStatus &outStatus, + WUPSButtonCombo_Error &outError) noexcept { return CreateComboHoldEx(label, WUPS_BUTTON_COMBO_CONTROLLER_ALL, combo, holdDurationInMs, callback, context, true, outStatus, outError); } - WUPSButtonCombo CreateComboPressDownEx(const std::string_view label, - const WUPSButtonCombo_ControllerTypes controllerMask, - const WUPSButtonCombo_Buttons combo, - const WUPSButtonCombo_ComboCallback callback, - void *context, - const bool observer, - WUPSButtonCombo_ComboStatus &outStatus) { + ButtonCombo CreateComboPressDownEx(const std::string_view label, + const WUPSButtonCombo_ControllerTypes controllerMask, + const WUPSButtonCombo_Buttons combo, + const WUPSButtonCombo_ComboCallback callback, + void *context, + const bool observer, + WUPSButtonCombo_ComboStatus &outStatus) { WUPSButtonCombo_Error error; auto res = CreateComboPressDownEx(label, controllerMask, combo, callback, context, observer, outStatus, error); if (!res) { @@ -99,30 +99,30 @@ namespace WUPSButtonComboAPI { return std::move(*res); } - WUPSButtonCombo CreatePressDown(const std::string_view label, - const WUPSButtonCombo_Buttons combo, - const WUPSButtonCombo_ComboCallback callback, - void *context, - WUPSButtonCombo_ComboStatus &outStatus) { + ButtonCombo CreatePressDown(const std::string_view label, + const WUPSButtonCombo_Buttons combo, + const WUPSButtonCombo_ComboCallback callback, + void *context, + WUPSButtonCombo_ComboStatus &outStatus) { return CreateComboPressDownEx(label, WUPS_BUTTON_COMBO_CONTROLLER_ALL, combo, callback, context, false, outStatus); } - WUPSButtonCombo CreatePressDownObserver(const std::string_view label, - const WUPSButtonCombo_Buttons combo, - const WUPSButtonCombo_ComboCallback callback, - void *context, - WUPSButtonCombo_ComboStatus &outStatus) { + ButtonCombo CreatePressDownObserver(const std::string_view label, + const WUPSButtonCombo_Buttons combo, + const WUPSButtonCombo_ComboCallback callback, + void *context, + WUPSButtonCombo_ComboStatus &outStatus) { return CreateComboPressDownEx(label, WUPS_BUTTON_COMBO_CONTROLLER_ALL, combo, callback, context, true, outStatus); } - WUPSButtonCombo CreateComboHoldEx(const std::string_view label, - const WUPSButtonCombo_ControllerTypes controllerMask, - const WUPSButtonCombo_Buttons combo, - const uint32_t holdDurationInMs, - const WUPSButtonCombo_ComboCallback callback, - void *context, - const bool observer, - WUPSButtonCombo_ComboStatus &outStatus) { + ButtonCombo CreateComboHoldEx(const std::string_view label, + const WUPSButtonCombo_ControllerTypes controllerMask, + const WUPSButtonCombo_Buttons combo, + const uint32_t holdDurationInMs, + const WUPSButtonCombo_ComboCallback callback, + void *context, + const bool observer, + WUPSButtonCombo_ComboStatus &outStatus) { WUPSButtonCombo_Error error; auto res = CreateComboHoldEx(label, controllerMask, combo, holdDurationInMs, callback, context, observer, outStatus, error); if (!res) { @@ -131,21 +131,21 @@ namespace WUPSButtonComboAPI { return std::move(*res); } - WUPSButtonCombo CreateComboHold(const std::string_view label, - const WUPSButtonCombo_Buttons combo, - const uint32_t holdDurationInMs, - const WUPSButtonCombo_ComboCallback callback, - void *context, - WUPSButtonCombo_ComboStatus &outStatus) { + ButtonCombo CreateComboHold(const std::string_view label, + const WUPSButtonCombo_Buttons combo, + const uint32_t holdDurationInMs, + const WUPSButtonCombo_ComboCallback callback, + void *context, + WUPSButtonCombo_ComboStatus &outStatus) { return CreateComboHoldEx(label, WUPS_BUTTON_COMBO_CONTROLLER_ALL, combo, holdDurationInMs, callback, context, false, outStatus); } - WUPSButtonCombo CreateComboHoldObserver(const std::string_view label, - const WUPSButtonCombo_Buttons combo, - const uint32_t holdDurationInMs, - const WUPSButtonCombo_ComboCallback callback, - void *context, - WUPSButtonCombo_ComboStatus &outStatus) { + ButtonCombo CreateComboHoldObserver(const std::string_view label, + const WUPSButtonCombo_Buttons combo, + const uint32_t holdDurationInMs, + const WUPSButtonCombo_ComboCallback callback, + void *context, + WUPSButtonCombo_ComboStatus &outStatus) { return CreateComboHoldEx(label, WUPS_BUTTON_COMBO_CONTROLLER_ALL, combo, holdDurationInMs, callback, context, true, outStatus); }