-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🚧 Improved resource content rendering #20
Abstracted text document rendering. Automatically increase the line number column width. Improved tab controls in the Content Editor. Fixed UniformScrollController not rendering the last line of the document. Added a content renderer that attempts to render images (png and jpeg).
- Loading branch information
Showing
7 changed files
with
138 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/RPGCoreUnity/Assets/RPGCore/Scripts/Editors/Packages/Frames/TextureWindowFrame.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using RPGCore.Packages; | ||
using UnityEngine; | ||
|
||
namespace RPGCore.Unity.Editors | ||
{ | ||
public class TextureWindowFrame : WindowFrame | ||
{ | ||
private readonly Texture2D texture; | ||
|
||
public TextureWindowFrame(IResource resource) | ||
{ | ||
texture = new Texture2D(2, 2); | ||
texture.LoadImage(resource.LoadData()); | ||
} | ||
|
||
public override void OnEnable() | ||
{ | ||
|
||
} | ||
|
||
public override void OnGUI() | ||
{ | ||
int aspect = texture.width / texture.height; | ||
var rect = GUILayoutUtility.GetRect(480, 480 / aspect, GUILayout.ExpandWidth(false)); | ||
|
||
GUI.DrawTexture(rect, texture); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/RPGCoreUnity/Assets/RPGCore/Scripts/Editors/Packages/Frames/TextureWindowFrame.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters