rename some variables

This commit is contained in:
Thomas Jentzsch 2019-08-15 12:20:10 +02:00
parent b47234f776
commit 9f51b8caa0
10 changed files with 24 additions and 24 deletions

View File

@ -168,8 +168,8 @@ class EventHandler
Event::Type eventForJoyButton(EventMode mode, int stick, int button) const { Event::Type eventForJoyButton(EventMode mode, int stick, int button) const {
return myPJoyHandler->eventForButton(mode, stick, button); return myPJoyHandler->eventForButton(mode, stick, button);
} }
Event::Type eventForJoyHat(EventMode mode, int stick, int hat, JoyHatDir value, int button) const { Event::Type eventForJoyHat(EventMode mode, int stick, int hat, JoyHatDir hdir, int button) const {
return myPJoyHandler->eventForHat(mode, stick, hat, value, button); return myPJoyHandler->eventForHat(mode, stick, hat, hdir, button);
} }
/** Get description of given event and mode. */ /** Get description of given event and mode. */

View File

@ -299,9 +299,9 @@ void ContextMenu::handleJoyAxis(int stick, JoyAxis axis, JoyDir adir, int button
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool ContextMenu::handleJoyHat(int stick, int hat, JoyHatDir value, int button) bool ContextMenu::handleJoyHat(int stick, int hat, JoyHatDir hdir, int button)
{ {
handleEvent(instance().eventHandler().eventForJoyHat(EventMode::kMenuMode, stick, hat, value, button)); handleEvent(instance().eventHandler().eventForJoyHat(EventMode::kMenuMode, stick, hat, hdir, button));
return true; return true;
} }

View File

@ -89,7 +89,7 @@ class ContextMenu : public Dialog, public CommandSender
void handleKeyDown(StellaKey key, StellaMod mod, bool repeated) override; void handleKeyDown(StellaKey key, StellaMod mod, bool repeated) override;
void handleJoyDown(int stick, int button, bool longPress) override; void handleJoyDown(int stick, int button, bool longPress) override;
void handleJoyAxis(int stick, JoyAxis axis, JoyDir adir, int button) override; void handleJoyAxis(int stick, JoyAxis axis, JoyDir adir, int button) override;
bool handleJoyHat(int stick, int hat, JoyHatDir value, int button) override; bool handleJoyHat(int stick, int hat, JoyHatDir vahdirlue, int button) override;
void handleEvent(Event::Type e); void handleEvent(Event::Type e);
void drawDialog() override; void drawDialog() override;

View File

@ -635,17 +635,17 @@ void Dialog::handleJoyAxis(int stick, JoyAxis axis, JoyDir adir, int button)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Dialog::handleJoyHat(int stick, int hat, JoyHatDir value, int button) bool Dialog::handleJoyHat(int stick, int hat, JoyHatDir hdir, int button)
{ {
Event::Type e = Event::Type e =
instance().eventHandler().eventForJoyHat(EventMode::kMenuMode, stick, hat, value, button); instance().eventHandler().eventForJoyHat(EventMode::kMenuMode, stick, hat, hdir, button);
// Unless a widget has claimed all responsibility for data, we assume // Unless a widget has claimed all responsibility for data, we assume
// that if an event exists for the given data, it should have priority. // that if an event exists for the given data, it should have priority.
if(!handleNavEvent(e) && _focusedWidget) if(!handleNavEvent(e) && _focusedWidget)
{ {
if(_focusedWidget->wantsRaw() || e == Event::NoType) if(_focusedWidget->wantsRaw() || e == Event::NoType)
return _focusedWidget->handleJoyHat(stick, hat, value, button); return _focusedWidget->handleJoyHat(stick, hat, hdir, button);
else else
return _focusedWidget->handleEvent(e); return _focusedWidget->handleEvent(e);
} }

View File

@ -140,7 +140,7 @@ class Dialog : public GuiObject
virtual void handleJoyDown(int stick, int button, bool longPress = false); virtual void handleJoyDown(int stick, int button, bool longPress = false);
virtual void handleJoyUp(int stick, int button); virtual void handleJoyUp(int stick, int button);
virtual void handleJoyAxis(int stick, JoyAxis axis, JoyDir adir, int button = JOY_CTRL_NONE); virtual void handleJoyAxis(int stick, JoyAxis axis, JoyDir adir, int button = JOY_CTRL_NONE);
virtual bool handleJoyHat(int stick, int hat, JoyHatDir value, int button = JOY_CTRL_NONE); virtual bool handleJoyHat(int stick, int hat, JoyHatDir hdir, int button = JOY_CTRL_NONE);
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id) override; virtual void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
virtual Event::Type getJoyAxisEvent(int stick, JoyAxis axis, JoyDir adir, int button); virtual Event::Type getJoyAxisEvent(int stick, JoyAxis axis, JoyDir adir, int button);

View File

@ -88,7 +88,7 @@ void DialogContainer::updateTime(uInt64 time)
if(myCurrentHatDown.stick != -1 && myHatRepeatTime < myTime) if(myCurrentHatDown.stick != -1 && myHatRepeatTime < myTime)
{ {
activeDialog->handleJoyHat(myCurrentHatDown.stick, myCurrentHatDown.hat, activeDialog->handleJoyHat(myCurrentHatDown.stick, myCurrentHatDown.hat,
myCurrentHatDown.value); myCurrentHatDown.hdir);
myHatRepeatTime = myTime + _REPEAT_SUSTAIN_DELAY; myHatRepeatTime = myTime + _REPEAT_SUSTAIN_DELAY;
} }
} }
@ -343,7 +343,7 @@ void DialogContainer::handleJoyAxisEvent(int stick, JoyAxis axis, JoyDir adir, i
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DialogContainer::handleJoyHatEvent(int stick, int hat, JoyHatDir value, int button) void DialogContainer::handleJoyHatEvent(int stick, int hat, JoyHatDir hdir, int button)
{ {
if(myDialogStack.empty()) if(myDialogStack.empty())
return; return;
@ -355,20 +355,20 @@ void DialogContainer::handleJoyHatEvent(int stick, int hat, JoyHatDir value, int
myButtonLongPressTime = myTime + _REPEAT_NONE; myButtonLongPressTime = myTime + _REPEAT_NONE;
// Only stop firing events if it's the current stick // Only stop firing events if it's the current stick
if(myCurrentHatDown.stick == stick && value == JoyHatDir::CENTER) if(myCurrentHatDown.stick == stick && hdir == JoyHatDir::CENTER)
{ {
myCurrentHatDown.stick = myCurrentHatDown.hat = -1; myCurrentHatDown.stick = myCurrentHatDown.hat = -1;
myHatRepeatTime = 0; myHatRepeatTime = 0;
} }
else if(value != JoyHatDir::CENTER && myHatRepeatTime < myTime) // never repeat the 'center' direction; prevent pending repeats after enabling repeat again else if(hdir != JoyHatDir::CENTER && myHatRepeatTime < myTime) // never repeat the 'center' direction; prevent pending repeats after enabling repeat again
{ {
// Now account for repeated hat events (press and hold) // Now account for repeated hat events (press and hold)
myCurrentHatDown.stick = stick; myCurrentHatDown.stick = stick;
myCurrentHatDown.hat = hat; myCurrentHatDown.hat = hat;
myCurrentHatDown.value = value; myCurrentHatDown.hdir = hdir;
myHatRepeatTime = myTime + (activeDialog->repeatEnabled() ? _REPEAT_INITIAL_DELAY : _REPEAT_NONE); myHatRepeatTime = myTime + (activeDialog->repeatEnabled() ? _REPEAT_INITIAL_DELAY : _REPEAT_NONE);
} }
activeDialog->handleJoyHat(stick, hat, value, button); activeDialog->handleJoyHat(stick, hat, hdir, button);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -115,9 +115,9 @@ class DialogContainer
@param stick The joystick number @param stick The joystick number
@param hat The joystick hat @param hat The joystick hat
@param value Value associated with given hat @param hdir Direction of the with given hat
*/ */
void handleJoyHatEvent(int stick, int hat, JoyHatDir value, int button); void handleJoyHatEvent(int stick, int hat, JoyHatDir hdir, int button);
/** /**
Draw the stack of menus (full indicates to redraw all items). Draw the stack of menus (full indicates to redraw all items).
@ -217,7 +217,7 @@ class DialogContainer
struct { struct {
int stick; int stick;
int hat; int hat;
JoyHatDir value; JoyHatDir hdir;
} myCurrentHatDown; } myCurrentHatDown;
uInt64 myHatRepeatTime; uInt64 myHatRepeatTime;

View File

@ -511,15 +511,15 @@ void InputDialog::handleJoyAxis(int stick, JoyAxis axis, JoyDir adir, int button
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool InputDialog::handleJoyHat(int stick, int hat, JoyHatDir value, int button) bool InputDialog::handleJoyHat(int stick, int hat, JoyHatDir hdir, int button)
{ {
// Remap joystick hat in remap mode, otherwise pass to parent dialog // Remap joystick hat in remap mode, otherwise pass to parent dialog
if(myEmulEventMapper->remapMode()) if(myEmulEventMapper->remapMode())
return myEmulEventMapper->handleJoyHat(stick, hat, value, button); return myEmulEventMapper->handleJoyHat(stick, hat, hdir, button);
else if(myMenuEventMapper->remapMode()) else if(myMenuEventMapper->remapMode())
return myMenuEventMapper->handleJoyHat(stick, hat, value, button); return myMenuEventMapper->handleJoyHat(stick, hat, hdir, button);
else else
return Dialog::handleJoyHat(stick, hat, value, button); return Dialog::handleJoyHat(stick, hat, hdir, button);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -52,7 +52,7 @@ class InputDialog : public Dialog
void handleJoyDown(int stick, int button, bool longPress) override; void handleJoyDown(int stick, int button, bool longPress) override;
void handleJoyUp(int stick, int button) override; void handleJoyUp(int stick, int button) override;
void handleJoyAxis(int stick, JoyAxis axis, JoyDir adir, int button) override; void handleJoyAxis(int stick, JoyAxis axis, JoyDir adir, int button) override;
bool handleJoyHat(int stick, int hat, JoyHatDir value, int button) override; bool handleJoyHat(int stick, int hat, JoyHatDir hdir, int button) override;
void handleCommand(CommandSender* sender, int cmd, int data, int id) override; void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
void loadConfig() override; void loadConfig() override;

View File

@ -80,7 +80,7 @@ class Widget : public GuiObject
virtual void handleJoyDown(int stick, int button, bool longPress = false) { } virtual void handleJoyDown(int stick, int button, bool longPress = false) { }
virtual void handleJoyUp(int stick, int button) { } virtual void handleJoyUp(int stick, int button) { }
virtual void handleJoyAxis(int stick, JoyAxis axis, JoyDir adir, int button = JOY_CTRL_NONE) { } virtual void handleJoyAxis(int stick, JoyAxis axis, JoyDir adir, int button = JOY_CTRL_NONE) { }
virtual bool handleJoyHat(int stick, int hat, JoyHatDir value, int button = JOY_CTRL_NONE) { return false; } virtual bool handleJoyHat(int stick, int hat, JoyHatDir hdir, int button = JOY_CTRL_NONE) { return false; }
virtual bool handleEvent(Event::Type event) { return false; } virtual bool handleEvent(Event::Type event) { return false; }
void setDirty() override; void setDirty() override;