Lovense Integration: LovenseIntegration/Source/LovenseIntegration/Public/LovenseIntegration.h Source File

Lovense Integration

LovenseIntegration.h
1 // (CVN) - Candy Valley Network GmbH
2
3 #pragma once
4
5 // EXTERNAL INCLUDES
6 #include <Containers/Ticker.h>
7 #include <Modules/ModuleInterface.h>
8 #include <Modules/ModuleManager.h>
9 #include <Runtime/Launch/Resources/Version.h>
10
11 // INTERNAL INCLUDES
12
13
14 DECLARE_LOG_CATEGORY_EXTERN(LogLovenseIntegration, All, All)
15
16
17
20 class FLovenseIntegrationModule : public IModuleInterface {
21 public:
22 // IModuleInterface
23 virtual void StartupModule() override;
24 virtual void ShutdownModule() override;
25 // End IModuleInterface
26
32 LOVENSEINTEGRATION_API void Initialize();
33
35 void StartHeartbeat();
37 void StopHeartbeat();
38
40 FORCEINLINE static FLovenseIntegrationModule& Get() {
41 // If module is already loaded, LoadModuleChecked() is basically just a map find, so not a big deal performance-wise.
42 // We could consider returning our static moduleInstance instead, but this seems more reliable.
43 static const FName NAME_LovenseIntegration(TEXT("LovenseIntegration"));
44 return FModuleManager::LoadModuleChecked<FLovenseIntegrationModule>(NAME_LovenseIntegration);
45 }
46
48 FORCEINLINE class FTimerManager* GetTimerManager() { return this->timerManager.Get(); }
49
54 FORCEINLINE class FLovenseManager* GetLovenseManager() { return this->lovenseManager.Get(); }
55
56 private:
62 bool HeartBeat(float deltaTime);
63
64 private:
66 static FLovenseIntegrationModule* moduleInstance;
67
69 TSharedPtr<class FTimerManager> timerManager = nullptr;
71 FTickerDelegate heartbeatTickerDelegate;
72 #if ENGINE_MAJOR_VERSION >= 5
73
74 FTSTicker::FDelegateHandle heartbeatTickerDelegateHandle;
75 #else
76
77 FDelegateHandle heartbeatTickerDelegateHandle;
78 #endif
79
81 TSharedPtr<class FLovenseManager> lovenseManager = nullptr;
82 };
FLovenseIntegrationModule
Lovense Integration Module class. Use FLovenseIntegrationModule::Get() to easily get the module insta...
Definition: LovenseIntegration.h:20
FLovenseManager::Get
static FLovenseManager * Get()
Get the instance of the lovense manager. Always valid.
Definition: LovenseManager.cpp:49
FLovenseIntegrationModule::Get
static FORCEINLINE FLovenseIntegrationModule & Get()
Get the instance of the module. Always valid.
Definition: LovenseIntegration.h:40
FLovenseIntegrationModule::GetLovenseManager
FORCEINLINE class FLovenseManager * GetLovenseManager()
Get the instance of the lovense manager. Usually you would use FLovenseManager:Get() for this,...
Definition: LovenseIntegration.h:54
FLovenseIntegrationModule::GetTimerManager
FORCEINLINE class FTimerManager * GetTimerManager()
Get the instance of the timer manager. Only valid while the integration is running.
Definition: LovenseIntegration.h:48
FLovenseManager
This class defines the plugin interface. Use FLovenseManager::Get() to get the global manager instanc...
Definition: LovenseManager.h:99