Skip to content

Commit

Permalink
Merge pull request #54 from eviltwo/1.1.0-dev
Browse files Browse the repository at this point in the history
1.1.0
  • Loading branch information
eviltwo committed Jul 16, 2024
2 parents f8e037d + 6fb6355 commit aa9edc8
Show file tree
Hide file tree
Showing 12 changed files with 47 additions and 43 deletions.
7 changes: 7 additions & 0 deletions InputGlyphs/Assets/InputGlyphs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [1.1.0] - 2024-07-16
### Changed
- [GlyphLoader](https://github.com/eviltwo/UnitySteamInputGlyphLoader) package has been integrated into this package.
- Users no longer need to import the GlyphLoader package.
### Fixed
- Fixed the issue where an error was output when adding a component from the script.

## [1.0.2] - 2024-07-16
### Updated
- Updated SteamInputAdapter package version to 1.0.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@
"expression": "",
"define": "SUPPORT_ADAPTER"
},
{
"name": "com.eviltwo.unity-steam-input-glyph-loader",
"expression": "",
"define": "SUPPORT_LOADER"
},
{
"name": "com.unity.textmeshpro",
"expression": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,6 @@ private class RequiredPackageInfo
isInstalled = true,
#endif
},
new RequiredPackageInfo
{
title = "Steam Input Glyph Loader",
name = "com.eviltwo.unity-steam-input-glyph-loader",
pageUrl = "https://github.com/eviltwo/UnitySteamInputGlyphLoader",
packageUrl = "https://github.com/eviltwo/UnitySteamInputGlyphLoader.git?path=UnitySteamInputGlyphLoader/Assets/UnitySteamInputGlyphLoader",
requiredVersion = "0.10.0",
#if SUPPORT_LOADER
isInstalled = true
#endif
}
};

private Dictionary<string, string> _versionCache = new Dictionary<string, string>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,15 @@ private void Awake()
{
SpriteRenderer = GetComponent<SpriteRenderer>();
}
_texture = new Texture2D(2, 2);
}

private void Start()
{
if (PlayerInput == null)
{
Debug.LogError("PlayerInput is not set.", this);
}
_texture = new Texture2D(2, 2);
}

private void OnDisable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ private void Awake()
{
Text = GetComponent<TMP_Text>();
}
if (PlayerInput == null)
{
Debug.LogError("PlayerInput is not set.", this);
}
_packedTexture = new Texture2D(2, 2);
_sharedMaterial = new Material(Material);
_sharedMaterial.SetTexture("_MainTex", _packedTexture);
Expand All @@ -63,6 +59,14 @@ private void Awake()
Text.spriteAsset = _sharedSpriteAsset;
}

private void Start()
{
if (PlayerInput == null)
{
Debug.LogError("PlayerInput is not set.", this);
}
}

private void OnDisable()
{
if (_lastPlayerInput != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,16 @@ private void Awake()
{
Image = GetComponent<Image>();
}
_defaultSizeDelta = Image.rectTransform.sizeDelta;
_texture = new Texture2D(2, 2);
}

private void Start()
{
if (PlayerInput == null)
{
Debug.LogError("PlayerInput is not set.", this);
}
_defaultSizeDelta = Image.rectTransform.sizeDelta;
_texture = new Texture2D(2, 2);
}

private void OnDisable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"GUID:75469ad4d38634e559750d17036d5f7c",
"GUID:68bd7fdb68ef2684e982e8a9825b18a5",
"GUID:fc48f7dd8f1155d429d2f9eeb74a4fd4",
"GUID:8a9147e240ebffa4b9517ceeb62ed4a6",
"GUID:9c45730b1cb24524ca3c3e758ea0fd43"
"GUID:8a9147e240ebffa4b9517ceeb62ed4a6"
],
"includePlatforms": [],
"excludePlatforms": [],
Expand All @@ -25,11 +24,6 @@
"name": "com.eviltwo.unity-steam-input-adapter",
"expression": "",
"define": "SUPPORT_ADAPTER"
},
{
"name": "com.eviltwo.unity-steam-input-glyph-loader",
"expression": "",
"define": "SUPPORT_LOADER"
}
],
"noEngineReferences": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace InputGlyphs.Loaders
{
public class SteamGamepadGlyphInitializer : MonoBehaviour
{
#if STEAMWORKS_NET && !DISABLESTEAMWORKS && SUPPORT_ADAPTER && SUPPORT_LOADER
#if STEAMWORKS_NET && !DISABLESTEAMWORKS && SUPPORT_ADAPTER
private static bool _initialized;

private void Awake()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#if STEAMWORKS_NET && SUPPORT_ADAPTER && SUPPORT_LOADER
#if STEAMWORKS_NET && SUPPORT_ADAPTER
using System.Collections.Generic;
using System.IO;
using Steamworks;
using UnityEngine;
using UnityEngine.InputSystem;
using UnitySteamInputGlyphLoader;
using UnitySteamInputAdapter;

namespace InputGlyphs.Loaders
{
Expand All @@ -28,7 +29,21 @@ public bool LoadGlyph(Texture2D texture, IReadOnlyList<InputDevice> activeDevice
return false;
}

return SteamInputGlyphLoader.LoadGlyph(texture, supportedDevice, inputLayoutPath, GlyphSize);
// Get path of Glyph image file.
var steamInputAction = SteamInputAdapter.GetSteamInputAction(supportedDevice, inputLayoutPath);
var glyphPath = SteamInput.GetGlyphPNGForActionOrigin(steamInputAction, GlyphSize, 0);
if (string.IsNullOrEmpty(glyphPath))
{
return false;
}

return LoadImage(texture, glyphPath);
}

public static bool LoadImage(Texture2D texture, string path)
{
var bytes = File.ReadAllBytes(path);
return texture.LoadImage(bytes);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion InputGlyphs/Assets/InputGlyphs/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "com.eviltwo.input-glyphs",
"displayName": "Input Glyphs",
"version": "1.0.2",
"version": "1.1.0",
"unity": "2022.3",
"description": "Displays glyphs (icons) of keyboard & mouse or controller buttons recognized by Unity's InputSystem.",
"author": {
Expand Down
1 change: 0 additions & 1 deletion InputGlyphs/Packages/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"dependencies": {
"com.eviltwo.unity-steam-input-adapter": "https://github.com/eviltwo/UnitySteamInputAdapter.git?path=UnitySteamInputAdapter/Assets/UnitySteamInputAdapter#1.0.1",
"com.eviltwo.unity-steam-input-glyph-loader": "https://github.com/eviltwo/UnitySteamInputGlyphLoader.git?path=UnitySteamInputGlyphLoader/Assets/UnitySteamInputGlyphLoader#0.10.0",
"com.rlabrecque.steamworks.net": "https://github.com/rlabrecque/Steamworks.NET.git?path=/com.rlabrecque.steamworks.net#20.2.0",
"com.unity.collab-proxy": "2.4.3",
"com.unity.feature.development": "1.0.1",
Expand Down
7 changes: 0 additions & 7 deletions InputGlyphs/Packages/packages-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@
"dependencies": {},
"hash": "9d9b8060e51ed78042fc681b22ed35039a54c332"
},
"com.eviltwo.unity-steam-input-glyph-loader": {
"version": "https://github.com/eviltwo/UnitySteamInputGlyphLoader.git?path=UnitySteamInputGlyphLoader/Assets/UnitySteamInputGlyphLoader#0.10.0",
"depth": 0,
"source": "git",
"dependencies": {},
"hash": "93a2f359075827dba7a563604f0e42fcc56fad41"
},
"com.rlabrecque.steamworks.net": {
"version": "https://github.com/rlabrecque/Steamworks.NET.git?path=/com.rlabrecque.steamworks.net#20.2.0",
"depth": 0,
Expand Down

0 comments on commit aa9edc8

Please sign in to comment.