diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b55ee92..ae7561a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added a SenseGlove custom game instance, SGGameInstance, for future use. +- Added the new SenseGloveBackend and SenseGloveBackendKismet modules. + +### Fixed + +- Proper initialization of the SenseGlove backend in order to fix a bug in certain situations where SGConnect::Init() gets called every frame. ## [1.6.1] - 2023-08-14 diff --git a/SenseGlove.uplugin b/SenseGlove.uplugin index 11c5e9f3..814b39de 100644 --- a/SenseGlove.uplugin +++ b/SenseGlove.uplugin @@ -53,6 +53,28 @@ "Win64" ] }, + { + "Name": "SenseGloveBackend", + "Type": "Runtime", + "LoadingPhase": "PreDefault", + "WhitelistPlatforms": [ + "Android", + "Linux", + "LinuxArm64", + "Win64" + ] + }, + { + "Name": "SenseGloveBackendKismet", + "Type": "Runtime", + "LoadingPhase": "PreDefault", + "WhitelistPlatforms": [ + "Android", + "Linux", + "LinuxArm64", + "Win64" + ] + }, { "Name": "SenseGloveConnect", "Type": "Runtime", diff --git a/Source/SenseGlove/Private/SenseGlove/Components/SGVirtualHandComponent.cpp b/Source/SenseGlove/Private/SenseGlove/Components/SGVirtualHandComponent.cpp index 91990de3..13453a5f 100644 --- a/Source/SenseGlove/Private/SenseGlove/Components/SGVirtualHandComponent.cpp +++ b/Source/SenseGlove/Private/SenseGlove/Components/SGVirtualHandComponent.cpp @@ -45,11 +45,9 @@ #include "SenseGlove/Animation/SGVirtualHandAnimInstance.h" #include "SenseGlove/Components/SGWristTrackerComponent.h" -#include "SGConnect/SGConnect.h" -#include "SGCore/SGDeviceList.h" +#include "SGBackend/SGBackend.h" #include "SGCore/SGHandPose.h" #include "SGCore/SGHapticGlove.h" -#include "SGCore/SGHapticGloveHandProfiles.h" #include "SGDebug/SGDebugVirtualHand.h" #include "SGLog/SGLog.h" @@ -123,8 +121,6 @@ struct USGVirtualHandComponent::FImpl USkeleton* GetSkeleton() const; const FReferenceSkeleton& GetRefSkeleton() const; - bool InitializeBackend() const; - bool UninitializeBackend() const; bool CheckGlove() const; FORCEINLINE void SetVisibility(const bool bInVisible) const @@ -247,7 +243,6 @@ USGVirtualHandComponent::USGVirtualHandComponent(const FObjectInitializer& Objec Super::SetSkeletalMesh(nullptr, true); - bBackendInitialized = false; Glove = nullptr; WristTracker = nullptr; } @@ -309,27 +304,24 @@ void USGVirtualHandComponent::InitializeComponent() Pimpl->SetDefaultMesh(); } - if (Pimpl->InitializeBackend()) - { - (void) Pimpl->CheckGlove(); - } + (void) Pimpl->CheckGlove(); } void USGVirtualHandComponent::UninitializeComponent() { Super::UninitializeComponent(); - (void) Pimpl->UninitializeBackend(); + if (IsValid(Glove) && AutoStopsAllHapticsOnEndPlay()) + { + Glove->StopHaptics(); + } } void USGVirtualHandComponent::BeginPlay() { Super::BeginPlay(); - if (Pimpl->InitializeBackend()) - { - (void) Pimpl->CheckGlove(); - } + (void) Pimpl->CheckGlove(); } void USGVirtualHandComponent::EndPlay(const EEndPlayReason::Type EndPlayReason) @@ -340,8 +332,6 @@ void USGVirtualHandComponent::EndPlay(const EEndPlayReason::Type EndPlayReason) { Glove->StopHaptics(); } - - (void) Pimpl->UninitializeBackend(); } void USGVirtualHandComponent::TickComponent( @@ -618,101 +608,11 @@ const FReferenceSkeleton& USGVirtualHandComponent::FImpl::GetRefSkeleton() const return Mesh->GetRefSkeleton(); } -bool USGVirtualHandComponent::FImpl::InitializeBackend() const -{ - if (!Owner->bBackendInitialized) - { -#if PLATFORM_ANDROID - const int32_t Result = FSGConnect::Init(); - switch (Result) - { - case -3: - SGLOG_ERROR("An Unexpected error occurred. Please try again."); - return false; - case -2: - SGLOG_ERROR("Device Scanning is already running within a different program."); - return false; - case -1: - SGLOG_ERROR("Device Scanning already being initialized (function called twice in short succession)."); - return false; - case 0: - // Do not pollute the logs! - //SGLOG_ERROR("Device Scanning is already running within this program."); - // We must return here in case there are two virtual hand components are present in the scene. - return true; - case 1: - SGLOG("Successfully started up DeviceScanning from the current program."); - break; - default: - ensureAlwaysMsgf(false, TEXT("Unhandled Init return status code!")); - return false; - } -#endif /* PLATFORM_ANDROID */ - - // Ensure that the device list is empty before doing anything. - FSGDeviceList::Dispose(); - FSGDeviceList::Reinitialize(); - - // Load the latest hand profiles. - FSGHapticGloveHandProfiles::TryLoadingFromDisk(); - - Owner->bBackendInitialized = true; - - return true; - } - - return false; -} - -bool USGVirtualHandComponent::FImpl::UninitializeBackend() const -{ - // NOTE - // In Editor builds we should be avoiding dispose, since stopping the game in PIE mode, causes the virtual-hand - // to disappear in the editor as the plugin won't be able to retrieve the glove status anymore. -#if ! WITH_EDITOR - if (Owner->bBackendInitialized) - { - FSGDeviceList::Dispose(); - -#if PLATFORM_ANDROID - const int32_t Result = FSGConnect::Dispose(); - switch (Result) - { - case -3: - SGLOG_ERROR("An Unexpected error occurred. Please try again."); - return false; - case -2: - SGLOG_ERROR("Not allowed to dispose of Device Scanning because this is not the program which started it."); - return false; - case -1: - SGLOG_ERROR("Device Scanning is currently being disposed off. This takes a second or two. (function called twice in short succession)."); - return false; - case 0: - SGLOG_ERROR("There is no deviceScanner running from any program, so disposing is skipped."); - return false; - case 1: - SGLOG("Successfully disposed of DeviceScanner resources."); - break; - default: - ensureAlwaysMsgf(false, TEXT("Unhandled Dispose return status code!")); - return false; - } -#endif /* PLATFORM_ANDROID */ - - Owner->bBackendInitialized = false; - - return true; - } -#endif /* ! WITH_EDITOR */ - - return false; -} - bool USGVirtualHandComponent::FImpl::CheckGlove() const { - if (!Owner->bBackendInitialized) + if (!USGBackend::GetInstance()->IsBackendInitialized()) { - const bool bSucceeded = InitializeBackend(); + const bool bSucceeded = USGBackend::GetInstance()->InitializeBackend(); if (!bSucceeded) { return false; diff --git a/Source/SenseGlove/Private/SenseGlove/Components/SGWristTrackerComponent.cpp b/Source/SenseGlove/Private/SenseGlove/Components/SGWristTrackerComponent.cpp index fe1af488..6078c1fe 100644 --- a/Source/SenseGlove/Private/SenseGlove/Components/SGWristTrackerComponent.cpp +++ b/Source/SenseGlove/Private/SenseGlove/Components/SGWristTrackerComponent.cpp @@ -40,10 +40,8 @@ #include "Engine/SkeletalMesh.h" #include "UObject/ConstructorHelpers.h" -#include "SGConnect/SGConnect.h" -#include "SGCore/SGDeviceList.h" +#include "SGBackend/SGBackend.h" #include "SGCore/SGHapticGlove.h" -#include "SGCore/SGHapticGloveHandProfiles.h" #include "SGDebug/SGDebugGizmo.h" #include "SGLog/SGLog.h" #include "SGSettings/SGSettings.h" @@ -80,8 +78,6 @@ struct USGWristTrackerComponent::FImpl bool IsEditor() const; - bool InitializeBackend() const; - bool UninitializeBackend() const; bool CheckGlove() const; void UpdateMotionSource() const; @@ -128,7 +124,6 @@ USGWristTrackerComponent::USGWristTrackerComponent(const FObjectInitializer& Obj bRight = true; - bBackendInitialized = false; Glove = nullptr; WristLocation = FVector::ZeroVector; WristRotation = FRotator::ZeroRotator; @@ -184,40 +179,20 @@ void USGWristTrackerComponent::InitializeComponent() { Super::InitializeComponent(); - if (Pimpl->InitializeBackend()) - { - (void) Pimpl->CheckGlove(); - } + (void) Pimpl->CheckGlove(); Pimpl->UpdateMotionSource(); } -void USGWristTrackerComponent::UninitializeComponent() -{ - Super::UninitializeComponent(); - - (void) Pimpl->UninitializeBackend(); -} - void USGWristTrackerComponent::BeginPlay() { Super::BeginPlay(); - if (Pimpl->InitializeBackend()) - { - (void) Pimpl->CheckGlove(); - } + (void) Pimpl->CheckGlove(); Pimpl->UpdateMotionSource(); } -void USGWristTrackerComponent::EndPlay(const EEndPlayReason::Type EndPlayReason) -{ - Super::EndPlay(EndPlayReason); - - (void) Pimpl->UninitializeBackend(); -} - void USGWristTrackerComponent::TickComponent( const float DeltaTime, const ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) { @@ -264,101 +239,11 @@ bool USGWristTrackerComponent::FImpl::IsEditor() const return false; } -bool USGWristTrackerComponent::FImpl::InitializeBackend() const -{ - if (!Owner->bBackendInitialized) - { -#if PLATFORM_ANDROID - const int32_t Result = FSGConnect::Init(); - switch (Result) - { - case -3: - SGLOG_ERROR("An Unexpected error occurred. Please try again."); - return false; - case -2: - SGLOG_ERROR("Device Scanning is already running within a different program."); - return false; - case -1: - SGLOG_ERROR("Device Scanning already being initialized (function called twice in short succession)."); - return false; - case 0: - // Do not pollute the logs! - //SGLOG_ERROR("Device Scanning is already running within this program."); - // We must return here in case two virtual hand components are present in the scene. - return true; - case 1: - SGLOG("Successfully started up DeviceScanning from the current program."); - break; - default: - ensureAlwaysMsgf(false, TEXT("Unhandled Init return status code!")); - return false; - } -#endif /* PLATFORM_ANDROID */ - - // Ensure that the device list is empty before doing anything. - FSGDeviceList::Dispose(); - FSGDeviceList::Reinitialize(); - - // Load the latest hand profiles. - FSGHapticGloveHandProfiles::TryLoadingFromDisk(); - - Owner->bBackendInitialized = true; - - return true; - } - - return false; -} - -bool USGWristTrackerComponent::FImpl::UninitializeBackend() const -{ - // NOTE - // In Editor builds we should be avoiding dispose, since stopping the game in PIE mode, causes the virtual-hand - // to disappear in the editor as the plugin won't be able to retrieve the glove status anymore. -#if ! WITH_EDITOR - if (Owner->bBackendInitialized) - { - FSGDeviceList::Dispose(); - -#if PLATFORM_ANDROID - const int32_t Result = FSGConnect::Dispose(); - switch (Result) - { - case -3: - SGLOG_ERROR("An Unexpected error occurred. Please try again."); - return false; - case -2: - SGLOG_ERROR("Not allowed to dispose of Device Scanning because this is not the program which started it."); - return false; - case -1: - SGLOG_ERROR("Device Scanning is currently being disposed off. This takes a second or two. (function called twice in short succession)."); - return false; - case 0: - SGLOG_ERROR("There is no deviceScanner running from any program, so disposing is skipped."); - return false; - case 1: - SGLOG("Successfully disposed of DeviceScanner resources."); - break; - default: - ensureAlwaysMsgf(false, TEXT("Unhandled Dispose return status code!")); - return false; - } -#endif /* PLATFORM_ANDROID */ - - Owner->bBackendInitialized = false; - - return true; - } -#endif /* ! WITH_EDITOR */ - - return false; -} - bool USGWristTrackerComponent::FImpl::CheckGlove() const { - if (!Owner->bBackendInitialized) + if (!USGBackend::GetInstance()->IsBackendInitialized()) { - const bool bSucceeded = InitializeBackend(); + const bool bSucceeded = USGBackend::GetInstance()->InitializeBackend(); if (!bSucceeded) { return false; diff --git a/Source/SenseGlove/Public/SenseGlove/Components/SGVirtualHandComponent.h b/Source/SenseGlove/Public/SenseGlove/Components/SGVirtualHandComponent.h index e705dc22..a59bf2c5 100644 --- a/Source/SenseGlove/Public/SenseGlove/Components/SGVirtualHandComponent.h +++ b/Source/SenseGlove/Public/SenseGlove/Components/SGVirtualHandComponent.h @@ -127,9 +127,6 @@ private: FSGDebugVirtualHandSettings DebugVirtualHandSettings; private: - UPROPERTY(Transient) - uint8 bBackendInitialized : 1; - UPROPERTY(Transient) USGHapticGlove* Glove; diff --git a/Source/SenseGlove/Public/SenseGlove/Components/SGWristTrackerComponent.h b/Source/SenseGlove/Public/SenseGlove/Components/SGWristTrackerComponent.h index 6ecc4a56..2ec6e7ee 100644 --- a/Source/SenseGlove/Public/SenseGlove/Components/SGWristTrackerComponent.h +++ b/Source/SenseGlove/Public/SenseGlove/Components/SGWristTrackerComponent.h @@ -111,9 +111,6 @@ private: FSGWristTrackingSettings WristTrackingSettings; private: - UPROPERTY(Transient) - uint8 bBackendInitialized : 1; - UPROPERTY(Transient) USGHapticGlove* Glove; @@ -166,12 +163,8 @@ public: virtual void InitializeComponent() override; - virtual void UninitializeComponent() override; - virtual void BeginPlay() override; - virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override; - virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override; diff --git a/Source/SenseGlove/SenseGlove.Build.cs b/Source/SenseGlove/SenseGlove.Build.cs index b8856aec..c340b07a 100644 --- a/Source/SenseGlove/SenseGlove.Build.cs +++ b/Source/SenseGlove/SenseGlove.Build.cs @@ -57,6 +57,7 @@ public class SenseGlove : ModuleRules "Engine", "HeadMountedDisplay", "InputCore", + "SenseGloveBackend", "SenseGloveConnect", "SenseGloveCore", "SenseGloveDebug", diff --git a/Source/SenseGloveBackend/Private/SGBackend/SGBackend.cpp b/Source/SenseGloveBackend/Private/SGBackend/SGBackend.cpp new file mode 100644 index 00000000..6db11184 --- /dev/null +++ b/Source/SenseGloveBackend/Private/SGBackend/SGBackend.cpp @@ -0,0 +1,223 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2023 SenseGlove + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * @section DESCRIPTION + * + * + */ + + +#include "SGBackend/SGBackend.h" + +#include "Engine/Engine.h" + +#include "SGConnect/SGConnect.h" +#include "SGCore/SGDeviceList.h" +#include "SGCore/SGHapticGloveHandProfiles.h" +#include "SGLog/SGLog.h" + +struct USGBackend::FImpl +{ + /************************ + * Owner object + ************************/ + + USGBackend* Owner; + + /************************ + * Constructor / Destructor + ************************/ + + explicit FImpl(USGBackend* InOwner); + ~FImpl(); + + /************************ + * Default copy constructor & copy assignment operator + ************************/ + + FImpl(const FImpl& Rhs) = default; + FImpl& operator=(const FImpl& Rhs) = default; +}; + +USGBackend* USGBackend::GetInstance() +{ + if (!ensureAlwaysMsgf(GEngine, TEXT("The engine has not been initialized!"))) + { + return nullptr; + } + + USGBackend* Instance{GEngine->GetEngineSubsystem()}; + return Instance; +} + +USGBackend::USGBackend() + : Pimpl(TUniquePtr(new FImpl{this}, PimplDeleter)) +{ + bBackendInitialized = false; +} + +bool USGBackend::InitializeBackend() +{ + if (!IsBackendInitialized()) + { +#if PLATFORM_ANDROID + const int32_t Result = FSGConnect::Init(); + switch (Result) + { + case -3: + SGLOG_ERROR("An Unexpected error occurred. Please try again."); + return false; + case -2: + SGLOG_ERROR("Device Scanning is already running within a different program."); + return false; + case -1: + SGLOG_ERROR("Device Scanning already being initialized (function called twice in short succession)."); + return false; + case 0: + SGLOG_ERROR("Device Scanning is already running within this program."); + return false; + case 1: + SGLOG("Successfully started up DeviceScanning from the current program."); + break; + default: + ensureAlwaysMsgf(false, TEXT("Unhandled Init return status code!")); + return false; + } +#endif /* PLATFORM_ANDROID */ + + // Ensure that the device list is empty before doing anything. + FSGDeviceList::Dispose(); + FSGDeviceList::Reinitialize(); + + // Load the latest hand profiles. + FSGHapticGloveHandProfiles::TryLoadingFromDisk(); + + bBackendInitialized = true; + + return true; + } + + return false; +} + +bool USGBackend::UninitializeBackend() +{ + if (IsBackendInitialized()) + { + FSGDeviceList::Dispose(); + +#if PLATFORM_ANDROID + const int32_t Result = FSGConnect::Dispose(); + switch (Result) + { + case -3: + SGLOG_ERROR("An Unexpected error occurred. Please try again."); + return false; + case -2: + SGLOG_ERROR("Not allowed to dispose of Device Scanning because this is not the program which started it."); + return false; + case -1: + SGLOG_ERROR("Device Scanning is currently being disposed off. This takes a second or two. (function called twice in short succession)."); + return false; + case 0: + SGLOG_ERROR("There is no deviceScanner running from any program, so disposing is skipped."); + return false; + case 1: + SGLOG("Successfully disposed of DeviceScanner resources."); + break; + default: + ensureAlwaysMsgf(false, TEXT("Unhandled Dispose return status code!")); + return false; + } +#endif /* PLATFORM_ANDROID */ + + bBackendInitialized = false; + + return true; + } + + return false; +} + +bool USGBackend::ShouldCreateSubsystem(UObject* Outer) const +{ + return true; +} + +void USGBackend::Initialize(FSubsystemCollectionBase& Collection) +{ + SGLOG("Initializing the SenseGlove Backend singleton with the engine lifetime..."); + + Super::Initialize(Collection); + + SGLOG("Initializing the SenseGlove Backend singleton with the engine lifetime..."); + + if (InitializeBackend()) + { + SGLOG("The bridge to the SenseGlove Backend has been initialized successfully!") + } + else + { + SGLOG_ERROR("Failed to initialize the bridge to the SenseGlove Backend!") + } + + SGLOG("The SenseGlove Backend singleton has been successfully initialized with the engine lifetime!"); +} + +void USGBackend::Deinitialize() +{ + SGLOG("De-initializing the SenseGlove Backend singleton due to the engine lifetime expiration..."); + + Super::Deinitialize(); + + if (UninitializeBackend()) + { + SGLOG("The bridge to the SenseGlove Backend has been uninitialized successfully!") + } + else + { + SGLOG_ERROR("Failed to uninitialize the bridge to the SenseGlove Backend!") + } + + (void)Pimpl.Release(); + + SGLOG("The SenseGlove Backend singleton has been successfully de-initialized!"); +} + +USGBackend::FImpl::FImpl(USGBackend* InOwner) + : Owner(InOwner) +{ +} + +USGBackend::FImpl::~FImpl() = default; + +void USGBackend::FImplDeleter::operator()(const FImpl* P) const +{ + delete P; +} \ No newline at end of file diff --git a/Source/SenseGloveBackend/Private/SenseGloveBackend.cpp b/Source/SenseGloveBackend/Private/SenseGloveBackend.cpp new file mode 100644 index 00000000..0e93906e --- /dev/null +++ b/Source/SenseGloveBackend/Private/SenseGloveBackend.cpp @@ -0,0 +1,40 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2023 SenseGlove + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * @section DESCRIPTION + * + * + */ + + +#include "SenseGloveBackend.h" +#include "Modules/ModuleManager.h" +#include "SenseGloveBackendModule.h" + +IMPLEMENT_MODULE(FSenseGloveBackendModule, SenseGloveBackend) \ No newline at end of file diff --git a/Source/SenseGloveBackend/Private/SenseGloveBackend.h b/Source/SenseGloveBackend/Private/SenseGloveBackend.h new file mode 100644 index 00000000..60871018 --- /dev/null +++ b/Source/SenseGloveBackend/Private/SenseGloveBackend.h @@ -0,0 +1,38 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2023 SenseGlove + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * @section DESCRIPTION + * + * + */ + + +#pragma once + +#include "CoreMinimal.h" \ No newline at end of file diff --git a/Source/SenseGloveBackend/Private/SenseGloveBackendModule.cpp b/Source/SenseGloveBackend/Private/SenseGloveBackendModule.cpp new file mode 100644 index 00000000..3d573d06 --- /dev/null +++ b/Source/SenseGloveBackend/Private/SenseGloveBackendModule.cpp @@ -0,0 +1,63 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2023 SenseGlove + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * @section DESCRIPTION + * + * + */ + + +#include "SenseGloveBackendModule.h" + +#include "SGLog/SGLog.h" +#include "SGBackend/SGBackend.h" + +#define LOCTEXT_NAMESPACE "FSenseGloveBackendModule" + +void FSenseGloveBackendModule::StartupModule() +{ + SGLOG("Starting up SenseGloveBackend module..."); +} + +void FSenseGloveBackendModule::PreUnloadCallback() +{ + SGLOG("Unloading SenseGloveBackend module..."); +} + +void FSenseGloveBackendModule::PostLoadCallback() +{ + SGLOG("Loading of SenseGloveBackend module has succeeded!"); +} + +void FSenseGloveBackendModule::ShutdownModule() +{ + SGLOG("Shutting down SenseGloveBackend module..."); +} + +#undef LOCTEXT_NAMESPACE \ No newline at end of file diff --git a/Source/SenseGloveBackend/Private/SenseGloveBackendModule.h b/Source/SenseGloveBackend/Private/SenseGloveBackendModule.h new file mode 100644 index 00000000..1c02a8d3 --- /dev/null +++ b/Source/SenseGloveBackend/Private/SenseGloveBackendModule.h @@ -0,0 +1,51 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2023 SenseGlove + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * @section DESCRIPTION + * + * + */ + + +#pragma once + +#include "Modules/ModuleInterface.h" + +#define LOCTEXT_NAMESPACE "SenseGloveBackend" + +class FSenseGloveBackendModule : public IModuleInterface +{ +public: + virtual void StartupModule() override; + virtual void PreUnloadCallback() override; + virtual void PostLoadCallback() override; + virtual void ShutdownModule() override; +}; + +#undef LOCTEXT_NAMESPACE \ No newline at end of file diff --git a/Source/SenseGloveBackend/Public/SGBackend/SGBackend.h b/Source/SenseGloveBackend/Public/SGBackend/SGBackend.h new file mode 100644 index 00000000..ec39053f --- /dev/null +++ b/Source/SenseGloveBackend/Public/SGBackend/SGBackend.h @@ -0,0 +1,87 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2023 SenseGlove + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * @section DESCRIPTION + * + * + */ + + +#pragma once + +#include "Math/Color.h" +#include "Math/Rotator.h" +#include "Math/Vector.h" +#include "Subsystems/EngineSubsystem.h" +#include "Templates/UniquePtr.h" +#include "UObject/ObjectMacros.h" + +#include "SGBackend.generated.h" + +UCLASS(config = SenseGloveBackend) +class SENSEGLOVEBACKEND_API USGBackend : public UEngineSubsystem +{ + GENERATED_BODY() + +private: + UPROPERTY(Transient) + uint8 bBackendInitialized : 1; + +public: + static USGBackend* GetInstance(); + +private: + struct FImpl; + + struct FImplDeleter + { + void operator()(const FImpl* P) const; + }; + + TUniquePtr Pimpl; + FImplDeleter PimplDeleter; + +public: + USGBackend(); + +public: + FORCEINLINE bool IsBackendInitialized() const + { + return !!bBackendInitialized; + } + + bool InitializeBackend(); + bool UninitializeBackend(); + +public: + virtual bool ShouldCreateSubsystem(UObject* Outer) const override; + + virtual void Initialize(FSubsystemCollectionBase& Collection) override; + virtual void Deinitialize() override; +}; \ No newline at end of file diff --git a/Source/SenseGloveBackend/SenseGloveBackend.Build.cs b/Source/SenseGloveBackend/SenseGloveBackend.Build.cs new file mode 100644 index 00000000..a79cb8be --- /dev/null +++ b/Source/SenseGloveBackend/SenseGloveBackend.Build.cs @@ -0,0 +1,65 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2023 SenseGlove + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * @section DESCRIPTION + * + * + */ + + +using System; +using UnrealBuildTool; + +public class SenseGloveBackend : ModuleRules +{ + public SenseGloveBackend(ReadOnlyTargetRules Target) : base(Target) + { + PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs; + + PublicDependencyModuleNames.AddRange( + new string[] + { + "Core", + } + ); + + PrivateDependencyModuleNames.AddRange( + new string[] + { + "CoreUObject", + "Engine", + "InputCore", + "SenseGloveConnect", + "SenseGloveCore", + "SenseGloveLog", + "SenseGloveTypes", + } + ); + } +} \ No newline at end of file diff --git a/Source/SenseGloveBackendKismet/Private/SGBackendKismet/SGBackendKismetLibrary.cpp b/Source/SenseGloveBackendKismet/Private/SGBackendKismet/SGBackendKismetLibrary.cpp new file mode 100644 index 00000000..bdddced0 --- /dev/null +++ b/Source/SenseGloveBackendKismet/Private/SGBackendKismet/SGBackendKismetLibrary.cpp @@ -0,0 +1,58 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2023 SenseGlove + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * @section DESCRIPTION + * + * + */ + + +#include "SGBackendKismet/SGBackendKismetLibrary.h" + +#include "SGBackend/SGBackend.h" + +USGBackend* USGBackendKismetLibrary::GetInstance() +{ + return USGBackend::GetInstance(); +} + +bool USGBackendKismetLibrary::IsBackendInitialized(const USGBackend* Backend) +{ + return Backend->IsBackendInitialized(); +} + +bool USGBackendKismetLibrary::InitializeBackend(USGBackend* Backend) +{ + return Backend->InitializeBackend(); +} + +bool USGBackendKismetLibrary::UninitializeBackend(USGBackend* Backend) +{ + return Backend->UninitializeBackend(); +} \ No newline at end of file diff --git a/Source/SenseGloveBackendKismet/Private/SenseGloveBackendKismet.cpp b/Source/SenseGloveBackendKismet/Private/SenseGloveBackendKismet.cpp new file mode 100644 index 00000000..4f687236 --- /dev/null +++ b/Source/SenseGloveBackendKismet/Private/SenseGloveBackendKismet.cpp @@ -0,0 +1,40 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2023 SenseGlove + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * @section DESCRIPTION + * + * + */ + + +#include "SenseGloveBackendKismet.h" +#include "Modules/ModuleManager.h" +#include "SenseGloveBackendKismetModule.h" + +IMPLEMENT_MODULE(FSenseGloveBackendKismetModule, SenseGloveBackendKismet) diff --git a/Source/SenseGloveBackendKismet/Private/SenseGloveBackendKismet.h b/Source/SenseGloveBackendKismet/Private/SenseGloveBackendKismet.h new file mode 100644 index 00000000..60871018 --- /dev/null +++ b/Source/SenseGloveBackendKismet/Private/SenseGloveBackendKismet.h @@ -0,0 +1,38 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2023 SenseGlove + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * @section DESCRIPTION + * + * + */ + + +#pragma once + +#include "CoreMinimal.h" \ No newline at end of file diff --git a/Source/SenseGloveBackendKismet/Private/SenseGloveBackendKismetModule.cpp b/Source/SenseGloveBackendKismet/Private/SenseGloveBackendKismetModule.cpp new file mode 100644 index 00000000..d6d66aa2 --- /dev/null +++ b/Source/SenseGloveBackendKismet/Private/SenseGloveBackendKismetModule.cpp @@ -0,0 +1,62 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2023 SenseGlove + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * @section DESCRIPTION + * + * + */ + + +#include "SenseGloveBackendKismetModule.h" + +#include "SGLog/SGLog.h" + +#define LOCTEXT_NAMESPACE "FSenseGloveBackendKismetModule" + +void FSenseGloveBackendKismetModule::StartupModule() +{ + SGLOG("Starting up SenseGloveBackendKismet module..."); +} + +void FSenseGloveBackendKismetModule::PreUnloadCallback() +{ + SGLOG("Unloading SenseGloveBackendKismet module..."); +} + +void FSenseGloveBackendKismetModule::PostLoadCallback() +{ + SGLOG("Loading of SenseGloveBackendKismet module has succeeded!"); +} + +void FSenseGloveBackendKismetModule::ShutdownModule() +{ + SGLOG("Shutting down SenseGloveBackendKismet module..."); +} + +#undef LOCTEXT_NAMESPACE diff --git a/Source/SenseGloveBackendKismet/Private/SenseGloveBackendKismetModule.h b/Source/SenseGloveBackendKismet/Private/SenseGloveBackendKismetModule.h new file mode 100644 index 00000000..53f6ab39 --- /dev/null +++ b/Source/SenseGloveBackendKismet/Private/SenseGloveBackendKismetModule.h @@ -0,0 +1,51 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2023 SenseGlove + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * @section DESCRIPTION + * + * + */ + + +#pragma once + +#include "Modules/ModuleInterface.h" + +#define LOCTEXT_NAMESPACE "SenseGloveBackendKismet" + +class FSenseGloveBackendKismetModule : public IModuleInterface +{ +public: + virtual void StartupModule() override; + virtual void PreUnloadCallback() override; + virtual void PostLoadCallback() override; + virtual void ShutdownModule() override; +}; + +#undef LOCTEXT_NAMESPACE diff --git a/Source/SenseGloveBackendKismet/Public/SGBackendKismet/SGBackendKismetLibrary.h b/Source/SenseGloveBackendKismet/Public/SGBackendKismet/SGBackendKismetLibrary.h new file mode 100644 index 00000000..cddef6c0 --- /dev/null +++ b/Source/SenseGloveBackendKismet/Public/SGBackendKismet/SGBackendKismetLibrary.h @@ -0,0 +1,61 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2023 SenseGlove + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * @section DESCRIPTION + * + * + */ + + +#pragma once + +#include "SGKismet/SGBlueprintFunctionLibrary.h" + +#include "SGBackendKismetLibrary.generated.h" + +class USGBackend; + +UCLASS(meta=(ScriptName = "SesneGloveBackendKismetLibrary")) +class SENSEGLOVEBACKENDKISMET_API USGBackendKismetLibrary final : public USGBlueprintFunctionLibrary +{ + GENERATED_BODY() + +public: + UFUNCTION(BlueprintCallable, Category="SenseGlove | Backend") + static USGBackend* GetInstance(); + + UFUNCTION(BlueprintPure, Category="SenseGlove | Backend") + static bool IsBackendInitialized(const USGBackend* Backend); + + UFUNCTION(BlueprintCallable, Category="SenseGlove | Backend") + bool InitializeBackend(UPARAM(ref) USGBackend* Backend); + + UFUNCTION(BlueprintCallable, Category="SenseGlove | Backend") + bool UninitializeBackend(UPARAM(ref) USGBackend* Backend); +}; \ No newline at end of file diff --git a/Source/SenseGloveBackendKismet/SenseGloveBackendKismet.Build.cs b/Source/SenseGloveBackendKismet/SenseGloveBackendKismet.Build.cs new file mode 100644 index 00000000..14b41f97 --- /dev/null +++ b/Source/SenseGloveBackendKismet/SenseGloveBackendKismet.Build.cs @@ -0,0 +1,64 @@ +/** + * @file + * + * @author Mamadou Babaei + * + * @section LICENSE + * + * (The MIT License) + * + * Copyright (c) 2020 - 2023 SenseGlove + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * @section DESCRIPTION + * + * + */ + + +using System; +using UnrealBuildTool; + +public class SenseGloveBackendKismet : ModuleRules +{ + public SenseGloveBackendKismet(ReadOnlyTargetRules Target) : base(Target) + { + PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs; + + PublicDependencyModuleNames.AddRange( + new string[] + { + "Core", + } + ); + + PrivateDependencyModuleNames.AddRange( + new string[] + { + "CoreUObject", + "Engine", + "SenseGloveBackend", + "SenseGloveLog", + "SenseGloveKismet", + "SenseGloveTypes", + } + ); + } +} \ No newline at end of file