Unstable 1.1.14.0

This commit is contained in:
Markus Isberg
2023-10-02 16:43:54 +03:00
parent 94f5a93a0c
commit cf8f0de659
606 changed files with 21906 additions and 11456 deletions
+48 -8
View File
@@ -1,34 +1,41 @@
using Steamworks.Data;
using System;
using Steamworks.Data;
using System.Collections.Generic;
namespace Steamworks
{
/// <summary>
/// Class for utilizing Steam Input.
/// </summary>
public class SteamInput : SteamClientClass<SteamInput>
{
internal static ISteamInput? Internal => Interface as ISteamInput;
internal override void InitializeInterface( bool server )
internal override bool InitializeInterface( bool server )
{
SetInterface( server, new ISteamInput( server ) );
if ( Interface is null || Interface.Self == IntPtr.Zero ) return false;
return true;
}
internal const int STEAM_CONTROLLER_MAX_COUNT = 16;
/// <summary>
/// You shouldn't really need to call this because it get called by RunCallbacks on SteamClient
/// You shouldn't really need to call this because it gets called by <see cref="SteamClient.RunCallbacks"/>
/// but Valve think it might be a nice idea if you call it right before you get input info -
/// just to make sure the info you're getting is 100% up to date.
/// </summary>
public static void RunFrame()
{
Internal?.RunFrame();
Internal?.RunFrame( false );
}
static readonly InputHandle_t[] queryArray = new InputHandle_t[STEAM_CONTROLLER_MAX_COUNT];
/// <summary>
/// Return a list of connected controllers.
/// Gets a list of connected controllers.
/// </summary>
public static IEnumerable<Controller> Controllers
{
@@ -65,10 +72,43 @@ namespace Steamworks
ref origin
);
return Internal.GetGlyphForActionOrigin(origin);
return Internal.GetGlyphForActionOrigin_Legacy(origin);
}
internal static Dictionary<string, InputDigitalActionHandle_t> DigitalHandles = new Dictionary<string, InputDigitalActionHandle_t>();
/// <summary>
/// Return an absolute path to the PNG image glyph for the provided digital action name. The current
/// action set in use for the controller will be used for the lookup. You should cache the result and
/// maintain your own list of loaded PNG assets.
/// </summary>
public static string? GetPngActionGlyph( Controller controller, string action, GlyphSize size )
{
if ( Internal is null ) { return null; }
InputActionOrigin origin = InputActionOrigin.None;
Internal.GetDigitalActionOrigins( controller.Handle, Internal.GetCurrentActionSet( controller.Handle ), GetDigitalActionHandle( action ), ref origin );
return Internal.GetGlyphPNGForActionOrigin( origin, size, 0 );
}
/// <summary>
/// Return an absolute path to the SVF image glyph for the provided digital action name. The current
/// action set in use for the controller will be used for the lookup. You should cache the result and
/// maintain your own list of loaded PNG assets.
/// </summary>
public static string? GetSvgActionGlyph( Controller controller, string action )
{
if ( Internal is null ) { return null; }
InputActionOrigin origin = InputActionOrigin.None;
Internal.GetDigitalActionOrigins( controller.Handle, Internal.GetCurrentActionSet( controller.Handle ), GetDigitalActionHandle( action ), ref origin );
return Internal.GetGlyphSVGForActionOrigin( origin, 0 );
}
internal static Dictionary<string, InputDigitalActionHandle_t> DigitalHandles = new Dictionary<string, InputDigitalActionHandle_t>();
internal static InputDigitalActionHandle_t GetDigitalActionHandle( string name )
{
if (Internal is null) { return default; }
@@ -107,4 +147,4 @@ namespace Steamworks
return val;
}
}
}
}