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
681}681}
682 682
683void Application::keyPressEvent(QKeyEvent* event) {683void Application::keyPressEvent(QKeyEvent* event) {
684
685 _controllerScriptingInterface.emitKeyPressEvent(event); // send events to any registered scripts
686
684 if (activeWindow() == _window) {687 if (activeWindow() == _window) {
685 if (_chatEntryOn) {688 if (_chatEntryOn) {
686 if (_chatEntry.keyPressEvent(event)) {689 if (_chatEntry.keyPressEvent(event)) {
@@ -1092,6 +1095,9 @@ void Application::keyPressEvent(QKeyEvent* event) { · 405 unmodified lines
1092}1095}
1093 1096
1094void Application::keyReleaseEvent(QKeyEvent* event) {1097void Application::keyReleaseEvent(QKeyEvent* event) {
1098
1099 _controllerScriptingInterface.emitKeyReleaseEvent(event); // send events to any registered scripts
1100
1095 if (activeWindow() == _window) {1101 if (activeWindow() == _window) {
1096 if (_chatEntryOn) {1102 if (_chatEntryOn) {
1097 _myAvatar.setKeyState(NO_KEY_DOWN);1103 _myAvatar.setKeyState(NO_KEY_DOWN);
@@ -1154,6 +1160,8 @@ void Application::keyReleaseEvent(QKeyEvent* event) { · 56 unmodified lines
1154}1160}
1155 1161
1156void Application::mouseMoveEvent(QMouseEvent* event) {1162void Application::mouseMoveEvent(QMouseEvent* event) {
1163 _controllerScriptingInterface.emitMouseMoveEvent(event); // send events to any registered scripts
1164
1157 _lastMouseMove = usecTimestampNow();1165 _lastMouseMove = usecTimestampNow();
1158 if (_mouseHidden) {1166 if (_mouseHidden) {
1159 getGLWidget()->setCursor(Qt::ArrowCursor);1167 getGLWidget()->setCursor(Qt::ArrowCursor);
@@ -1200,6 +1208,7 @@ const float HOVER_VOXEL_FREQUENCY = 7040.f; · 40 unmodified lines
1200const float HOVER_VOXEL_DECAY = 0.999f;1208const float HOVER_VOXEL_DECAY = 0.999f;
1201 1209
1202void Application::mousePressEvent(QMouseEvent* event) {1210void Application::mousePressEvent(QMouseEvent* event) {
1211 _controllerScriptingInterface.emitMousePressEvent(event); // send events to any registered scripts
1203 if (activeWindow() == _window) {1212 if (activeWindow() == _window) {
1204 if (event->button() == Qt::LeftButton) {1213 if (event->button() == Qt::LeftButton) {
1205 _mouseX = event->x();1214 _mouseX = event->x();
@@ -1267,6 +1276,7 @@ void Application::mousePressEvent(QMouseEvent* event) { · 61 unmodified lines
1267}1276}
1268 1277
1269void Application::mouseReleaseEvent(QMouseEvent* event) {1278void Application::mouseReleaseEvent(QMouseEvent* event) {
1279 _controllerScriptingInterface.emitMouseReleaseEvent(event); // send events to any registered scripts
1270 if (activeWindow() == _window) {1280 if (activeWindow() == _window) {
1271 if (event->button() == Qt::LeftButton) {1281 if (event->button() == Qt::LeftButton) {
1272 _mouseX = event->x();1282 _mouseX = event->x();
@@ -1283,6 +1293,7 @@ void Application::mouseReleaseEvent(QMouseEvent* event) { · 10 unmodified lines
1283}1293}
1284 1294
1285void Application::touchUpdateEvent(QTouchEvent* event) {1295void Application::touchUpdateEvent(QTouchEvent* event) {
1296 _controllerScriptingInterface.emitTouchUpdateEvent(event); // send events to any registered scripts
1286 bool validTouch = false;1297 bool validTouch = false;
1287 if (activeWindow() == _window) {1298 if (activeWindow() == _window) {
1288 const QList<QTouchEvent::TouchPoint>& tPoints = event->touchPoints();1299 const QList<QTouchEvent::TouchPoint>& tPoints = event->touchPoints();
@@ -1307,12 +1318,15 @@ void Application::touchUpdateEvent(QTouchEvent* event) { · 18 unmodified lines
1307}1318}
1308 1319
1309void Application::touchBeginEvent(QTouchEvent* event) {1320void Application::touchBeginEvent(QTouchEvent* event) {
1321 _controllerScriptingInterface.emitTouchBeginEvent(event); // send events to any registered scripts
1322
1310 touchUpdateEvent(event);1323 touchUpdateEvent(event);
1311 _lastTouchAvgX = _touchAvgX;1324 _lastTouchAvgX = _touchAvgX;
1312 _lastTouchAvgY = _touchAvgY;1325 _lastTouchAvgY = _touchAvgY;
1313}1326}
1314 1327
1315void Application::touchEndEvent(QTouchEvent* event) {1328void Application::touchEndEvent(QTouchEvent* event) {
1329 _controllerScriptingInterface.emitTouchEndEvent(event); // send events to any registered scripts
1316 _touchDragStartedAvgX = _touchAvgX;1330 _touchDragStartedAvgX = _touchAvgX;
1317 _touchDragStartedAvgY = _touchAvgY;1331 _touchDragStartedAvgY = _touchAvgY;
1318 _isTouchPressed = false;1332 _isTouchPressed = false;
@@ -1320,6 +1334,9 @@ void Application::touchEndEvent(QTouchEvent* event) { · 1 unmodified line
1320 1334
1321const bool USE_MOUSEWHEEL = false;1335const bool USE_MOUSEWHEEL = false;
1322void Application::wheelEvent(QWheelEvent* event) {1336void Application::wheelEvent(QWheelEvent* event) {
1337
1338 _controllerScriptingInterface.emitWheelEvent(event); // send events to any registered scripts
1339
1323 // Wheel Events disabled for now because they are also activated by touch look pitch up/down.1340 // Wheel Events disabled for now because they are also activated by touch look pitch up/down.
1324 if (USE_MOUSEWHEEL && (activeWindow() == _window)) {1341 if (USE_MOUSEWHEEL && (activeWindow() == _window)) {
1325 if (!Menu::getInstance()->isVoxelModeActionChecked()) {1342 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