mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 11:06:06 -04:00
Don't draw to framebuffer when the window is minimised, fixes crashing.
This commit is contained in:
parent
09f0a04efa
commit
f8866017a1
@ -22,6 +22,7 @@ namespace Launcher2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override void Redraw( IDrawer2D drawer ) {
|
public override void Redraw( IDrawer2D drawer ) {
|
||||||
|
if( Window.Minimised ) return;
|
||||||
drawer.DrawRect( FastColour.Black, X, Y, Width, Height );
|
drawer.DrawRect( FastColour.Black, X, Y, Width, Height );
|
||||||
if( Value ) {
|
if( Value ) {
|
||||||
DrawTextArgs args = new DrawTextArgs( "X", font, false );
|
DrawTextArgs args = new DrawTextArgs( "X", font, false );
|
||||||
|
@ -27,6 +27,7 @@ namespace Launcher2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override void Redraw( IDrawer2D drawer ) {
|
public override void Redraw( IDrawer2D drawer ) {
|
||||||
|
if( Window.Minimised ) return;
|
||||||
string text = Text;
|
string text = Text;
|
||||||
if( !Active ) text = "&7" + text;
|
if( !Active ) text = "&7" + text;
|
||||||
int xOffset = Width - textSize.Width, yOffset = Height - textSize.Height;
|
int xOffset = Width - textSize.Width, yOffset = Height - textSize.Height;
|
||||||
@ -62,11 +63,13 @@ namespace Launcher2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void RedrawBackground() {
|
public void RedrawBackground() {
|
||||||
|
if( Window.Minimised ) return;
|
||||||
using( FastBitmap dst = new FastBitmap( Window.Framebuffer, true ) )
|
using( FastBitmap dst = new FastBitmap( Window.Framebuffer, true ) )
|
||||||
RedrawBackground( dst );
|
RedrawBackground( dst );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RedrawBackground( FastBitmap dst ) {
|
public void RedrawBackground( FastBitmap dst ) {
|
||||||
|
if( Window.Minimised ) return;
|
||||||
Rectangle rect = new Rectangle( X + border, Y + border, Width - border * 2, Height - border * 2 );
|
Rectangle rect = new Rectangle( X + border, Y + border, Width - border * 2, Height - border * 2 );
|
||||||
if( Window.ClassicMode ) {
|
if( Window.ClassicMode ) {
|
||||||
FastColour foreCol = Active ? new FastColour( 126, 136, 191 ) : new FastColour( 111, 111, 111 );
|
FastColour foreCol = Active ? new FastColour( 126, 136, 191 ) : new FastColour( 111, 111, 111 );
|
||||||
|
@ -73,7 +73,8 @@ namespace Launcher2 {
|
|||||||
Size size = drawer.MeasureSize( ref args );
|
Size size = drawer.MeasureSize( ref args );
|
||||||
Width = Math.Max( ButtonWidth, size.Width + 15 );
|
Width = Math.Max( ButtonWidth, size.Width + 15 );
|
||||||
textHeight = size.Height;
|
textHeight = size.Height;
|
||||||
args.SkipPartsCheck = true;
|
args.SkipPartsCheck = true;
|
||||||
|
if( Window.Minimised ) return;
|
||||||
|
|
||||||
FastColour col = Active ? new FastColour( 240, 240, 240 ) : new FastColour( 180, 180, 180 );
|
FastColour col = Active ? new FastColour( 240, 240, 240 ) : new FastColour( 180, 180, 180 );
|
||||||
drawer.Clear( col, X + 1, Y, Width - 2, 2 );
|
drawer.Clear( col, X + 1, Y, Width - 2, 2 );
|
||||||
|
@ -24,6 +24,7 @@ namespace Launcher2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override void Redraw( IDrawer2D drawer ) {
|
public override void Redraw( IDrawer2D drawer ) {
|
||||||
|
if( Window.Minimised ) return;
|
||||||
DrawTextArgs args = new DrawTextArgs( Text, font, true );
|
DrawTextArgs args = new DrawTextArgs( Text, font, true );
|
||||||
drawer.DrawText( ref args, X, Y );
|
drawer.DrawText( ref args, X, Y );
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,10 @@ namespace Launcher2 {
|
|||||||
/// <summary> Whether at the next tick, the launcher window should proceed to stop displaying frames and subsequently exit. </summary>
|
/// <summary> Whether at the next tick, the launcher window should proceed to stop displaying frames and subsequently exit. </summary>
|
||||||
public bool ShouldExit;
|
public bool ShouldExit;
|
||||||
|
|
||||||
|
public bool Minimised {
|
||||||
|
get { return Window.WindowState == WindowState.Minimized || (Width == 1 && Height == 1); }
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary> Contains metadata attached for different screen instances,
|
/// <summary> Contains metadata attached for different screen instances,
|
||||||
/// typically used to save 'last text entered' text when a screen is disposed. </summary>
|
/// typically used to save 'last text entered' text when a screen is disposed. </summary>
|
||||||
public Dictionary<string, Dictionary<string, object>> ScreenMetadata =
|
public Dictionary<string, Dictionary<string, object>> ScreenMetadata =
|
||||||
@ -60,6 +64,7 @@ namespace Launcher2 {
|
|||||||
logoFont = new Font( "Arial", 24, FontStyle.Regular );
|
logoFont = new Font( "Arial", 24, FontStyle.Regular );
|
||||||
string path = Assembly.GetExecutingAssembly().Location;
|
string path = Assembly.GetExecutingAssembly().Location;
|
||||||
Window.Icon = Icon.ExtractAssociatedIcon( path );
|
Window.Icon = Icon.ExtractAssociatedIcon( path );
|
||||||
|
//Minimised = Window.WindowState == WindowState.Minimized;
|
||||||
|
|
||||||
if( Configuration.RunningOnWindows )
|
if( Configuration.RunningOnWindows )
|
||||||
platformDrawer = new WinPlatformDrawer();
|
platformDrawer = new WinPlatformDrawer();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user