Feature/globals handling (#1352)

* Cleaner handling of global state
* Prevent Lua memory corruption (closes #982)
* Initialize glfw first thing to prevent weird joystick loading bug during startup
This commit is contained in:
Alexander Bock
2020-10-21 22:30:05 +02:00
committed by GitHub
parent 1525a0490d
commit efffc25ce0
164 changed files with 1484 additions and 1390 deletions

View File

@@ -67,7 +67,7 @@ bool TouchModule::processNewInput() {
_touch.touchActive(!_touchPoints.empty());
if (!_touchPoints.empty()) {
global::interactionMonitor.markInteraction();
global::interactionMonitor->markInteraction();
}
// Erase old input id's that no longer exists
@@ -197,7 +197,7 @@ void TouchModule::internalInitialize(const ghoul::Dictionary& /*dictionary*/){
#ifdef WIN32
// We currently only support one window of touch input internally
// so here we grab the first window-handle and use it.
void* nativeWindowHandle = global::windowDelegate.getNativeWindowHandle(0);
void* nativeWindowHandle = global::windowDelegate->getNativeWindowHandle(0);
if (nativeWindowHandle) {
_win32TouchHook = std::make_unique<Win32TouchHook>(nativeWindowHandle);
}
@@ -231,10 +231,10 @@ void TouchModule::internalInitialize(const ghoul::Dictionary& /*dictionary*/){
global::callback::preSync.push_back([&]() {
_touch.setCamera(global::navigationHandler.camera());
_touch.setFocusNode(global::navigationHandler.orbitalNavigator().anchorNode());
_touch.setCamera(global::navigationHandler->camera());
_touch.setFocusNode(global::navigationHandler->orbitalNavigator().anchorNode());
if (processNewInput() && global::windowDelegate.isMaster() && _touchActive) {
if (processNewInput() && global::windowDelegate->isMaster() && _touchActive) {
_touch.updateStateFromInput(_touchPoints, _lastTouchInputs);
}
else if (_touchPoints.empty()) {
@@ -247,7 +247,7 @@ void TouchModule::internalInitialize(const ghoul::Dictionary& /*dictionary*/){
_lastTouchInputs.emplace_back(points.latestInput());
}
// calculate the new camera state for this frame
_touch.step(global::windowDelegate.deltaTime());
_touch.step(global::windowDelegate->deltaTime());
clearInputs();
});