diff --git a/Assets/Scenes/TestMap.unity b/Assets/Scenes/TestMap.unity index 5357701..3415dc4 100644 --- a/Assets/Scenes/TestMap.unity +++ b/Assets/Scenes/TestMap.unity @@ -2260,7 +2260,7 @@ Transform: m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 1706692498} m_LocalRotation: {x: -0.000000014901159, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -1, y: 1, z: 0.5} + m_LocalPosition: {x: 0, y: 0, z: 0.5} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 1610252930} diff --git a/Assets/Scripts/Util/TextTextureRenderer.cs b/Assets/Scripts/Util/TextTextureRenderer.cs index ddc37be..e34f5b9 100644 --- a/Assets/Scripts/Util/TextTextureRenderer.cs +++ b/Assets/Scripts/Util/TextTextureRenderer.cs @@ -31,17 +31,22 @@ namespace Cyber.Util { } private Texture2D RenderText(TextTextureProperties text) { - float Scale = 1.0f / text.Width; + float Scale = 2.0f / text.Width; Text.text = text.Text.Replace("\\n", "\n"); Text.fontSize = text.FontSize; - Text.characterSize = text.FontSize * Scale * 0.5f; + Text.characterSize = text.FontSize * Scale * 0.25f; RenderTexture TextTexture = RenderTexture.GetTemporary(text.Width, text.Height); RenderTexture OldRT = Camera.targetTexture; + + float OffsetX = -text.Width / 2f; + float OffsetY = -text.Height / 2f; + Camera.orthographicSize = 1.0f * text.Height / text.Width; Camera.targetTexture = TextTexture; Camera.backgroundColor = text.Background; - Camera.transform.localPosition = new Vector3(-text.OffsetX * Scale, - text.OffsetY * Scale); + Camera.transform.localPosition = new Vector3( + -(text.OffsetX + OffsetX) * Scale, + (text.OffsetY + OffsetY) * Scale); Camera.Render(); Camera.targetTexture = OldRT;