mirror of https://github.com/AxioDL/metaforce.git
CFinalInput: Use std::array where applicable
Allows simplifying copies and gets rid of hardcoded size values.
This commit is contained in:
parent
81a019b1e0
commit
dc565969e6
|
@ -486,7 +486,7 @@ void CAutoMapper::ProcessMapRotateInput(const CFinalInput& input, const CStateMa
|
|||
float dirs[4] = {};
|
||||
bool mouseHeld = false;
|
||||
if (const auto& kbm = input.GetKBM()) {
|
||||
if (kbm->m_mouseButtons[int(boo::EMouseButton::Primary)]) {
|
||||
if (kbm->m_mouseButtons[size_t(boo::EMouseButton::Primary)]) {
|
||||
mouseHeld = true;
|
||||
if (float(m_mouseDelta.x()) < 0.f)
|
||||
dirs[3] = -m_mouseDelta.x();
|
||||
|
@ -664,8 +664,8 @@ void CAutoMapper::ProcessMapPanInput(const CFinalInput& input, const CStateManag
|
|||
|
||||
bool mouseHeld = false;
|
||||
if (const auto& kbm = input.GetKBM()) {
|
||||
if (kbm->m_mouseButtons[int(boo::EMouseButton::Middle)] ||
|
||||
kbm->m_mouseButtons[int(boo::EMouseButton::Secondary)]) {
|
||||
if (kbm->m_mouseButtons[size_t(boo::EMouseButton::Middle)] ||
|
||||
kbm->m_mouseButtons[size_t(boo::EMouseButton::Secondary)]) {
|
||||
mouseHeld = true;
|
||||
if (float(m_mouseDelta.x()) < 0.f)
|
||||
right += -m_mouseDelta.x();
|
||||
|
|
|
@ -227,7 +227,7 @@ bool CGuiFrame::ProcessMouseInput(const CFinalInput& input, const CGuiWidgetDraw
|
|||
hit->m_integerScroll.delta[1] -= std::trunc(hit->m_integerScroll.delta[1]);
|
||||
}
|
||||
}
|
||||
if (!m_inMouseDown && kbm->m_mouseButtons[int(boo::EMouseButton::Primary)]) {
|
||||
if (!m_inMouseDown && kbm->m_mouseButtons[size_t(boo::EMouseButton::Primary)]) {
|
||||
m_inMouseDown = true;
|
||||
m_inCancel = false;
|
||||
m_mouseDownWidget = hit;
|
||||
|
@ -235,7 +235,7 @@ bool CGuiFrame::ProcessMouseInput(const CFinalInput& input, const CGuiWidgetDraw
|
|||
m_mouseDownCb(hit, false);
|
||||
if (hit)
|
||||
return true;
|
||||
} else if (m_inMouseDown && !kbm->m_mouseButtons[int(boo::EMouseButton::Primary)]) {
|
||||
} else if (m_inMouseDown && !kbm->m_mouseButtons[size_t(boo::EMouseButton::Primary)]) {
|
||||
m_inMouseDown = false;
|
||||
m_inCancel = false;
|
||||
if (m_mouseDownWidget == m_lastMouseOverWidget) {
|
||||
|
|
|
@ -118,10 +118,10 @@ CFinalInput::CFinalInput(int cIdx, float dt, const CKeyboardMouseControllerData&
|
|||
, x2c_b28_Z(false)
|
||||
, x2c_b29_L(false)
|
||||
, x2c_b30_R(false)
|
||||
, x2c_b31_DPUp(data.m_specialKeys[int(boo::ESpecialKey::Up)])
|
||||
, x2d_b24_DPRight(data.m_specialKeys[int(boo::ESpecialKey::Right)])
|
||||
, x2d_b25_DPDown(data.m_specialKeys[int(boo::ESpecialKey::Down)])
|
||||
, x2d_b26_DPLeft(data.m_specialKeys[int(boo::ESpecialKey::Left)])
|
||||
, x2c_b31_DPUp(data.m_specialKeys[size_t(boo::ESpecialKey::Up)])
|
||||
, x2d_b24_DPRight(data.m_specialKeys[size_t(boo::ESpecialKey::Right)])
|
||||
, x2d_b25_DPDown(data.m_specialKeys[size_t(boo::ESpecialKey::Down)])
|
||||
, x2d_b26_DPLeft(data.m_specialKeys[size_t(boo::ESpecialKey::Left)])
|
||||
, x2d_b27_Start(false)
|
||||
, x2d_b28_PA(DA() && !prevInput.DA())
|
||||
, x2d_b29_PB(DB() && !prevInput.DB())
|
||||
|
@ -137,12 +137,15 @@ CFinalInput::CFinalInput(int cIdx, float dt, const CKeyboardMouseControllerData&
|
|||
, x2e_b31_PStart(DStart() && !prevInput.DStart())
|
||||
, m_kbm(data) {
|
||||
if (prevInput.m_kbm) {
|
||||
for (int i = 0; i < 256; ++i)
|
||||
for (size_t i = 0; i < m_PCharKeys.size(); ++i) {
|
||||
m_PCharKeys[i] = data.m_charKeys[i] && !prevInput.m_kbm->m_charKeys[i];
|
||||
for (int i = 0; i < 26; ++i)
|
||||
}
|
||||
for (size_t i = 0; i < m_PSpecialKeys.size(); ++i) {
|
||||
m_PSpecialKeys[i] = data.m_specialKeys[i] && !prevInput.m_kbm->m_specialKeys[i];
|
||||
for (int i = 0; i < 6; ++i)
|
||||
}
|
||||
for (size_t i = 0; i < m_PMouseButtons.size(); ++i) {
|
||||
m_PMouseButtons[i] = data.m_mouseButtons[i] && !prevInput.m_kbm->m_mouseButtons[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -195,12 +198,9 @@ CFinalInput& CFinalInput::operator|=(const CFinalInput& other) {
|
|||
x2e_b31_PStart |= other.x2e_b31_PStart;
|
||||
if (other.m_kbm) {
|
||||
m_kbm = other.m_kbm;
|
||||
for (int i = 0; i < 256; ++i)
|
||||
m_PCharKeys[i] = other.m_PCharKeys[i];
|
||||
for (int i = 0; i < 26; ++i)
|
||||
m_PSpecialKeys[i] = other.m_PSpecialKeys[i];
|
||||
for (int i = 0; i < 6; ++i)
|
||||
m_PMouseButtons[i] = other.m_PMouseButtons[i];
|
||||
m_PCharKeys = other.m_PCharKeys;
|
||||
m_PSpecialKeys = other.m_PSpecialKeys;
|
||||
m_PMouseButtons = other.m_PMouseButtons;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <array>
|
||||
|
||||
#include "Runtime/RetroTypes.hpp"
|
||||
#include "Runtime/Input/CKeyboardMouseController.hpp"
|
||||
|
||||
|
@ -62,9 +64,9 @@ struct CFinalInput {
|
|||
|
||||
std::optional<CKeyboardMouseControllerData> m_kbm;
|
||||
|
||||
bool m_PCharKeys[256] = {};
|
||||
bool m_PSpecialKeys[26] = {};
|
||||
bool m_PMouseButtons[6] = {};
|
||||
std::array<bool, 256> m_PCharKeys{};
|
||||
std::array<bool, 26> m_PSpecialKeys{};
|
||||
std::array<bool, 6> m_PMouseButtons{};
|
||||
|
||||
float m_leftMul = 1.f;
|
||||
float m_rightMul = 1.f;
|
||||
|
@ -158,12 +160,12 @@ struct CFinalInput {
|
|||
|
||||
CFinalInput ScaleAnalogueSticks(float leftDiv, float rightDiv) const;
|
||||
|
||||
bool PKey(char k) const { return m_kbm && m_PCharKeys[int(k)]; }
|
||||
bool PSpecialKey(boo::ESpecialKey k) const { return m_kbm && m_PSpecialKeys[int(k)]; }
|
||||
bool PMouseButton(boo::EMouseButton k) const { return m_kbm && m_PMouseButtons[int(k)]; }
|
||||
bool DKey(char k) const { return m_kbm && m_kbm->m_charKeys[int(k)]; }
|
||||
bool DSpecialKey(boo::ESpecialKey k) const { return m_kbm && m_kbm->m_specialKeys[int(k)]; }
|
||||
bool DMouseButton(boo::EMouseButton k) const { return m_kbm && m_kbm->m_mouseButtons[int(k)]; }
|
||||
bool PKey(char k) const { return m_kbm && m_PCharKeys[size_t(k)]; }
|
||||
bool PSpecialKey(boo::ESpecialKey k) const { return m_kbm && m_PSpecialKeys[size_t(k)]; }
|
||||
bool PMouseButton(boo::EMouseButton k) const { return m_kbm && m_PMouseButtons[size_t(k)]; }
|
||||
bool DKey(char k) const { return m_kbm && m_kbm->m_charKeys[size_t(k)]; }
|
||||
bool DSpecialKey(boo::ESpecialKey k) const { return m_kbm && m_kbm->m_specialKeys[size_t(k)]; }
|
||||
bool DMouseButton(boo::EMouseButton k) const { return m_kbm && m_kbm->m_mouseButtons[size_t(k)]; }
|
||||
float AKey(char k) const { return DKey(k) ? 1.f : 0.f; }
|
||||
float ASpecialKey(boo::ESpecialKey k) const { return DSpecialKey(k) ? 1.f : 0.f; }
|
||||
float AMouseButton(boo::EMouseButton k) const { return DMouseButton(k) ? 1.f : 0.f; }
|
||||
|
|
|
@ -49,10 +49,10 @@ public:
|
|||
* is necessary, only absolute state tracking. */
|
||||
|
||||
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton button, boo::EModifierKey) {
|
||||
m_data.m_mouseButtons[int(button)] = true;
|
||||
m_data.m_mouseButtons[size_t(button)] = true;
|
||||
}
|
||||
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton button, boo::EModifierKey) {
|
||||
m_data.m_mouseButtons[int(button)] = false;
|
||||
m_data.m_mouseButtons[size_t(button)] = false;
|
||||
}
|
||||
void mouseMove(const boo::SWindowCoord& coord) { m_data.m_mouseCoord = coord; }
|
||||
void scroll(const boo::SWindowCoord&, const boo::SScrollDelta& scroll) { m_data.m_accumScroll += scroll; }
|
||||
|
@ -69,8 +69,8 @@ public:
|
|||
return;
|
||||
m_data.m_charKeys[charCode] = false;
|
||||
}
|
||||
void specialKeyDown(boo::ESpecialKey key, boo::EModifierKey, bool) { m_data.m_specialKeys[int(key)] = true; }
|
||||
void specialKeyUp(boo::ESpecialKey key, boo::EModifierKey) { m_data.m_specialKeys[int(key)] = false; }
|
||||
void specialKeyDown(boo::ESpecialKey key, boo::EModifierKey, bool) { m_data.m_specialKeys[size_t(key)] = true; }
|
||||
void specialKeyUp(boo::ESpecialKey key, boo::EModifierKey) { m_data.m_specialKeys[size_t(key)] = false; }
|
||||
void modKeyDown(boo::EModifierKey mod, bool) { m_data.m_modMask = m_data.m_modMask | mod; }
|
||||
void modKeyUp(boo::EModifierKey mod) { m_data.m_modMask = m_data.m_modMask & ~mod; }
|
||||
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
#pragma once
|
||||
|
||||
#include <boo/boo.hpp>
|
||||
#include <array>
|
||||
#include <boo/IWindow.hpp>
|
||||
|
||||
namespace urde {
|
||||
|
||||
struct CKeyboardMouseControllerData {
|
||||
bool m_charKeys[256] = {};
|
||||
bool m_specialKeys[26] = {};
|
||||
bool m_mouseButtons[6] = {};
|
||||
std::array<bool, 256> m_charKeys{};
|
||||
std::array<bool, 26> m_specialKeys{};
|
||||
std::array<bool, 6> m_mouseButtons{};
|
||||
boo::EModifierKey m_modMask = boo::EModifierKey::None;
|
||||
boo::SWindowCoord m_mouseCoord;
|
||||
boo::SScrollDelta m_accumScroll;
|
||||
|
|
|
@ -210,7 +210,7 @@ static const ControlMapper::EKBMFunctionList skKBMMapping[] = {
|
|||
#define kCommandFilterCount 67
|
||||
static bool skCommandFilterFlag[kCommandFilterCount] = {true};
|
||||
|
||||
void ControlMapper::SetCommandFiltered(ECommands cmd, bool filtered) { skCommandFilterFlag[int(cmd)] = filtered; }
|
||||
void ControlMapper::SetCommandFiltered(ECommands cmd, bool filtered) { skCommandFilterFlag[size_t(cmd)] = filtered; }
|
||||
|
||||
void ControlMapper::ResetCommandFilters() {
|
||||
for (int i = 0; i < kCommandFilterCount; ++i)
|
||||
|
@ -218,46 +218,53 @@ void ControlMapper::ResetCommandFilters() {
|
|||
}
|
||||
|
||||
bool ControlMapper::GetPressInput(ECommands cmd, const CFinalInput& input) {
|
||||
if (!skCommandFilterFlag[int(cmd)])
|
||||
if (!skCommandFilterFlag[size_t(cmd)]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ret = false;
|
||||
EFunctionList func = EFunctionList(g_currentPlayerControl->GetMapping(atUint32(cmd)));
|
||||
const auto func = EFunctionList(g_currentPlayerControl->GetMapping(atUint32(cmd)));
|
||||
if (func < EFunctionList::MAX) {
|
||||
if (BoolReturnFn fn = skPressFuncs[int(func)])
|
||||
if (BoolReturnFn fn = skPressFuncs[size_t(func)]) {
|
||||
ret = (input.*fn)();
|
||||
}
|
||||
}
|
||||
if (const auto& kbm = input.GetKBM()) {
|
||||
EKBMFunctionList kbmfunc = skKBMMapping[int(cmd)];
|
||||
const EKBMFunctionList kbmfunc = skKBMMapping[size_t(cmd)];
|
||||
if (kbmfunc < EKBMFunctionList::MAX) {
|
||||
if (kbmfunc >= EKBMFunctionList::MousePress)
|
||||
ret |= input.m_PMouseButtons[int(kbmfunc) - int(EKBMFunctionList::MousePress)];
|
||||
else if (kbmfunc >= EKBMFunctionList::SpecialKeyPress)
|
||||
ret |= input.m_PSpecialKeys[int(kbmfunc) - int(EKBMFunctionList::SpecialKeyPress)];
|
||||
else if (kbmfunc >= EKBMFunctionList::KeyPress)
|
||||
ret |= input.m_PCharKeys[int(kbmfunc) - int(EKBMFunctionList::KeyPress)];
|
||||
if (kbmfunc >= EKBMFunctionList::MousePress) {
|
||||
ret |= input.m_PMouseButtons[size_t(kbmfunc) - size_t(EKBMFunctionList::MousePress)];
|
||||
} else if (kbmfunc >= EKBMFunctionList::SpecialKeyPress) {
|
||||
ret |= input.m_PSpecialKeys[size_t(kbmfunc) - size_t(EKBMFunctionList::SpecialKeyPress)];
|
||||
} else if (kbmfunc >= EKBMFunctionList::KeyPress) {
|
||||
ret |= input.m_PCharKeys[size_t(kbmfunc) - size_t(EKBMFunctionList::KeyPress)];
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool ControlMapper::GetDigitalInput(ECommands cmd, const CFinalInput& input) {
|
||||
if (!skCommandFilterFlag[int(cmd)])
|
||||
if (!skCommandFilterFlag[size_t(cmd)]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ret = false;
|
||||
EFunctionList func = EFunctionList(g_currentPlayerControl->GetMapping(atUint32(cmd)));
|
||||
const auto func = EFunctionList(g_currentPlayerControl->GetMapping(atUint32(cmd)));
|
||||
if (func < EFunctionList::MAX) {
|
||||
if (BoolReturnFn fn = skDigitalFuncs[int(func)])
|
||||
if (BoolReturnFn fn = skDigitalFuncs[size_t(func)])
|
||||
ret = (input.*fn)();
|
||||
}
|
||||
if (const auto& kbm = input.GetKBM()) {
|
||||
EKBMFunctionList kbmfunc = skKBMMapping[int(cmd)];
|
||||
EKBMFunctionList kbmfunc = skKBMMapping[size_t(cmd)];
|
||||
if (kbmfunc < EKBMFunctionList::MAX) {
|
||||
if (kbmfunc >= EKBMFunctionList::MousePress)
|
||||
ret |= kbm->m_mouseButtons[int(kbmfunc) - int(EKBMFunctionList::MousePress)];
|
||||
else if (kbmfunc >= EKBMFunctionList::SpecialKeyPress)
|
||||
ret |= kbm->m_specialKeys[int(kbmfunc) - int(EKBMFunctionList::SpecialKeyPress)];
|
||||
else if (kbmfunc >= EKBMFunctionList::KeyPress)
|
||||
ret |= kbm->m_charKeys[int(kbmfunc) - int(EKBMFunctionList::KeyPress)];
|
||||
if (kbmfunc >= EKBMFunctionList::MousePress) {
|
||||
ret |= kbm->m_mouseButtons[size_t(kbmfunc) - size_t(EKBMFunctionList::MousePress)];
|
||||
} else if (kbmfunc >= EKBMFunctionList::SpecialKeyPress) {
|
||||
ret |= kbm->m_specialKeys[size_t(kbmfunc) - size_t(EKBMFunctionList::SpecialKeyPress)];
|
||||
} else if (kbmfunc >= EKBMFunctionList::KeyPress) {
|
||||
ret |= kbm->m_charKeys[size_t(kbmfunc) - size_t(EKBMFunctionList::KeyPress)];
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
@ -265,52 +272,65 @@ bool ControlMapper::GetDigitalInput(ECommands cmd, const CFinalInput& input) {
|
|||
|
||||
static float KBToWASDX(const CKeyboardMouseControllerData& data) {
|
||||
float retval = 0.0;
|
||||
if (data.m_charKeys[int('a')])
|
||||
if (data.m_charKeys[size_t('a')]) {
|
||||
retval -= 1.0;
|
||||
if (data.m_charKeys[int('d')])
|
||||
}
|
||||
if (data.m_charKeys[size_t('d')]) {
|
||||
retval += 1.0;
|
||||
if (data.m_charKeys[int('w')] ^ data.m_charKeys[int('s')])
|
||||
}
|
||||
if (data.m_charKeys[size_t('w')] ^ data.m_charKeys[size_t('s')]) {
|
||||
retval *= 0.555f;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
static float KBToWASDY(const CKeyboardMouseControllerData& data) {
|
||||
float retval = 0.0;
|
||||
if (data.m_charKeys[int('s')])
|
||||
if (data.m_charKeys[size_t('s')]) {
|
||||
retval -= 1.0;
|
||||
if (data.m_charKeys[int('w')])
|
||||
}
|
||||
if (data.m_charKeys[size_t('w')]) {
|
||||
retval += 1.0;
|
||||
if (data.m_charKeys[int('a')] ^ data.m_charKeys[int('d')])
|
||||
}
|
||||
if (data.m_charKeys[size_t('a')] ^ data.m_charKeys[size_t('d')]) {
|
||||
retval *= 0.555f;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
static float KBToArrowsX(const CKeyboardMouseControllerData& data) {
|
||||
float retval = 0.0;
|
||||
if (data.m_specialKeys[int(boo::ESpecialKey::Left)])
|
||||
if (data.m_specialKeys[size_t(boo::ESpecialKey::Left)]) {
|
||||
retval -= 1.0;
|
||||
if (data.m_specialKeys[int(boo::ESpecialKey::Right)])
|
||||
}
|
||||
if (data.m_specialKeys[size_t(boo::ESpecialKey::Right)]) {
|
||||
retval += 1.0;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
static float KBToArrowsY(const CKeyboardMouseControllerData& data) {
|
||||
float retval = 0.0;
|
||||
if (data.m_specialKeys[int(boo::ESpecialKey::Down)])
|
||||
if (data.m_specialKeys[size_t(boo::ESpecialKey::Down)]) {
|
||||
retval -= 1.0;
|
||||
if (data.m_specialKeys[int(boo::ESpecialKey::Up)])
|
||||
}
|
||||
if (data.m_specialKeys[size_t(boo::ESpecialKey::Up)]) {
|
||||
retval += 1.0;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
float ControlMapper::GetAnalogInput(ECommands cmd, const CFinalInput& input) {
|
||||
if (!skCommandFilterFlag[int(cmd)])
|
||||
if (!skCommandFilterFlag[size_t(cmd)]) {
|
||||
return 0.f;
|
||||
}
|
||||
|
||||
float ret = 0.f;
|
||||
EFunctionList func = EFunctionList(g_currentPlayerControl->GetMapping(atUint32(cmd)));
|
||||
const auto func = EFunctionList(g_currentPlayerControl->GetMapping(atUint32(cmd)));
|
||||
if (func < EFunctionList::MAX) {
|
||||
if (FloatReturnFn fn = skAnalogFuncs[int(func)])
|
||||
if (FloatReturnFn fn = skAnalogFuncs[size_t(func)]) {
|
||||
ret = (input.*fn)();
|
||||
}
|
||||
}
|
||||
if (const auto& kbm = input.GetKBM()) {
|
||||
switch (cmd) {
|
||||
|
@ -353,14 +373,16 @@ float ControlMapper::GetAnalogInput(ECommands cmd, const CFinalInput& input) {
|
|||
ret = std::max(ret, KBToArrowsX(*kbm));
|
||||
break;
|
||||
default: {
|
||||
EKBMFunctionList kbmfunc = skKBMMapping[int(cmd)];
|
||||
const EKBMFunctionList kbmfunc = skKBMMapping[size_t(cmd)];
|
||||
if (kbmfunc < EKBMFunctionList::MAX) {
|
||||
if (kbmfunc >= EKBMFunctionList::MousePress)
|
||||
ret = std::max(ret, kbm->m_mouseButtons[int(kbmfunc) - int(EKBMFunctionList::MousePress)] ? 1.f : 0.f);
|
||||
else if (kbmfunc >= EKBMFunctionList::SpecialKeyPress)
|
||||
ret = std::max(ret, kbm->m_specialKeys[int(kbmfunc) - int(EKBMFunctionList::SpecialKeyPress)] ? 1.f : 0.f);
|
||||
else if (kbmfunc >= EKBMFunctionList::KeyPress)
|
||||
ret = std::max(ret, kbm->m_charKeys[int(kbmfunc) - int(EKBMFunctionList::KeyPress)] ? 1.f : 0.f);
|
||||
if (kbmfunc >= EKBMFunctionList::MousePress) {
|
||||
ret = std::max(ret, kbm->m_mouseButtons[size_t(kbmfunc) - size_t(EKBMFunctionList::MousePress)] ? 1.f : 0.f);
|
||||
} else if (kbmfunc >= EKBMFunctionList::SpecialKeyPress) {
|
||||
ret = std::max(ret,
|
||||
kbm->m_specialKeys[size_t(kbmfunc) - size_t(EKBMFunctionList::SpecialKeyPress)] ? 1.f : 0.f);
|
||||
} else if (kbmfunc >= EKBMFunctionList::KeyPress) {
|
||||
ret = std::max(ret, kbm->m_charKeys[size_t(kbmfunc) - size_t(EKBMFunctionList::KeyPress)] ? 1.f : 0.f);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -373,14 +395,14 @@ const char* ControlMapper::GetDescriptionForCommand(ECommands cmd) {
|
|||
if (cmd >= ECommands::MAX) {
|
||||
return nullptr;
|
||||
}
|
||||
return skCommandDescs[int(cmd)];
|
||||
return skCommandDescs[size_t(cmd)];
|
||||
}
|
||||
|
||||
const char* ControlMapper::GetDescriptionForFunction(EFunctionList func) {
|
||||
if (func >= EFunctionList::MAX) {
|
||||
return nullptr;
|
||||
}
|
||||
return skFunctionDescs[int(func)];
|
||||
return skFunctionDescs[size_t(func)];
|
||||
}
|
||||
|
||||
} // namespace urde
|
||||
|
|
|
@ -158,8 +158,8 @@ void CInventoryScreen::ProcessControllerInput(const CFinalInput& input) {
|
|||
m_lastMouseCoord = mouseCoord;
|
||||
mouseDelta.x() *= g_Viewport.aspect;
|
||||
mouseDelta *= 100.f;
|
||||
if (kbm->m_mouseButtons[int(boo::EMouseButton::Middle)] ||
|
||||
kbm->m_mouseButtons[int(boo::EMouseButton::Secondary)]) {
|
||||
if (kbm->m_mouseButtons[size_t(boo::EMouseButton::Middle)] ||
|
||||
kbm->m_mouseButtons[size_t(boo::EMouseButton::Secondary)]) {
|
||||
if (float(mouseDelta.x()) < 0.f)
|
||||
moveRight += -mouseDelta.x();
|
||||
else if (float(mouseDelta.x()) > 0.f)
|
||||
|
@ -169,7 +169,7 @@ void CInventoryScreen::ProcessControllerInput(const CFinalInput& input) {
|
|||
else if (float(mouseDelta.y()) > 0.f)
|
||||
moveBack += mouseDelta.y();
|
||||
}
|
||||
if (kbm->m_mouseButtons[int(boo::EMouseButton::Primary)]) {
|
||||
if (kbm->m_mouseButtons[size_t(boo::EMouseButton::Primary)]) {
|
||||
if (float(mouseDelta.x()) < 0.f)
|
||||
circleRight += -mouseDelta.x();
|
||||
else if (float(mouseDelta.x()) > 0.f)
|
||||
|
|
Loading…
Reference in New Issue