mirror of
https://github.com/drewcassidy/KSP-Conformal-Decals.git
synced 2024-09-01 18:23:54 +00:00
Fix font saving and rendering
This commit is contained in:
parent
c9853049c5
commit
d31576fb0b
Binary file not shown.
@ -94,12 +94,24 @@ namespace ConformalDecals {
|
||||
|
||||
public override void OnLoad(ConfigNode node) {
|
||||
base.OnLoad(node);
|
||||
text = WebUtility.UrlDecode(ParseUtil.ParseString(node, "text"));
|
||||
font = DecalConfig.GetFont(ParseUtil.ParseString(node, "font", true, "Calibri SDF"));
|
||||
|
||||
string textRaw = "";
|
||||
if (ParseUtil.ParseStringIndirect(ref textRaw, node, "text")) {
|
||||
text = WebUtility.UrlDecode(textRaw);
|
||||
}
|
||||
|
||||
string fontName = "";
|
||||
if (ParseUtil.ParseStringIndirect(ref fontName, node, "fontName")) {
|
||||
font = DecalConfig.GetFont(fontName);
|
||||
}
|
||||
|
||||
int styleInt = 0;
|
||||
if (ParseUtil.ParseIntIndirect(ref styleInt, node, "style")) style = (FontStyles) styleInt;
|
||||
if (!ParseUtil.ParseColor32Indirect(ref fillColor, node, "fillColor")) fillColor = Color.magenta;
|
||||
if (!ParseUtil.ParseColor32Indirect(ref outlineColor, node, "outlineColor")) outlineColor = Color.magenta;
|
||||
if (ParseUtil.ParseIntIndirect(ref styleInt, node, "style")) {
|
||||
style = (FontStyles) styleInt;
|
||||
}
|
||||
|
||||
ParseUtil.ParseColor32Indirect(ref fillColor, node, "fillColor");
|
||||
ParseUtil.ParseColor32Indirect(ref outlineColor, node, "outlineColor");
|
||||
|
||||
if (HighLogic.LoadedSceneIsGame) {
|
||||
// For some reason, rendering doesnt work right on the first frame a scene is loaded
|
||||
@ -210,12 +222,12 @@ namespace ConformalDecals {
|
||||
|
||||
public override void OnDestroy() {
|
||||
if (HighLogic.LoadedSceneIsGame && _currentText != null) TextRenderer.UnregisterText(_currentText);
|
||||
|
||||
|
||||
// close all UIs
|
||||
if (_textEntryController != null) _textEntryController.Close();
|
||||
if (_fillColorPickerController != null) _fillColorPickerController.Close();
|
||||
if (_outlineColorPickerController != null) _outlineColorPickerController.Close();
|
||||
|
||||
|
||||
base.OnDestroy();
|
||||
}
|
||||
|
||||
|
@ -272,14 +272,14 @@ namespace ConformalDecals.Text {
|
||||
}
|
||||
}
|
||||
|
||||
GL.Clear(false, true, Color.black); //KSP doesnt clear render textures before using them so we need to clear afterwards, as well. Thanks Squad.
|
||||
GL.PopMatrix();
|
||||
|
||||
// COPY TEXTURE BACK INTO RAM
|
||||
RenderTexture.active = renderTex;
|
||||
texture.ReadPixels(new Rect(0, 0, textureSize.x, textureSize.y), 0, 0, true);
|
||||
texture.Apply();
|
||||
|
||||
GL.Clear(false, true, Color.black); //KSP doesnt clear render textures before using them so we need to clear afterwards, as well. Thanks Squad.
|
||||
GL.PopMatrix();
|
||||
|
||||
// RELEASE RENDERTEX
|
||||
RenderTexture.ReleaseTemporary(renderTex);
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
v0.2.4
|
||||
- Fixes:
|
||||
- Fixed red text appearing on planets due to KSP bug by clearing render textures afterwards.
|
||||
- Fixed fonts not saving correctly
|
||||
|
||||
v0.2.3
|
||||
------
|
||||
|
Loading…
Reference in New Issue
Block a user