History

rename HFCancelEvent to HFBackEvent, fire from joystick

Stephen Birarda committed 12 years ago

Commit 8a9f2d11 parent 04e7e975 files · +33 −20Browse files

Showing the changes to interface/src/scripting/JoystickScriptingInterface.cpp (1 of 5 files). Show all

Unified · Split

interface/src/scripting/JoystickScriptingInterface.cpp+13−0
@@ -9,6 +9,7 @@ · 8 unmodified lines
9// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html9// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
10//10//
11 11
12#include <qapplication.h>
12#include <QtDebug>13#include <QtDebug>
13#include <QScriptValue>14#include <QScriptValue>
14 15
@@ -17,6 +18,7 @@ · 2 unmodified lines
17#undef main18#undef main
18#endif19#endif
19 20
21#include <HFBackEvent.h>
20#include <PerfStat.h>22#include <PerfStat.h>
21 23
22#include "JoystickScriptingInterface.h"24#include "JoystickScriptingInterface.h"
@@ -108,6 +110,17 @@ void JoystickScriptingInterface::update() { · 85 unmodified lines
108 if (joystick) {110 if (joystick) {
109 joystick->handleButtonEvent(event.cbutton);111 joystick->handleButtonEvent(event.cbutton);
110 }112 }
113
114 if (event.cbutton.button == SDL_CONTROLLER_BUTTON_BACK) {
115 // this will either start or stop a cancel event
116 QEvent::Type backType = (event.type == SDL_CONTROLLERBUTTONDOWN)
117 ? HFBackEvent::startType()
118 : HFBackEvent::endType();
119 HFBackEvent backEvent(backType);
120
121 qApp->sendEvent(qApp, &backEvent);
122 }
123
111 } else if (event.type == SDL_CONTROLLERDEVICEADDED) {124 } else if (event.type == SDL_CONTROLLERDEVICEADDED) {
112 SDL_GameController* controller = SDL_GameControllerOpen(event.cdevice.which);125 SDL_GameController* controller = SDL_GameControllerOpen(event.cdevice.which);
113 126