History

Adding the ApplicationStateDevice to the APplication class and add one entry ythere

samcake committed 11 years ago

Commit fc15c7c1 parent 57aa89d5 files · +47 −39Browse files

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

Unified · Split

interface/src/Application.cpp+40−36
@@ -66,6 +66,7 @@ · 65 unmodified lines
66#include <input-plugins/InputPlugin.h>66#include <input-plugins/InputPlugin.h>
67#include <input-plugins/Joystick.h> // this should probably be removed67#include <input-plugins/Joystick.h> // this should probably be removed
68#include <controllers/UserInputMapper.h>68#include <controllers/UserInputMapper.h>
69#include <controllers/StateController.h>
69#include <LogHandler.h>70#include <LogHandler.h>
70#include <MainWindow.h>71#include <MainWindow.h>
71#include <MessageDialog.h>72#include <MessageDialog.h>
@@ -143,7 +144,6 @@ · 71 unmodified lines
143#include "ui/UpdateDialog.h"144#include "ui/UpdateDialog.h"
144#include "Util.h"145#include "Util.h"
145 146
146#include "controllers/StateController.h"
147 147
148// ON WIndows PC, NVidia Optimus laptop, we want to enable NVIDIA GPU148// ON WIndows PC, NVidia Optimus laptop, we want to enable NVIDIA GPU
149// FIXME seems to be broken.149// FIXME seems to be broken.
@@ -348,36 +348,36 @@ int _keyboardFocusHighlightID{ -1 }; · 198 unmodified lines
348PluginContainer* _pluginContainer;348PluginContainer* _pluginContainer;
349 349
350Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) :350Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) :
351QApplication(argc, argv),351 QApplication(argc, argv),
352_dependencyManagerIsSetup(setupEssentials(argc, argv)),352 _dependencyManagerIsSetup(setupEssentials(argc, argv)),
353_window(new MainWindow(desktop())),353 _window(new MainWindow(desktop())),
354_toolWindow(NULL),354 _toolWindow(NULL),
355_undoStackScriptingInterface(&_undoStack),355 _undoStackScriptingInterface(&_undoStack),
356_frameCount(0),356 _frameCount(0),
357_fps(60.0f),357 _fps(60.0f),
358_physicsEngine(new PhysicsEngine(Vectors::ZERO)),358 _physicsEngine(new PhysicsEngine(Vectors::ZERO)),
359_entities(true, this, this),359 _entities(true, this, this),
360_entityClipboardRenderer(false, this, this),360 _entityClipboardRenderer(false, this, this),
361_entityClipboard(new EntityTree()),361 _entityClipboard(new EntityTree()),
362_lastQueriedTime(usecTimestampNow()),362 _lastQueriedTime(usecTimestampNow()),
363_mirrorViewRect(QRect(MIRROR_VIEW_LEFT_PADDING, MIRROR_VIEW_TOP_PADDING, MIRROR_VIEW_WIDTH, MIRROR_VIEW_HEIGHT)),363 _mirrorViewRect(QRect(MIRROR_VIEW_LEFT_PADDING, MIRROR_VIEW_TOP_PADDING, MIRROR_VIEW_WIDTH, MIRROR_VIEW_HEIGHT)),
364_firstRun("firstRun", true),364 _firstRun("firstRun", true),
365_previousScriptLocation("LastScriptLocation", DESKTOP_LOCATION),365 _previousScriptLocation("LastScriptLocation", DESKTOP_LOCATION),
366_scriptsLocationHandle("scriptsLocation", DESKTOP_LOCATION),366 _scriptsLocationHandle("scriptsLocation", DESKTOP_LOCATION),
367_fieldOfView("fieldOfView", DEFAULT_FIELD_OF_VIEW_DEGREES),367 _fieldOfView("fieldOfView", DEFAULT_FIELD_OF_VIEW_DEGREES),
368_scaleMirror(1.0f),368 _scaleMirror(1.0f),
369_rotateMirror(0.0f),369 _rotateMirror(0.0f),
370_raiseMirror(0.0f),370 _raiseMirror(0.0f),
371_lastMouseMoveWasSimulated(false),371 _lastMouseMoveWasSimulated(false),
372_enableProcessOctreeThread(true),372 _enableProcessOctreeThread(true),
373_runningScriptsWidget(NULL),373 _runningScriptsWidget(NULL),
374_runningScriptsWidgetWasVisible(false),374 _runningScriptsWidgetWasVisible(false),
375_lastNackTime(usecTimestampNow()),375 _lastNackTime(usecTimestampNow()),
376_lastSendDownstreamAudioStats(usecTimestampNow()),376 _lastSendDownstreamAudioStats(usecTimestampNow()),
377_aboutToQuit(false),377 _aboutToQuit(false),
378_notifiedPacketVersionMismatchThisDomain(false),378 _notifiedPacketVersionMismatchThisDomain(false),
379_maxOctreePPS(maxOctreePacketsPerSecond.get()),379 _maxOctreePPS(maxOctreePacketsPerSecond.get()),
380_lastFaceTrackerUpdate(0)380 _lastFaceTrackerUpdate(0)
381{381{
382 thread()->setObjectName("Main Thread");382 thread()->setObjectName("Main Thread");
383 383
@@ -635,13 +635,14 @@ _lastFaceTrackerUpdate(0) · 251 unmodified lines
635 }635 }
636 });636 });
637 637
638 static controller::StateController _stateController;638 // A new controllerInput device used to reflect current values from the application state
639 _applicationStateDevice = new controller::StateController("Application");
639 auto InHMDLambda = controller::StateController::ReadLambda([]() -> float {640 auto InHMDLambda = controller::StateController::ReadLambda([]() -> float {
640 return (float) qApp->getAvatarUpdater()->isHMDMode();641 return (float) qApp->getAvatarUpdater()->isHMDMode();
641 });642 });
642 _stateController.addInputVariant("InHMD", InHMDLambda);643 _applicationStateDevice->addInputVariant("InHMD", InHMDLambda);
643 644
644 userInputMapper->registerDevice(&_stateController);645 userInputMapper->registerDevice(_applicationStateDevice);
645 646
646 // Setup the keyboardMouseDevice and the user input mapper with the default bindings647 // Setup the keyboardMouseDevice and the user input mapper with the default bindings
647 userInputMapper->registerDevice(_keyboardMouseDevice);648 userInputMapper->registerDevice(_keyboardMouseDevice);
@@ -807,6 +808,10 @@ void Application::cleanupBeforeQuit() { · 159 unmodified lines
807 808
808 AnimDebugDraw::getInstance().shutdown();809 AnimDebugDraw::getInstance().shutdown();
809 810
811 // FIXME: once we move to shared pointer for the INputDevice we shoud remove this naked delete:
812 delete _applicationStateDevice;
813 _applicationStateDevice = nullptr;
814
810 if (_keyboardFocusHighlightID > 0) {815 if (_keyboardFocusHighlightID > 0) {
811 getOverlays().deleteOverlay(_keyboardFocusHighlightID);816 getOverlays().deleteOverlay(_keyboardFocusHighlightID);
812 _keyboardFocusHighlightID = -1;817 _keyboardFocusHighlightID = -1;
@@ -2716,7 +2721,7 @@ void Application::update(float deltaTime) { · 1903 unmodified lines
2716 auto myAvatar = getMyAvatar();2721 auto myAvatar = getMyAvatar();
2717 auto userInputMapper = DependencyManager::get<UserInputMapper>();2722 auto userInputMapper = DependencyManager::get<UserInputMapper>();
2718 userInputMapper->setSensorToWorldMat(myAvatar->getSensorToWorldMatrix());2723 userInputMapper->setSensorToWorldMat(myAvatar->getSensorToWorldMatrix());
2719 // userInputMapper->update(deltaTime);2724 userInputMapper->update(deltaTime);
2720 2725
2721 bool jointsCaptured = false;2726 bool jointsCaptured = false;
2722 for (auto inputPlugin : PluginManager::getInstance()->getInputPlugins()) {2727 for (auto inputPlugin : PluginManager::getInstance()->getInputPlugins()) {
@@ -2727,7 +2732,6 @@ void Application::update(float deltaTime) { · 4 unmodified lines
2727 }2732 }
2728 }2733 }
2729 }2734 }
2730 userInputMapper->update(deltaTime);
2731 2735
2732 // Transfer the user inputs to the driveKeys2736 // Transfer the user inputs to the driveKeys
2733 // FIXME can we drop drive keys and just have the avatar read the action states directly?2737 // FIXME can we drop drive keys and just have the avatar read the action states directly?

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