diff --git a/InputGlyphs/Assets/InputGlyphs/CHANGELOG.md b/InputGlyphs/Assets/InputGlyphs/CHANGELOG.md index cba6989..8912031 100644 --- a/InputGlyphs/Assets/InputGlyphs/CHANGELOG.md +++ b/InputGlyphs/Assets/InputGlyphs/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [0.7.4] - 2024-07-09 +### Fixed +- Supports Text Mesh Pro Text(3D). + ## [0.7.3] - 2024-07-07 ### Changed - Added version to URLs importing packages such as steamworks. diff --git a/InputGlyphs/Assets/InputGlyphs/README.txt b/InputGlyphs/Assets/InputGlyphs/README.txt new file mode 100644 index 0000000..1bed4e9 --- /dev/null +++ b/InputGlyphs/Assets/InputGlyphs/README.txt @@ -0,0 +1,2 @@ +Input Glyphs Documentation: +https://eviltwo.github.io/InputGlyphs_Docs/ diff --git a/InputGlyphs/Assets/InputGlyphs/README.txt.meta b/InputGlyphs/Assets/InputGlyphs/README.txt.meta new file mode 100644 index 0000000..92bd364 --- /dev/null +++ b/InputGlyphs/Assets/InputGlyphs/README.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 29cbb78d0362e8a47bdfb16bf2e05107 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/InputGlyphs/Assets/InputGlyphs/Samples/SoloPlayerSample.unity b/InputGlyphs/Assets/InputGlyphs/Samples/SoloPlayerSample.unity index d848e71..e80f002 100644 --- a/InputGlyphs/Assets/InputGlyphs/Samples/SoloPlayerSample.unity +++ b/InputGlyphs/Assets/InputGlyphs/Samples/SoloPlayerSample.unity @@ -981,6 +981,198 @@ MonoBehaviour: m_ChildScaleWidth: 0 m_ChildScaleHeight: 0 m_ReverseArrangement: 0 +--- !u!1 &803495005 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 803495008} + - component: {fileID: 803495007} + - component: {fileID: 803495006} + - component: {fileID: 803495009} + m_Layer: 0 + m_Name: 3D Text (TMP) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!114 &803495006 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 803495005} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9541d86e2fd84c1d9990edf0852d74ab, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Player 1 moves with and attacks with + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 8 + m_fontSizeBase: 8 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 0 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + _SortingLayer: 0 + _SortingLayerID: 0 + _SortingOrder: 0 + m_hasFontAssetChanged: 0 + m_renderer: {fileID: 803495007} + m_maskType: 0 +--- !u!23 &803495007 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 803495005} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!224 &803495008 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 803495005} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 8 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: -2.37} + m_SizeDelta: {x: 20, y: 5} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &803495009 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 803495005} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 122678166f0bcb1499246674cb41d711, type: 3} + m_Name: + m_EditorClassIdentifier: + Text: {fileID: 803495006} + Material: {fileID: 2100000, guid: ea49b1babf7e91f4293973bff501c8ae, type: 2} + PlayerInput: {fileID: 1847320111} + InputActionReferences: + - {fileID: 1942945179757384036, guid: 1b9bb0cc544975040b6fa735b8e5fcf7, type: 3} + - {fileID: -6609880655223600665, guid: 1b9bb0cc544975040b6fa735b8e5fcf7, type: 3} + GlyphsLayout: 2 --- !u!1 &933883783 GameObject: m_ObjectHideFlags: 0 diff --git a/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Display/DisplayGlyphTextureGenerator.cs b/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Display/DisplayGlyphTextureGenerator.cs index 0c699fc..a94c3b3 100644 --- a/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Display/DisplayGlyphTextureGenerator.cs +++ b/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Display/DisplayGlyphTextureGenerator.cs @@ -13,6 +13,9 @@ public static class DisplayGlyphTextureGenerator { private static List _textureBuffer = new List(); + /// + /// Generates glyph texture for the specified inputLayoutPaths and writes it to the texture. The glyph textures are arranged according to the layout. + /// public static bool GenerateGlyphTexture(Texture2D texture, IReadOnlyList activeDevices, IReadOnlyList inputLayoutPaths, GlyphsLayout layout) { if (texture == null) diff --git a/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Display/TextMeshPro/InputGlyphText.cs b/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Display/TextMeshPro/InputGlyphText.cs index 80136c6..22bb866 100644 --- a/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Display/TextMeshPro/InputGlyphText.cs +++ b/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Display/TextMeshPro/InputGlyphText.cs @@ -11,13 +11,12 @@ namespace InputGlyphs.Display { - [RequireComponent(typeof(TextMeshProUGUI))] public class InputGlyphText : MonoBehaviour { public static int PackedTextureSize = 2048; [SerializeField, HideInInspector] - public TextMeshProUGUI Text = null; + public TMP_Text Text = null; [SerializeField, HideInInspector] public Material Material = null; @@ -42,14 +41,14 @@ public class InputGlyphText : MonoBehaviour private void Reset() { - Text = GetComponent(); + Text = GetComponent(); } private void Awake() { if (Text == null) { - Text = GetComponent(); + Text = GetComponent(); } _packedTexture = new Texture2D(2, 2); _sharedMaterial = new Material(Material); @@ -241,8 +240,7 @@ private void SetGlyphsToSpriteAsset(IReadOnlyList actionTextures, IRe _sharedSpriteAsset.spriteCharacterTable.Add(glyphCharacter); } _sharedSpriteAsset.UpdateLookupTables(); - Text.UpdateFontAsset(); - Text.UpdateMeshPadding(); + Text.SetAllDirty(); Profiler.EndSample(); } diff --git a/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/IInputGlyphLoader.cs b/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/IInputGlyphLoader.cs index 105c09a..44a952d 100644 --- a/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/IInputGlyphLoader.cs +++ b/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/IInputGlyphLoader.cs @@ -7,6 +7,13 @@ namespace InputGlyphs { public interface IInputGlyphLoader { + /// + /// Load glyphs for the given device and layout path and writes it to texture. + /// + /// Texture onto which glyphs are written. + /// Active devices + /// example: <gamepad>/dpad/left + /// Return true if the load was success. bool LoadGlyph(Texture2D texture, IReadOnlyList activeDevices, string inputLayoutPath); } } diff --git a/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/InputGlyphManager.cs b/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/InputGlyphManager.cs index fa48564..126cf52 100644 --- a/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/InputGlyphManager.cs +++ b/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/InputGlyphManager.cs @@ -5,6 +5,10 @@ namespace InputGlyphs { + /// + /// Manages GlyphLoaders and load Glyph images from registered GlyphLoaders. + /// Register GlyphLoaders when you start the game. + /// public static class InputGlyphManager { private static List _loaders = new List(); diff --git a/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Loaders/Gamepad/GamepadGlyphInitializer.cs b/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Loaders/Gamepad/GamepadGlyphInitializer.cs index a484570..bfd7b36 100644 --- a/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Loaders/Gamepad/GamepadGlyphInitializer.cs +++ b/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Loaders/Gamepad/GamepadGlyphInitializer.cs @@ -18,8 +18,15 @@ public class GamepadGlyphInitializer : MonoBehaviour [SerializeField] private InputGlyphTextureMap _switchProControllerTextureMap = null; + private static bool _initialized; + private void Awake() { + if (_initialized) + { + return; + } + var gamepadGlyphLoader = new GamepadGlyphLoader( _fallbackTextureMap, _xboxTextureMap, diff --git a/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Loaders/Gamepad/GamepadGlyphInitializer.cs.meta b/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Loaders/Gamepad/GamepadGlyphInitializer.cs.meta index 6cd7fd5..c2bac95 100644 --- a/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Loaders/Gamepad/GamepadGlyphInitializer.cs.meta +++ b/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Loaders/Gamepad/GamepadGlyphInitializer.cs.meta @@ -3,7 +3,11 @@ guid: eafe8db674e08124088156c44a7e580e MonoImporter: externalObjects: {} serializedVersion: 2 - defaultReferences: [] + defaultReferences: + - _fallbackTextureMap: {fileID: 11400000, guid: 842e8fa628eb6694a986b04be4bba8eb, type: 2} + - _xboxTextureMap: {fileID: 11400000, guid: 842e8fa628eb6694a986b04be4bba8eb, type: 2} + - _playstationTextureMap: {fileID: 11400000, guid: d7c9f7c70d93309478d6f14b3888d847, type: 2} + - _switchProControllerTextureMap: {fileID: 11400000, guid: 0079b4fcdaac170458e63cb2fd86ba97, type: 2} executionOrder: 0 icon: {instanceID: 0} userData: diff --git a/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Loaders/Utils/DeviceGlyphLoader.cs b/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Loaders/Utils/DeviceGlyphLoader.cs index 6b42c83..caa1f48 100644 --- a/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Loaders/Utils/DeviceGlyphLoader.cs +++ b/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Loaders/Utils/DeviceGlyphLoader.cs @@ -6,6 +6,10 @@ namespace InputGlyphs.Loaders.Utils { + /// + /// General implementation of the . + /// It is recommended to use the to generate the loader instead of inheriting and implementing this class. + /// public class DeviceGlyphLoader : IInputGlyphLoader where T : InputDevice { diff --git a/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Loaders/Utils/DeviceGlyphLoaderInitializer.cs b/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Loaders/Utils/DeviceGlyphLoaderInitializer.cs index 92590d7..4ef5519 100644 --- a/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Loaders/Utils/DeviceGlyphLoaderInitializer.cs +++ b/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Loaders/Utils/DeviceGlyphLoaderInitializer.cs @@ -4,6 +4,10 @@ namespace InputGlyphs.Loaders.Utils { + /// + /// A general initialization class that creates glyph loader for various , handles the transfer of , and registers loader with the Manager. + /// If you want to easily create a glyph loader for custom devices, it is recommended to inherit from this class. + /// public class DeviceGlyphLoaderInitializer : MonoBehaviour where T : InputDevice { diff --git a/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Loaders/Utils/InputGlyphTextureMap.cs b/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Loaders/Utils/InputGlyphTextureMap.cs index d682d60..c67c0bd 100644 --- a/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Loaders/Utils/InputGlyphTextureMap.cs +++ b/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Loaders/Utils/InputGlyphTextureMap.cs @@ -2,6 +2,9 @@ namespace InputGlyphs.Loaders.Utils { + /// + /// A map that associates control paths of input devices with glyph textures. + /// [CreateAssetMenu(fileName = "InputGlyphTextureMap", menuName = "InputGlyphs/InputGlyphTextureMap")] public class InputGlyphTextureMap : ScriptableObject { diff --git a/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Utils/GlyphTextureUtility.cs b/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Utils/GlyphTextureUtility.cs index 5b4d350..4b59981 100644 --- a/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Utils/GlyphTextureUtility.cs +++ b/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Utils/GlyphTextureUtility.cs @@ -5,6 +5,12 @@ namespace InputGlyphs.Utils { public static class GlyphTextureUtility { + /// + /// Combines multiple textures into a single texture arranged in a horizontal row. + /// + /// texture to write the results to. + /// Original textures. They can be of different sizes. + /// Return true if the load was success. public static bool MergeTexturesHorizontal(Texture2D texture, IReadOnlyList sourceTextures) { var width = 0; diff --git a/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Utils/InputActionRebindingExtensions.cs b/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Utils/InputActionRebindingExtensions.cs index b5a89ef..eda9601 100644 --- a/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Utils/InputActionRebindingExtensions.cs +++ b/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Utils/InputActionRebindingExtensions.cs @@ -7,6 +7,10 @@ namespace InputGlyphs.Utils { public static class InputActionRebindingExtensions { + /// + /// Gets the indexes of all bindings in the action's bindings that match the specified binding mask. + /// This function just changes the number of results of . + /// public static void GetBindingIndexes(this InputAction action, InputBinding bindingMask, List results) { results.Clear(); diff --git a/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Utils/InputLayoutPathUtility.cs b/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Utils/InputLayoutPathUtility.cs index f69fcce..8c86396 100644 --- a/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Utils/InputLayoutPathUtility.cs +++ b/InputGlyphs/Assets/InputGlyphs/Scripts/Runtime/Utils/InputLayoutPathUtility.cs @@ -41,6 +41,12 @@ public static string GetLocalPath(string inputLayoutPath) return _stringBuilder.ToString(); } + /// + /// Searches for bindings within actions that match the control scheme and returns the effective paths. + /// + /// Target action + /// Control scheme for masks + /// Effective paths of detected bindings public static bool TryGetActionBindingPath(InputAction action, string controlScheme, List results) { results.Clear(); diff --git a/InputGlyphs/Assets/InputGlyphs/Xelu_Free_Controller&Key_Prompts/Readme.txt b/InputGlyphs/Assets/InputGlyphs/Xelu_Free_Controller&Key_Prompts/Readme.txt new file mode 100644 index 0000000..a3b9104 --- /dev/null +++ b/InputGlyphs/Assets/InputGlyphs/Xelu_Free_Controller&Key_Prompts/Readme.txt @@ -0,0 +1,3 @@ +Xelufs FREE Controller Prompts +https://thoseawesomeguys.com/prompts +Creative Commons 0 (CC0) diff --git a/InputGlyphs/Assets/InputGlyphs/Xelu_Free_Controller&Key_Prompts/Readme.txt.meta b/InputGlyphs/Assets/InputGlyphs/Xelu_Free_Controller&Key_Prompts/Readme.txt.meta new file mode 100644 index 0000000..f9ac8a2 --- /dev/null +++ b/InputGlyphs/Assets/InputGlyphs/Xelu_Free_Controller&Key_Prompts/Readme.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 3764971924a71b244ab740f5fba25918 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/InputGlyphs/Assets/InputGlyphs/package.json b/InputGlyphs/Assets/InputGlyphs/package.json index 3358016..8a7f282 100644 --- a/InputGlyphs/Assets/InputGlyphs/package.json +++ b/InputGlyphs/Assets/InputGlyphs/package.json @@ -1,7 +1,7 @@ { "name": "com.eviltwo.input-glyphs", "displayName": "Input Glyphs", - "version": "0.7.3", + "version": "0.7.4", "unity": "2022.3", "description": "Displays glyphs (icons) of keyboard & mouse or controller buttons recognized by Unity's InputSystem.", "author": {