-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
107 changed files
with
2,646 additions
and
808 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
using System; | ||
using System.Diagnostics.CodeAnalysis; | ||
|
||
namespace Amethyst.Plugins.Contract; | ||
|
||
// Input action declaration for key events | ||
public interface IKeyInputAction : IComparable<IKeyInputAction>, IEquatable<IKeyInputAction> | ||
{ | ||
/// <summary> | ||
/// Identifies the action | ||
/// </summary> | ||
public string Guid { get; init; } | ||
|
||
/// <summary> | ||
/// Friendly name of the action | ||
/// </summary> | ||
public string Name { get; set; } | ||
|
||
/// <summary> | ||
/// Action description for binding UI | ||
/// </summary> | ||
public string Description { get; set; } | ||
|
||
/// <summary> | ||
/// Action image for binding UI to be shown in info | ||
/// MUST BE OF TYPE Microsoft.UI.Xaml.Controls.Image | ||
/// </summary> | ||
/// <remarks> | ||
/// Make this a getter and return an Image constructed | ||
/// during OnLoad, expect COM-related crashes otherwise | ||
/// </remarks> | ||
public object? Image { get; set; } | ||
|
||
/// <summary> | ||
/// Invoke the action (shortcut) | ||
/// </summary> | ||
public Action<object?> Invoke => _ => { }; | ||
|
||
/// <summary> | ||
/// Checks whether the action is used for anything | ||
/// </summary> | ||
public bool IsUsed => false; | ||
|
||
/// <summary> | ||
/// Action data type (shortcut) | ||
/// </summary> | ||
public Type DataType => typeof(object); | ||
} | ||
|
||
// Input action declaration for key events | ||
public class KeyInputAction<T> : IKeyInputAction | ||
{ | ||
/// <summary> | ||
/// Identifies the action | ||
/// </summary> | ||
public string Guid { get; init; } = System.Guid.NewGuid().ToString(); | ||
|
||
/// <summary> | ||
/// Friendly name of the action | ||
/// </summary> | ||
public string Name { get; set; } = "INVALID"; | ||
|
||
/// <summary> | ||
/// Action description for binding UI | ||
/// </summary> | ||
public string Description { get; set; } = string.Empty; | ||
|
||
/// <summary> | ||
/// Action image for binding UI to be shown in info | ||
/// MUST BE OF TYPE Microsoft.UI.Xaml.Controls.Image | ||
/// </summary> | ||
/// <remarks> | ||
/// Make this a getter and return an Image constructed | ||
/// during OnLoad, expect COM-related crashes otherwise | ||
/// </remarks> | ||
public object? Image { get; set; } | ||
|
||
/// <summary> | ||
/// Implement comparator with other actions (by Guid) | ||
/// </summary> | ||
public int CompareTo(IKeyInputAction? other) | ||
{ | ||
return string.Compare(Guid, other?.Guid, StringComparison.Ordinal); | ||
} | ||
|
||
/// <summary> | ||
/// Implement comparator with other actions (by Guid) | ||
/// </summary> | ||
public bool Equals(IKeyInputAction? other) | ||
{ | ||
return Guid.Equals(other?.Guid); | ||
} | ||
|
||
/// <summary> | ||
/// Implement comparator with other objects | ||
/// </summary> | ||
public override bool Equals(object? obj) | ||
{ | ||
return Equals(obj as IKeyInputAction); | ||
} | ||
|
||
/// <summary> | ||
/// Implement hashes for the comparator | ||
/// </summary> | ||
public override int GetHashCode() | ||
{ | ||
return Guid.GetHashCode(); | ||
} | ||
|
||
/// <summary> | ||
/// Host import for Invoke() calls and stuff | ||
/// Func so you can use it in static context | ||
/// </summary> | ||
public Func<IAmethystHost?> GetHost { get; set; } = () => null; | ||
|
||
/// <summary> | ||
/// Invoke the action (shortcut) | ||
/// </summary> | ||
public Action<T?> Invoke => data => GetHost()?.ReceiveKeyInput(this, data); | ||
|
||
/// <summary> | ||
/// Checks whether the action is used for anything | ||
/// </summary> | ||
public bool IsUsed => GetHost()?.CheckInputActionIsUsed(this) ?? false; | ||
|
||
/// <summary> | ||
/// Action data type (shortcut) | ||
/// </summary> | ||
public Type DataType => typeof(T); | ||
} |
63 changes: 31 additions & 32 deletions
63
Amethyst.Plugins.Contract/Amethyst.Plugins.Contract.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,36 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild> | ||
<Title>Amethyst Device Plugin API (Contract)</Title> | ||
<FileVersion></FileVersion> | ||
<Version>0.2.13</Version> | ||
<Platforms>x64</Platforms> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild> | ||
<Title>Amethyst Device Plugin API (Contract)</Title> | ||
<FileVersion></FileVersion> | ||
<Version>0.3.33</Version> | ||
<Platforms>x64</Platforms> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<PackageId>Amethyst.Plugins.Contract</PackageId> | ||
<Version>0.2.25</Version> | ||
<Authors>K2VR</Authors> | ||
<Company>K2VR</Company> | ||
<PackageTags>Amethyst;K2VR;KinectToVR;VR;OpenVR;Fullbody Tracking</PackageTags> | ||
<Description> | ||
This client class library lets you export your plugin library for Amethyst with MEF. | ||
Compatible with C# (with XAML via WinUI/WinRT), C++/CLI, and custom WinRT projections. | ||
Contains additional functions and helper classes to make plugin developmnet easier. | ||
</Description> | ||
<PackageIcon>ktvr.png</PackageIcon> | ||
<PackageLicenseExpression>MIT</PackageLicenseExpression> | ||
<RequireLicenseAcceptance>true</RequireLicenseAcceptance> | ||
<SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<PackageId>Amethyst.Plugins.Contract</PackageId> | ||
<Authors>K2VR</Authors> | ||
<Company>K2VR</Company> | ||
<PackageTags>Amethyst;K2VR;KinectToVR;VR;OpenVR;Fullbody Tracking</PackageTags> | ||
<Description> | ||
This client class library lets you export your plugin library for Amethyst with MEF. | ||
Compatible with C# (with XAML via WinUI/WinRT), C++/CLI, and custom WinRT projections. | ||
Contains additional functions and helper classes to make plugin developmnet easier. | ||
</Description> | ||
<PackageIcon>ktvr.png</PackageIcon> | ||
<PackageLicenseExpression>MIT</PackageLicenseExpression> | ||
<RequireLicenseAcceptance>true</RequireLicenseAcceptance> | ||
<SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<None Include="Assets\ktvr.png" Pack="true" PackagePath="\" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="Assets\ktvr.png" Pack="true" PackagePath="\" /> | ||
</ItemGroup> | ||
|
||
</Project> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.