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 ) {
|
||||
if( Window.Minimised ) return;
|
||||
drawer.DrawRect( FastColour.Black, X, Y, Width, Height );
|
||||
if( Value ) {
|
||||
DrawTextArgs args = new DrawTextArgs( "X", font, false );
|
||||
|
@ -27,6 +27,7 @@ namespace Launcher2 {
|
||||
}
|
||||
|
||||
public override void Redraw( IDrawer2D drawer ) {
|
||||
if( Window.Minimised ) return;
|
||||
string text = Text;
|
||||
if( !Active ) text = "&7" + text;
|
||||
int xOffset = Width - textSize.Width, yOffset = Height - textSize.Height;
|
||||
@ -62,11 +63,13 @@ namespace Launcher2 {
|
||||
}
|
||||
|
||||
public void RedrawBackground() {
|
||||
if( Window.Minimised ) return;
|
||||
using( FastBitmap dst = new FastBitmap( Window.Framebuffer, true ) )
|
||||
RedrawBackground( dst );
|
||||
}
|
||||
|
||||
public void RedrawBackground( FastBitmap dst ) {
|
||||
if( Window.Minimised ) return;
|
||||
Rectangle rect = new Rectangle( X + border, Y + border, Width - border * 2, Height - border * 2 );
|
||||
if( Window.ClassicMode ) {
|
||||
FastColour foreCol = Active ? new FastColour( 126, 136, 191 ) : new FastColour( 111, 111, 111 );
|
||||
|
@ -74,6 +74,7 @@ namespace Launcher2 {
|
||||
Width = Math.Max( ButtonWidth, size.Width + 15 );
|
||||
textHeight = size.Height;
|
||||
args.SkipPartsCheck = true;
|
||||
if( Window.Minimised ) return;
|
||||
|
||||
FastColour col = Active ? new FastColour( 240, 240, 240 ) : new FastColour( 180, 180, 180 );
|
||||
drawer.Clear( col, X + 1, Y, Width - 2, 2 );
|
||||
|
@ -24,6 +24,7 @@ namespace Launcher2 {
|
||||
}
|
||||
|
||||
public override void Redraw( IDrawer2D drawer ) {
|
||||
if( Window.Minimised ) return;
|
||||
DrawTextArgs args = new DrawTextArgs( Text, font, true );
|
||||
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>
|
||||
public bool ShouldExit;
|
||||
|
||||
public bool Minimised {
|
||||
get { return Window.WindowState == WindowState.Minimized || (Width == 1 && Height == 1); }
|
||||
}
|
||||
|
||||
/// <summary> Contains metadata attached for different screen instances,
|
||||
/// typically used to save 'last text entered' text when a screen is disposed. </summary>
|
||||
public Dictionary<string, Dictionary<string, object>> ScreenMetadata =
|
||||
@ -60,6 +64,7 @@ namespace Launcher2 {
|
||||
logoFont = new Font( "Arial", 24, FontStyle.Regular );
|
||||
string path = Assembly.GetExecutingAssembly().Location;
|
||||
Window.Icon = Icon.ExtractAssociatedIcon( path );
|
||||
//Minimised = Window.WindowState == WindowState.Minimized;
|
||||
|
||||
if( Configuration.RunningOnWindows )
|
||||
platformDrawer = new WinPlatformDrawer();
|
||||
|
Loading…
x
Reference in New Issue
Block a user