History

hacking on controller events

ZappoMan committed 12 years ago

Commit 5addc351 parent 64afd173 files · +61 −0Browse files

Showing the changes to interface/src/Application.cpp (1 of 3 files). Show all

Unified · Split

interface/src/Application.cpp+17−0
@@ -681,6 +681,9 @@ void Application::controlledBroadcastToNodes(unsigned char* broadcastData, size_ · 680 unmodified lines
681681 }
682682
683683 void Application::keyPressEvent(QKeyEvent* event) {
684+
685+ _controllerScriptingInterface.emitKeyPressEvent(event); // send events to any registered scripts
686+
684687 if (activeWindow() == _window) {
685688 if (_chatEntryOn) {
686689 if (_chatEntry.keyPressEvent(event)) {
@@ -1092,6 +1095,9 @@ void Application::keyPressEvent(QKeyEvent* event) { · 405 unmodified lines
10921095 }
10931096
10941097 void Application::keyReleaseEvent(QKeyEvent* event) {
1098+
1099+ _controllerScriptingInterface.emitKeyReleaseEvent(event); // send events to any registered scripts
1100+
10951101 if (activeWindow() == _window) {
10961102 if (_chatEntryOn) {
10971103 _myAvatar.setKeyState(NO_KEY_DOWN);
@@ -1154,6 +1160,8 @@ void Application::keyReleaseEvent(QKeyEvent* event) { · 56 unmodified lines
11541160 }
11551161
11561162 void Application::mouseMoveEvent(QMouseEvent* event) {
1163+ _controllerScriptingInterface.emitMouseMoveEvent(event); // send events to any registered scripts
1164+
11571165 _lastMouseMove = usecTimestampNow();
11581166 if (_mouseHidden) {
11591167 getGLWidget()->setCursor(Qt::ArrowCursor);
@@ -1200,6 +1208,7 @@ const float HOVER_VOXEL_FREQUENCY = 7040.f; · 40 unmodified lines
12001208 const float HOVER_VOXEL_DECAY = 0.999f;
12011209
12021210 void Application::mousePressEvent(QMouseEvent* event) {
1211+ _controllerScriptingInterface.emitMousePressEvent(event); // send events to any registered scripts
12031212 if (activeWindow() == _window) {
12041213 if (event->button() == Qt::LeftButton) {
12051214 _mouseX = event->x();
@@ -1267,6 +1276,7 @@ void Application::mousePressEvent(QMouseEvent* event) { · 61 unmodified lines
12671276 }
12681277
12691278 void Application::mouseReleaseEvent(QMouseEvent* event) {
1279+ _controllerScriptingInterface.emitMouseReleaseEvent(event); // send events to any registered scripts
12701280 if (activeWindow() == _window) {
12711281 if (event->button() == Qt::LeftButton) {
12721282 _mouseX = event->x();
@@ -1283,6 +1293,7 @@ void Application::mouseReleaseEvent(QMouseEvent* event) { · 10 unmodified lines
12831293 }
12841294
12851295 void Application::touchUpdateEvent(QTouchEvent* event) {
1296+ _controllerScriptingInterface.emitTouchUpdateEvent(event); // send events to any registered scripts
12861297 bool validTouch = false;
12871298 if (activeWindow() == _window) {
12881299 const QList<QTouchEvent::TouchPoint>& tPoints = event->touchPoints();
@@ -1307,12 +1318,15 @@ void Application::touchUpdateEvent(QTouchEvent* event) { · 18 unmodified lines
13071318 }
13081319
13091320 void Application::touchBeginEvent(QTouchEvent* event) {
1321+ _controllerScriptingInterface.emitTouchBeginEvent(event); // send events to any registered scripts
1322+
13101323 touchUpdateEvent(event);
13111324 _lastTouchAvgX = _touchAvgX;
13121325 _lastTouchAvgY = _touchAvgY;
13131326 }
13141327
13151328 void Application::touchEndEvent(QTouchEvent* event) {
1329+ _controllerScriptingInterface.emitTouchEndEvent(event); // send events to any registered scripts
13161330 _touchDragStartedAvgX = _touchAvgX;
13171331 _touchDragStartedAvgY = _touchAvgY;
13181332 _isTouchPressed = false;
@@ -1320,6 +1334,9 @@ void Application::touchEndEvent(QTouchEvent* event) { · 1 unmodified line
13201334
13211335 const bool USE_MOUSEWHEEL = false;
13221336 void Application::wheelEvent(QWheelEvent* event) {
1337+
1338+ _controllerScriptingInterface.emitWheelEvent(event); // send events to any registered scripts
1339+
13231340 // Wheel Events disabled for now because they are also activated by touch look pitch up/down.
13241341 if (USE_MOUSEWHEEL && (activeWindow() == _window)) {
13251342 if (!Menu::getInstance()->isVoxelModeActionChecked()) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t