Interhaptics SDK for Unity 1.6
Loading...
Searching...
No Matches
RazerSensaProvider.cs
Go to the documentation of this file.
1/* ​
2* Copyright (c) 2024 Go Touch VR SAS. All rights reserved. ​
3* ​
4*/
5
6#if (UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN)
7using System.Runtime.InteropServices;
8
9namespace Interhaptics.Platforms.Sensa
10{
11
12 public sealed class RazerSensaProvider : IHapticProvider
13 {
14
15 #region HAPTIC CHARACTERISTICS FIELDS
16 private const string DISPLAY_NAME = "Razer Sensa Platform";
17 private const string DESCRIPTION = "Razer Sensa Platform";
18 private const string MANUFACTURER = "Razer Inc.";
19 private const string VERSION = "1.0";
20 #endregion
21
22 #region HAPTIC CHARACTERISTICS GETTERS
23 [UnityEngine.Scripting.Preserve]
24 public string DisplayName()
25 {
26 return DISPLAY_NAME;
27 }
28
29 [UnityEngine.Scripting.Preserve]
30 public string Description()
31 {
32 return DESCRIPTION;
33 }
34
35 [UnityEngine.Scripting.Preserve]
36 public string Manufacturer()
37 {
38 return MANUFACTURER;
39 }
40
41 [UnityEngine.Scripting.Preserve]
42 public string Version()
43 {
44 return VERSION;
45 }
46 #endregion
47
48 #region PROVIDER LOOP
49 private static class RazerSensaProviderNative
50 {
51 const string DLL_NAME = "Interhaptics.RazerSensa";
52
53 [DllImport(DLL_NAME)]
54 public static extern bool ProviderInit();
55 [DllImport(DLL_NAME)]
56 public static extern bool ProviderIsPresent();
57 [DllImport(DLL_NAME)]
58 public static extern bool ProviderClean();
59 [DllImport(DLL_NAME)]
60 public static extern void ProviderRenderHaptics();
61 }
62
63 [UnityEngine.Scripting.Preserve]
64 public bool Init()
65 {
66 bool res = RazerSensaProviderNative.ProviderInit();
67
68 if ((res) && (HapticManager.DebugSwitch))
69 {
70 UnityEngine.Debug.Log("Razer Sensa haptic provider started.");
71 }
72 return res;
73 }
74
75 [UnityEngine.Scripting.Preserve]
76 public bool IsPresent()
77 {
78 return RazerSensaProviderNative.ProviderIsPresent();
79 }
80
81 [UnityEngine.Scripting.Preserve]
82 public bool Clean()
83 {
84 return RazerSensaProviderNative.ProviderClean();
85 }
86
87 [UnityEngine.Scripting.Preserve]
88 public void RenderHaptics()
89 {
90 RazerSensaProviderNative.ProviderRenderHaptics();
91 }
92 #endregion
93
94 }
95
96}
97#endif