mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-22 20:43:09 +00:00
Handle font size properly. Fix animation panel close event
This commit is contained in:
parent
5655b8c3f4
commit
bf408b4e5d
5 changed files with 18 additions and 8 deletions
|
@ -306,6 +306,9 @@ namespace FirstPlugin
|
|||
private BitmapFont bitmapFont;
|
||||
public Bitmap GetBitmap(string text, bool reversewh, LayoutBXLYT.BasePane pane)
|
||||
{
|
||||
var FontInfo = FontSection;
|
||||
var TextureGlyph = FontInfo.TextureGlyph;
|
||||
|
||||
var textPane = (LayoutBXLYT.ITextPane)pane;
|
||||
if (bitmapFont == null)
|
||||
bitmapFont = GetBitmapFont(true);
|
||||
|
@ -313,6 +316,8 @@ namespace FirstPlugin
|
|||
return bitmapFont.PrintToBitmap(text, new BitmapFont.FontRenderSettings()
|
||||
{
|
||||
CharSpacing = (int)textPane.CharacterSpace,
|
||||
XScale = (textPane.FontSize.X / TextureGlyph.CellWidth),
|
||||
YScale = (textPane.FontSize.Y / TextureGlyph.CellHeight),
|
||||
LineSpacing = (int)textPane.LineSpace,
|
||||
});
|
||||
}
|
||||
|
@ -338,7 +343,7 @@ namespace FirstPlugin
|
|||
SheetBM = TextureGlyph.GetImageSheet(sheet).GetComponentBitmap(SheetBM, true);
|
||||
|
||||
SheetBM.RotateFlip(RotateFlipType.RotateNoneFlipY);
|
||||
BitmapData bd = SheetBM.LockBits(new Rectangle(0, 0, SheetBM.Width, SheetBM.Height),
|
||||
BitmapData bd = SheetBM.LockBits(new Rectangle(0, 0, SheetBM.Width, SheetBM.Height),
|
||||
ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
|
||||
|
||||
for (int y = 0; y < TextureGlyph.LinesCount; y++)
|
||||
|
@ -346,8 +351,8 @@ namespace FirstPlugin
|
|||
for (int x = 0; x < TextureGlyph.RowCount; x++)
|
||||
{
|
||||
Bitmap b = new Bitmap(TextureGlyph.CellWidth, TextureGlyph.CellHeight);
|
||||
BitmapData bd2 = b.LockBits(new Rectangle(0, 0, b.Width, b.Height),
|
||||
ImageLockMode.WriteOnly,PixelFormat.Format32bppArgb);
|
||||
BitmapData bd2 = b.LockBits(new Rectangle(0, 0, b.Width, b.Height),
|
||||
ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
|
||||
|
||||
for (int y2 = 0; y2 < TextureGlyph.CellHeight; y2++)
|
||||
{
|
||||
|
|
|
@ -267,9 +267,6 @@ namespace LayoutBXLYT
|
|||
if (updateBitmap)
|
||||
BindFontBitmap(pane, fontBitmap);
|
||||
|
||||
int width = (int)pane.Width;
|
||||
int height = (int)pane.Height;
|
||||
|
||||
var mat = textBox.Material as BFLYT.Material;
|
||||
if (mat.Shader == null)
|
||||
{
|
||||
|
@ -311,7 +308,11 @@ namespace LayoutBXLYT
|
|||
|
||||
DrawRectangle(pane, gameWindow, pane.Rectangle, texCoords, Colors, false, effectiveAlpha);
|
||||
|
||||
mat.Shader.Disable();
|
||||
|
||||
GL.BindTexture(TextureTarget.Texture2D, 0);
|
||||
GL.PopAttrib();
|
||||
GL.UseProgram(0);
|
||||
}
|
||||
|
||||
private static void BindFontBitmap(BasePane pane, Bitmap fontBitmap)
|
||||
|
|
|
@ -812,6 +812,7 @@ namespace LayoutBXLYT
|
|||
|
||||
private void LayoutEditor_FormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
AnimationPanel?.OnControlClosing();
|
||||
GamePreviewWindow?.OnControlClosing();
|
||||
GamePreviewWindow?.Dispose();
|
||||
}
|
||||
|
|
|
@ -311,7 +311,7 @@ namespace LayoutBXLYT
|
|||
else if (pane is ITextPane && Runtime.LayoutEditor.DisplayTextPane)
|
||||
{
|
||||
var textPane = (ITextPane)pane;
|
||||
Bitmap bitmap = new Bitmap(32, 32);
|
||||
Bitmap bitmap = null;
|
||||
if (textPane.RenderableFont == null)
|
||||
{
|
||||
if (pane is BFLYT.TXT1)
|
||||
|
@ -327,6 +327,8 @@ namespace LayoutBXLYT
|
|||
}
|
||||
if (bitmap != null)
|
||||
BxlytToGL.DrawTextbox(pane, GameWindow, bitmap, effectiveAlpha, Textures, SelectedPanes, textPane.RenderableFont == null);
|
||||
else
|
||||
DrawDefaultPane(shader, pane);
|
||||
}
|
||||
else if (pane is BFLYT.SCR1)
|
||||
BxlytToGL.DrawScissorPane(pane, GameWindow, effectiveAlpha, SelectedPanes);
|
||||
|
|
|
@ -345,10 +345,11 @@ namespace Toolbox.Library
|
|||
OnFrameAdvanced();
|
||||
}
|
||||
|
||||
public void AnimationPanel_FormClosed()
|
||||
public override void OnControlClosing()
|
||||
{
|
||||
isOpen = false;
|
||||
Dispose();
|
||||
ClosePanel();
|
||||
}
|
||||
|
||||
private void AnimationPanel_Load(object sender, EventArgs e)
|
||||
|
|
Loading…
Reference in a new issue