diff options
author | jmarshallnz <jmarshallnz@svn> | 2010-02-19 02:55:37 +0000 |
---|---|---|
committer | jmarshallnz <jmarshallnz@svn> | 2010-02-19 02:55:37 +0000 |
commit | 5f22c573c7fbb7a45cf2aaee2e1ddad7bb7899cb (patch) | |
tree | 616c5e8b5f6bb5ee97f4e2ed92ab661d2f22e555 /guilib/Key.cpp | |
parent | af22bc05ff517e85698c5618ad0b322706955ed8 (diff) |
cleanup: Move all members of CAction private, accessed via getters, as we only ever set in constructors.
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@27962 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
Diffstat (limited to 'guilib/Key.cpp')
-rw-r--r-- | guilib/Key.cpp | 65 |
1 files changed, 34 insertions, 31 deletions
diff --git a/guilib/Key.cpp b/guilib/Key.cpp index 07d7441838..c54cc7e2cc 100644 --- a/guilib/Key.cpp +++ b/guilib/Key.cpp @@ -163,57 +163,60 @@ unsigned int CKey::GetHeld() const return m_held; } -CAction::CAction(int actionID, float _amount1 /* = 1.0f */, float _amount2 /* = 0.0f */, const CStdString &name /* = "" */) +CAction::CAction(int actionID, float amount1 /* = 1.0f */, float amount2 /* = 0.0f */, const CStdString &name /* = "" */) { - actionId = actionID; - amount1 = _amount1; - amount2 = _amount2; - strAction = name; - repeat = 0; - buttonCode = 0; - unicode = 0; - holdTime = 0; + m_id = actionID; + m_amount[0] = amount1; + m_amount[1] = amount2; + for (unsigned int i = 2; i < max_amounts; i++) + m_amount[i] = 0; + m_name = name; + m_repeat = 0; + m_buttonCode = 0; + m_unicode = 0; + m_holdTime = 0; } CAction::CAction(int actionID, const CStdString &name, const CKey &key) { - actionId = actionID; - strAction = name; - amount1 = 1; // digital button (could change this for repeat acceleration) - amount2 = 0; - repeat = key.GetRepeat(); - buttonCode = key.GetButtonCode(); - unicode = 0; - holdTime = key.GetHeld(); + m_id = actionID; + m_name = name; + m_amount[0] = 1; // digital button (could change this for repeat acceleration) + for (unsigned int i = 1; i < max_amounts; i++) + m_amount[i] = 0; + m_repeat = key.GetRepeat(); + m_buttonCode = key.GetButtonCode(); + m_unicode = 0; + m_holdTime = key.GetHeld(); // get the action amounts of the analog buttons if (key.GetButtonCode() == KEY_BUTTON_LEFT_ANALOG_TRIGGER) - amount1 = (float)key.GetLeftTrigger() / 255.0f; + m_amount[0] = (float)key.GetLeftTrigger() / 255.0f; else if (key.GetButtonCode() == KEY_BUTTON_RIGHT_ANALOG_TRIGGER) - amount1 = (float)key.GetRightTrigger() / 255.0f; + m_amount[0] = (float)key.GetRightTrigger() / 255.0f; else if (key.GetButtonCode() == KEY_BUTTON_LEFT_THUMB_STICK) { - amount1 = key.GetLeftThumbX(); - amount2 = key.GetLeftThumbY(); + m_amount[0] = key.GetLeftThumbX(); + m_amount[1] = key.GetLeftThumbY(); } else if (key.GetButtonCode() == KEY_BUTTON_RIGHT_THUMB_STICK) { - amount1 = key.GetRightThumbX(); - amount2 = key.GetRightThumbY(); + m_amount[0] = key.GetRightThumbX(); + m_amount[1] = key.GetRightThumbY(); } else if (key.GetButtonCode() == KEY_BUTTON_LEFT_THUMB_STICK_UP) - amount1 = key.GetLeftThumbY(); + m_amount[0] = key.GetLeftThumbY(); else if (key.GetButtonCode() == KEY_BUTTON_LEFT_THUMB_STICK_DOWN) - amount1 = -key.GetLeftThumbY(); + m_amount[0] = -key.GetLeftThumbY(); else if (key.GetButtonCode() == KEY_BUTTON_LEFT_THUMB_STICK_LEFT) - amount1 = -key.GetLeftThumbX(); + m_amount[0] = -key.GetLeftThumbX(); else if (key.GetButtonCode() == KEY_BUTTON_LEFT_THUMB_STICK_RIGHT) - amount1 = key.GetLeftThumbX(); + m_amount[0] = key.GetLeftThumbX(); else if (key.GetButtonCode() == KEY_BUTTON_RIGHT_THUMB_STICK_UP) - amount1 = key.GetRightThumbY(); + m_amount[0] = key.GetRightThumbY(); else if (key.GetButtonCode() == KEY_BUTTON_RIGHT_THUMB_STICK_DOWN) - amount1 = -key.GetRightThumbY(); + m_amount[0] = -key.GetRightThumbY(); else if (key.GetButtonCode() == KEY_BUTTON_RIGHT_THUMB_STICK_LEFT) - amount1 = -key.GetRightThumbX(); + m_amount[0] = -key.GetRightThumbX(); else if (key.GetButtonCode() == KEY_BUTTON_RIGHT_THUMB_STICK_RIGHT) - amount1 = key.GetRightThumbX(); + m_amount[0] = key.GetRightThumbX(); } |