Skip to content

Commit

Permalink
Tweaky blinders
Browse files Browse the repository at this point in the history
  • Loading branch information
Smidgens committed Aug 11, 2022
1 parent 1febe17 commit 09af88a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
Binary file added .github/gallery.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 17 additions & 9 deletions Runtime/Utils/CGUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Smidgenomics.Unity.Console

internal static class CGUI
{
public static Texture2D TextureWhite => _whiteTex.Value;
public static Texture2D TextureWhite => GetWhiteTex();

public static void Draw(in Rect pos, in Color c)
{
Expand Down Expand Up @@ -57,14 +57,22 @@ public static void Border(in Rect pos, in Color c)
}


private static Lazy<Texture2D> _whiteTex = new Lazy<Texture2D>(() =>

private static Texture2D GetWhiteTex()
{
var t = new Texture2D(1, 1);
t.SetPixel(0, 0, Color.white);
t.Apply();
t.wrapMode = TextureWrapMode.Repeat;
t.filterMode = FilterMode.Point;
return t;
});
if(!_whiteTex)
{
_whiteTex = new Texture2D(1, 1);
_whiteTex.SetPixel(0, 0, Color.white);
_whiteTex.Apply();
_whiteTex.wrapMode = TextureWrapMode.Repeat;
_whiteTex.filterMode = FilterMode.Point;
return _whiteTex;
}
return _whiteTex;
}


private static Texture2D _whiteTex = null;
}
}
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name":"com.smidgenomics.unity-console",
"version":"0.1.0",
"displayName":"Console",
"description":"Runtime dev console",
"description":"Runtime Developer Console.",
"repository": {
"type": "git",
"url": "git+https://github.com/Smidgens/unity-console.git"
Expand All @@ -13,6 +13,9 @@
},
"keywords":[
"console",
"unity-console"
"unity-console",
"dev-console",
"runtime-console",
"smidgenomics"
]
}

0 comments on commit 09af88a

Please sign in to comment.