mirror of
https://github.com/litruv/TobiiEyetracking.git
synced 2026-07-25 03:06:10 +10:00
Added Tobii from 4.23 + updated
This commit is contained in:
59
Source/TobiiGTOM/Private/TobiiGTOMModule.cpp
Normal file
59
Source/TobiiGTOM/Private/TobiiGTOMModule.cpp
Normal file
@@ -0,0 +1,59 @@
|
||||
/******************************************************************************
|
||||
* Copyright 2017- Tobii Technology AB. All rights reserved.
|
||||
*
|
||||
* @author Temaran | Fredrik Lindh | fredrik.lindh@tobii.com | https://github.com/Temaran
|
||||
******************************************************************************/
|
||||
|
||||
#include "TobiiGTOMModule.h"
|
||||
#include "TobiiGazeFocusableComponent.h"
|
||||
#include "TobiiGazeFocusableWidget.h"
|
||||
#include "TobiiGTOMBlueprintLibrary.h"
|
||||
#include "TobiiGTOMInternalTypes.h"
|
||||
#include "TobiiGTOMEngine.h"
|
||||
|
||||
#include "IEyeTracker.h"
|
||||
#include "DrawDebugHelpers.h"
|
||||
#include "GameFramework/PlayerController.h"
|
||||
#include "Misc/Paths.h"
|
||||
#include "Runtime/Engine/Public/Slate/SceneViewport.h"
|
||||
|
||||
IMPLEMENT_MODULE(FTobiiGTOMModule, TobiiGTOM)
|
||||
|
||||
void FTobiiGTOMModule::StartupModule()
|
||||
{
|
||||
G2OMDllHandle = nullptr;
|
||||
|
||||
#if TOBII_EYETRACKING_ACTIVE
|
||||
FString RelativeG2OMDllPath = FString(TEXT(TOBII_G2OM_RELATIVE_DLL_PATH));
|
||||
|
||||
#if TOBII_COMPILE_AS_ENGINE_PLUGIN
|
||||
FString FullG2OMDllPath = FPaths::Combine(FPaths::EngineDir(), RelativeG2OMDllPath);
|
||||
#else
|
||||
FString FullG2OMDllPath = FPaths::ConvertRelativePathToFull(FPaths::Combine(FPaths::ProjectPluginsDir(), RelativeG2OMDllPath));
|
||||
#endif //TOBII_COMPILE_AS_ENGINE_PLUGIN
|
||||
|
||||
G2OMDllHandle = FPlatformProcess::GetDllHandle(*FullG2OMDllPath);
|
||||
|
||||
if (G2OMDllHandle != nullptr)
|
||||
{
|
||||
IModularFeatures::Get().RegisterModularFeature(IInputDeviceModule::GetModularFeatureName(), this);
|
||||
}
|
||||
#endif //TOBII_EYETRACKING_ACTIVE
|
||||
}
|
||||
|
||||
void FTobiiGTOMModule::ShutdownModule()
|
||||
{
|
||||
#if TOBII_EYETRACKING_ACTIVE
|
||||
if (G2OMDllHandle != nullptr)
|
||||
{
|
||||
IModularFeatures::Get().UnregisterModularFeature(IInputDeviceModule::GetModularFeatureName(), this);
|
||||
}
|
||||
G2OMDllHandle = nullptr;
|
||||
#endif //TOBII_EYETRACKING_ACTIVE
|
||||
}
|
||||
|
||||
TSharedPtr<class IInputDevice> FTobiiGTOMModule::CreateInputDevice(const TSharedRef<FGenericApplicationMessageHandler>& InMessageHandler)
|
||||
{
|
||||
GTOMInputDevice = MakeShareable(new FTobiiGTOMEngine());
|
||||
return TSharedPtr<class IInputDevice>(GTOMInputDevice);
|
||||
}
|
||||
Reference in New Issue
Block a user