mirror of
				https://github.com/ClassiCube/ClassiCube.git
				synced 2025-11-03 19:16:45 -05:00 
			
		
		
		
	Remove invalidate as it didn't fix issues on linux, other minor cleanup.
This commit is contained in:
		
							parent
							
								
									bc147bc295
								
							
						
					
					
						commit
						e726a4aef8
					
				@ -75,19 +75,19 @@ namespace ClassicalSharp {
 | 
			
		||||
			format.Trimming = StringTrimming.None;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		public override void DrawRect( Color colour, int x, int y, int width, int height ) {
 | 
			
		||||
		public override void DrawRect( FastColour colour, int x, int y, int width, int height ) {
 | 
			
		||||
			Brush brush = GetOrCreateBrush( colour );
 | 
			
		||||
			g.FillRectangle( brush, x, y, width, height );
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		public override void DrawRectBounds( Color colour, float lineWidth, int x, int y, int width, int height ) {
 | 
			
		||||
		public override void DrawRectBounds( FastColour colour, float lineWidth, int x, int y, int width, int height ) {
 | 
			
		||||
			using( Pen pen = new Pen( colour, lineWidth ) ) {
 | 
			
		||||
				pen.Alignment = PenAlignment.Inset;
 | 
			
		||||
				g.DrawRectangle( pen, x, y, width, height );
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		public override void DrawRoundedRect( Color colour, float radius, float x, float y, float width, float height ) {
 | 
			
		||||
		public override void DrawRoundedRect( FastColour colour, float radius, float x, float y, float width, float height ) {
 | 
			
		||||
			GraphicsPath path = new GraphicsPath();
 | 
			
		||||
			float x1 = x, y1 = y, x2 = x + width, y2 = y + height;
 | 
			
		||||
			
 | 
			
		||||
@ -107,11 +107,11 @@ namespace ClassicalSharp {
 | 
			
		||||
			path.Dispose();
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		public override void Clear( Color colour ) {
 | 
			
		||||
		public override void Clear( FastColour colour ) {
 | 
			
		||||
			g.Clear( colour );
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		public override void Clear( Color colour, int x, int y, int width, int height ) {
 | 
			
		||||
		public override void Clear( FastColour colour, int x, int y, int width, int height ) {
 | 
			
		||||
			g.SmoothingMode = SmoothingMode.None;
 | 
			
		||||
			Brush brush = GetOrCreateBrush( colour );
 | 
			
		||||
			g.FillRectangle( brush, x, y, width, height );
 | 
			
		||||
 | 
			
		||||
@ -26,21 +26,21 @@ namespace ClassicalSharp {
 | 
			
		||||
		
 | 
			
		||||
		/// <summary> Draws a 2D flat rectangle of the specified dimensions at the
 | 
			
		||||
		/// specified coordinates in the currently bound bitmap. </summary>
 | 
			
		||||
		public abstract void DrawRect( Color colour, int x, int y, int width, int height );
 | 
			
		||||
		public abstract void DrawRect( FastColour colour, int x, int y, int width, int height );
 | 
			
		||||
		
 | 
			
		||||
		/// <summary> Draws the outline of a 2D flat rectangle of the specified dimensions
 | 
			
		||||
		/// at the specified coordinates in the currently bound bitmap. </summary>
 | 
			
		||||
		public abstract void DrawRectBounds( Color colour, float lineWidth, int x, int y, int width, int height );
 | 
			
		||||
		public abstract void DrawRectBounds( FastColour colour, float lineWidth, int x, int y, int width, int height );
 | 
			
		||||
		
 | 
			
		||||
		/// <summary> Draws a 2D rectangle with rounded borders of the specified dimensions
 | 
			
		||||
		/// at the specified coordinates in the currently bound bitmap. </summary>
 | 
			
		||||
		public abstract void DrawRoundedRect( Color colour, float radius, float x, float y, float width, float height );
 | 
			
		||||
		public abstract void DrawRoundedRect( FastColour colour, float radius, float x, float y, float width, float height );
 | 
			
		||||
		
 | 
			
		||||
		/// <summary> Clears the entire bound bitmap to the specified colour. </summary>
 | 
			
		||||
		public abstract void Clear( Color colour );
 | 
			
		||||
		public abstract void Clear( FastColour colour );
 | 
			
		||||
		
 | 
			
		||||
		/// <summary> Clears the entire bound bitmap to the specified colour. </summary>
 | 
			
		||||
		public abstract void Clear( Color colour, int x, int y, int width, int height );
 | 
			
		||||
		public abstract void Clear( FastColour colour, int x, int y, int width, int height );
 | 
			
		||||
		
 | 
			
		||||
		/// <summary> Disposes of any resources used by this class that are associated with the underlying bitmap. </summary>
 | 
			
		||||
		public abstract void Dispose();
 | 
			
		||||
@ -85,12 +85,11 @@ namespace ClassicalSharp {
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		protected List<TextPart> parts = new List<TextPart>( 64 );
 | 
			
		||||
		protected static Color white = Color.FromArgb( 255, 255, 255 );
 | 
			
		||||
		protected struct TextPart {
 | 
			
		||||
			public string Text;
 | 
			
		||||
			public Color TextColour;
 | 
			
		||||
			public FastColour TextColour;
 | 
			
		||||
			
 | 
			
		||||
			public TextPart( string text, Color col ) {
 | 
			
		||||
			public TextPart( string text, FastColour col ) {
 | 
			
		||||
				Text = text;
 | 
			
		||||
				TextColour = col;
 | 
			
		||||
			}
 | 
			
		||||
@ -100,7 +99,7 @@ namespace ClassicalSharp {
 | 
			
		||||
			parts.Clear();
 | 
			
		||||
			if( String.IsNullOrEmpty( value ) ) {
 | 
			
		||||
			} else if( value.IndexOf( '&' ) == -1 ) {
 | 
			
		||||
				parts.Add( new TextPart( value, white ) );
 | 
			
		||||
				parts.Add( new TextPart( value, FastColour.White ) );
 | 
			
		||||
			} else {
 | 
			
		||||
				SplitText( value );
 | 
			
		||||
			}
 | 
			
		||||
@ -114,7 +113,7 @@ namespace ClassicalSharp {
 | 
			
		||||
				
 | 
			
		||||
				if( partLength > 0 ) {
 | 
			
		||||
					string part = value.Substring( i, partLength );
 | 
			
		||||
					Color col = Color.FromArgb(
 | 
			
		||||
					FastColour col = new FastColour(
 | 
			
		||||
						191 * ((code >> 2) & 1) + 64 * (code >> 3),
 | 
			
		||||
						191 * ((code >> 1) & 1) + 64 * (code >> 3),
 | 
			
		||||
						191 * ((code >> 0) & 1) + 64 * (code >> 3) );
 | 
			
		||||
 | 
			
		||||
@ -26,7 +26,7 @@ namespace ClassicalSharp {
 | 
			
		||||
			graphicsApi.Draw2DQuad( startX - 5, startY - 30 - 5, blocksPerRow * blockSize + 10,
 | 
			
		||||
			                       rows * blockSize + 30 + 10, backCol );
 | 
			
		||||
			graphicsApi.Texturing = true;
 | 
			
		||||
			graphicsApi.BindTexture( game.TerrainAtlas.TexId );		
 | 
			
		||||
			graphicsApi.BindTexture( game.TerrainAtlas.TexId );
 | 
			
		||||
			graphicsApi.BeginVbBatch( VertexFormat.Pos3fTex2fCol4b );
 | 
			
		||||
			
 | 
			
		||||
			for( int i = 0; i < blocksTable.Length; i++ ) {
 | 
			
		||||
 | 
			
		||||
@ -14,7 +14,7 @@ namespace ClassicalSharp {
 | 
			
		||||
			this.message = message;
 | 
			
		||||
			titleFont = new Font( "Arial", 16, FontStyle.Bold );
 | 
			
		||||
			messageFont = new Font( "Arial", 14, FontStyle.Regular );
 | 
			
		||||
		}	
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		public override void Render( double delta ) {
 | 
			
		||||
			graphicsApi.Texturing = true;
 | 
			
		||||
 | 
			
		||||
@ -76,7 +76,7 @@ namespace ClassicalSharp {
 | 
			
		||||
		
 | 
			
		||||
		public override bool HandlesKeyDown( Key key ) {
 | 
			
		||||
			if( key == Key.Escape ) {
 | 
			
		||||
				game.SetNewScreen( new NormalScreen( game ) );				
 | 
			
		||||
				game.SetNewScreen( new NormalScreen( game ) );
 | 
			
		||||
			} else if( key == Key.Left ) {
 | 
			
		||||
				PageClick( false );
 | 
			
		||||
			} else if( key == Key.Right ) {
 | 
			
		||||
 | 
			
		||||
@ -24,7 +24,7 @@ namespace ClassicalSharp {
 | 
			
		||||
			graphicsApi.Texturing = true;
 | 
			
		||||
			fpsTextWidget.Render( delta );
 | 
			
		||||
			if( game.activeScreen is NormalScreen ) {
 | 
			
		||||
				UpdateHackState( false );				
 | 
			
		||||
				UpdateHackState( false );
 | 
			
		||||
				DrawPosition();
 | 
			
		||||
				hackStatesWidget.Render( delta );
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
@ -19,7 +19,7 @@ namespace ClassicalSharp {
 | 
			
		||||
		float progX, progY = 100f;
 | 
			
		||||
		int	progWidth = 200, progHeight = 40;
 | 
			
		||||
		
 | 
			
		||||
		public override void Render( double delta ) {		
 | 
			
		||||
		public override void Render( double delta ) {
 | 
			
		||||
			graphicsApi.ClearColour( FastColour.Black );
 | 
			
		||||
			graphicsApi.Texturing = true;
 | 
			
		||||
			titleWidget.Render( delta );
 | 
			
		||||
@ -39,9 +39,9 @@ namespace ClassicalSharp {
 | 
			
		||||
			using( Bitmap bmp = IDrawer2D.CreatePow2Bitmap( size ) ) {
 | 
			
		||||
				using( IDrawer2D drawer = game.Drawer2D ) {
 | 
			
		||||
					drawer.SetBitmap( bmp );
 | 
			
		||||
					drawer.DrawRectBounds( Color.White, 3f, 0, 0, progWidth, progHeight );
 | 
			
		||||
					drawer.DrawRectBounds( FastColour.White, 3f, 0, 0, progWidth, progHeight );
 | 
			
		||||
					progressBoxTexture = drawer.Make2DTexture( bmp, size, (int)progX, (int)progY );
 | 
			
		||||
				}			
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			game.Events.MapLoading += MapLoading;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@ -29,7 +29,7 @@ namespace ClassicalSharp {
 | 
			
		||||
				     g => { StandardEnvRenderer env = game.EnvRenderer as StandardEnvRenderer;
 | 
			
		||||
				     	return env == null ? "(not active)" : env.CloudsSpeed.ToString(); },
 | 
			
		||||
				     (g, v) => { StandardEnvRenderer env = game.EnvRenderer as StandardEnvRenderer;
 | 
			
		||||
				     	if( env != null ) 
 | 
			
		||||
				     	if( env != null )
 | 
			
		||||
				     		env.CloudsSpeed = Single.Parse( v ); } ),
 | 
			
		||||
				
 | 
			
		||||
				Make( -140, 50, "Clouds height", Anchor.Centre, OnWidgetClick,
 | 
			
		||||
 | 
			
		||||
@ -75,8 +75,8 @@ namespace ClassicalSharp {
 | 
			
		||||
					const string format = "&eFailed to change mapping \"{0}\". &c({1})";
 | 
			
		||||
					statusWidget.SetText( String.Format( format, descriptions[index], reason ) );
 | 
			
		||||
				} else {
 | 
			
		||||
					const string format = "&eChanged mapping \"{0}\" from &7{1} &eto &7{2}&e.";					
 | 
			
		||||
					statusWidget.SetText( String.Format( format, descriptions[index], oldKey, key ) );					
 | 
			
		||||
					const string format = "&eChanged mapping \"{0}\" from &7{1} &eto &7{2}&e.";
 | 
			
		||||
					statusWidget.SetText( String.Format( format, descriptions[index], oldKey, key ) );
 | 
			
		||||
					string text = descriptions[index] + " : " + keyNames[(int)key];
 | 
			
		||||
					widget.SetText( text );
 | 
			
		||||
					game.Keys[mapping] = key;
 | 
			
		||||
 | 
			
		||||
@ -23,7 +23,7 @@ namespace ClassicalSharp {
 | 
			
		||||
		
 | 
			
		||||
		public override void Init() {
 | 
			
		||||
			base.Init();
 | 
			
		||||
			buttons[buttons.Length - 1] = 
 | 
			
		||||
			buttons[buttons.Length - 1] =
 | 
			
		||||
				Make( 0, 5, "Back to menu", (g, w) => g.SetNewScreen( new PauseScreen( g ) ) );
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
@ -45,7 +45,7 @@ namespace ClassicalSharp {
 | 
			
		||||
			} else if( path.EndsWith( ".fcm" ) ) {
 | 
			
		||||
				mapFile = new MapFcm3();
 | 
			
		||||
			} else if( path.EndsWith( ".cw" ) ) {
 | 
			
		||||
			    mapFile = new MapCw();
 | 
			
		||||
				mapFile = new MapCw();
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			try {
 | 
			
		||||
 | 
			
		||||
@ -42,7 +42,7 @@ namespace ClassicalSharp {
 | 
			
		||||
			if( key == Key.Escape ) {
 | 
			
		||||
				game.SetNewScreen( new NormalScreen( game ) );
 | 
			
		||||
				return true;
 | 
			
		||||
			} else if( (key == Key.Enter || key == Key.KeypadEnter) 
 | 
			
		||||
			} else if( (key == Key.Enter || key == Key.KeypadEnter)
 | 
			
		||||
			          && inputWidget != null ) {
 | 
			
		||||
				ChangeSetting();
 | 
			
		||||
				return true;
 | 
			
		||||
 | 
			
		||||
@ -7,7 +7,7 @@ namespace ClassicalSharp {
 | 
			
		||||
	public abstract class MenuScreen : Screen {
 | 
			
		||||
		
 | 
			
		||||
		public MenuScreen( Game game ) : base( game ) {
 | 
			
		||||
		}		
 | 
			
		||||
		}
 | 
			
		||||
		protected ButtonWidget[] buttons;
 | 
			
		||||
		protected Font titleFont, regularFont;
 | 
			
		||||
		
 | 
			
		||||
@ -36,7 +36,7 @@ namespace ClassicalSharp {
 | 
			
		||||
			for( int i = 0; i < buttons.Length; i++ ) {
 | 
			
		||||
				if( buttons[i] == null ) continue;
 | 
			
		||||
				buttons[i].OnResize( oldWidth, oldHeight, width, height );
 | 
			
		||||
			}				
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		public override bool HandlesAllInput {
 | 
			
		||||
@ -61,7 +61,7 @@ namespace ClassicalSharp {
 | 
			
		||||
				if( buttons[i] == null ) continue;
 | 
			
		||||
				buttons[i].Active = false;
 | 
			
		||||
			}
 | 
			
		||||
				
 | 
			
		||||
			
 | 
			
		||||
			for( int i = 0; i < buttons.Length; i++ ) {
 | 
			
		||||
				ButtonWidget widget = buttons[i];
 | 
			
		||||
				if( widget != null && widget.Bounds.Contains( mouseX, mouseY ) ) {
 | 
			
		||||
@ -86,7 +86,7 @@ namespace ClassicalSharp {
 | 
			
		||||
			return true;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		protected virtual void WidgetSelected( ButtonWidget widget ) {			
 | 
			
		||||
		protected virtual void WidgetSelected( ButtonWidget widget ) {
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@ -29,11 +29,11 @@ namespace ClassicalSharp {
 | 
			
		||||
				Make( 140, -50, "Mouse sensitivity", Anchor.Centre, OnWidgetClick,
 | 
			
		||||
				     g => g.MouseSensitivity.ToString(),
 | 
			
		||||
				     (g, v) => { g.MouseSensitivity = Int32.Parse( v );
 | 
			
		||||
				     		Options.Set( OptionsKey.Sensitivity, v ); } ),
 | 
			
		||||
				     	Options.Set( OptionsKey.Sensitivity, v ); } ),
 | 
			
		||||
				
 | 
			
		||||
				Make( 140, 0, "Chat font size", Anchor.Centre, OnWidgetClick,
 | 
			
		||||
				     g => g.Chat.FontSize.ToString(),
 | 
			
		||||
				     (g, v) => { g.Chat.FontSize = Int32.Parse( v ); 
 | 
			
		||||
				     (g, v) => { g.Chat.FontSize = Int32.Parse( v );
 | 
			
		||||
				     	Options.Set( OptionsKey.FontSize, v ); } ),
 | 
			
		||||
				
 | 
			
		||||
				Make( 140, 50, "Key mappings", Anchor.Centre,
 | 
			
		||||
 | 
			
		||||
@ -91,8 +91,8 @@ namespace ClassicalSharp {
 | 
			
		||||
				// NOTE: We don't immediately save here, because otherwise the 'saving...'
 | 
			
		||||
				// will not be rendered in time because saving is done on the main thread.
 | 
			
		||||
				MakeDescWidget( "Saving.." );
 | 
			
		||||
				textPath = text;		
 | 
			
		||||
			}			
 | 
			
		||||
				textPath = text;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		string textPath;
 | 
			
		||||
 | 
			
		||||
@ -21,7 +21,7 @@ namespace ClassicalSharp {
 | 
			
		||||
		
 | 
			
		||||
		public override void Init() {
 | 
			
		||||
			base.Init();
 | 
			
		||||
			buttons[buttons.Length - 1] = 
 | 
			
		||||
			buttons[buttons.Length - 1] =
 | 
			
		||||
				Make( 0, 5, "Back to menu", (g, w) => g.SetNewScreen( new PauseScreen( g ) ) );
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
@ -114,9 +114,9 @@ namespace ClassicalSharp {
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		protected void SortPlayerInfo() {
 | 
			
		||||
			SortInfoList();			
 | 
			
		||||
			SortInfoList();
 | 
			
		||||
			CalcMaxColumnHeight();
 | 
			
		||||
			int y = game.Height / 2 - yHeight / 2;		
 | 
			
		||||
			int y = game.Height / 2 - yHeight / 2;
 | 
			
		||||
			int midCol = columns / 2;
 | 
			
		||||
			
 | 
			
		||||
			int centreX = game.Width / 2;
 | 
			
		||||
@ -124,13 +124,13 @@ namespace ClassicalSharp {
 | 
			
		||||
			if( columns % 2 != 0 ) {
 | 
			
		||||
				// For an odd number of columns, the middle column is centred.
 | 
			
		||||
				offset = Utils.CeilDiv( GetColumnWidth( midCol ), 2 );
 | 
			
		||||
			}		
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			xMin = centreX - offset;			
 | 
			
		||||
			xMin = centreX - offset;
 | 
			
		||||
			for( int col = midCol - 1; col >= 0; col-- ) {
 | 
			
		||||
				xMin -= GetColumnWidth( col );
 | 
			
		||||
				SetColumnPos( col, xMin, y );
 | 
			
		||||
			}			
 | 
			
		||||
			}
 | 
			
		||||
			xMax = centreX - offset;
 | 
			
		||||
			for( int col = midCol; col < columns; col++ ) {
 | 
			
		||||
				SetColumnPos( col, xMax, y );
 | 
			
		||||
 | 
			
		||||
@ -301,8 +301,8 @@ namespace ClassicalSharp {
 | 
			
		||||
			Graphics.SetMatrixMode( MatrixType.Modelview );
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		protected override void OnResize( EventArgs e ) {
 | 
			
		||||
			base.OnResize( e );
 | 
			
		||||
		protected override void OnResize( object sender, EventArgs e ) {
 | 
			
		||||
			base.OnResize( sender, e );
 | 
			
		||||
			Graphics.OnWindowResize( this );
 | 
			
		||||
			UpdateProjection();
 | 
			
		||||
			if( activeScreen != null ) {
 | 
			
		||||
 | 
			
		||||
@ -1,5 +1,5 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Drawing;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Drawing;
 | 
			
		||||
 | 
			
		||||
namespace ClassicalSharp {
 | 
			
		||||
	
 | 
			
		||||
@ -38,9 +38,9 @@ namespace ClassicalSharp {
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		public FastColour( int argb ) {
 | 
			
		||||
			A = (byte)( argb >> 24 );
 | 
			
		||||
			R = (byte)( argb >> 16 );
 | 
			
		||||
			G = (byte)( argb >> 8 );
 | 
			
		||||
			A = (byte)(argb >> 24);
 | 
			
		||||
			R = (byte)(argb >> 16);
 | 
			
		||||
			G = (byte)(argb >> 8);
 | 
			
		||||
			B = (byte)argb;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@ -53,14 +53,14 @@ namespace ClassicalSharp {
 | 
			
		||||
		
 | 
			
		||||
		public static FastColour Scale( FastColour value, float t ) {
 | 
			
		||||
			FastColour result = value;
 | 
			
		||||
			result.R = (byte)( value.R * t );
 | 
			
		||||
			result.G = (byte)( value.G * t );
 | 
			
		||||
			result.B = (byte)( value.B * t );
 | 
			
		||||
			result.R = (byte)(value.R * t);
 | 
			
		||||
			result.G = (byte)(value.G * t);
 | 
			
		||||
			result.B = (byte)(value.B * t);
 | 
			
		||||
			return result;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		public static void GetShaded( FastColour normal, ref FastColour xSide, 
 | 
			
		||||
		                               ref FastColour zSide, ref FastColour yBottom ) {
 | 
			
		||||
		public static void GetShaded( FastColour normal, ref FastColour xSide,
 | 
			
		||||
		                             ref FastColour zSide, ref FastColour yBottom ) {
 | 
			
		||||
			xSide = FastColour.Scale( normal, 0.6f );
 | 
			
		||||
			zSide = FastColour.Scale( normal, 0.8f );
 | 
			
		||||
			yBottom = FastColour.Scale( normal, 0.5f );
 | 
			
		||||
 | 
			
		||||
@ -68,7 +68,7 @@ namespace Launcher2 {
 | 
			
		||||
			MakeTextInputAt( Get( widgetIndex ), 270, -25, 5 );
 | 
			
		||||
			
 | 
			
		||||
			MakeTextAt( inputFont, "../play/", -210, 55 );
 | 
			
		||||
			MakeTextInputAt( "61f27b1f0a3dcb546b650b87a3e17436"/*Get( 3 )*/, 320, -20, 50 );
 | 
			
		||||
			MakeTextInputAt( Get( 3 ), 320, -20, 50 );
 | 
			
		||||
			
 | 
			
		||||
			MakeButtonAt( "Connect", 100, 30, 180, 5, ConnectToServer );
 | 
			
		||||
			MakeButtonAt( "Back", 70, 30, 195, 50,
 | 
			
		||||
 | 
			
		||||
@ -88,7 +88,6 @@ namespace Launcher2 {
 | 
			
		||||
			Dirty = false;
 | 
			
		||||
			screen.Dirty = false;
 | 
			
		||||
			screenGraphics.DrawImage( Framebuffer, 0, 0, Framebuffer.Width, Framebuffer.Height );
 | 
			
		||||
			Window.Invalidate();
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		internal static FastColour clearColour = new FastColour( 30, 30, 30 );
 | 
			
		||||
 | 
			
		||||
@ -24,13 +24,13 @@ namespace Launcher2 {
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		public static string Decode( string encoded, string key ) {
 | 
			
		||||
			if( String.IsNullOrEmpty( encoded ) || String.IsNullOrEmpty( key ) ) return null;
 | 
			
		||||
			if( String.IsNullOrEmpty( encoded ) || String.IsNullOrEmpty( key ) ) return "";
 | 
			
		||||
			
 | 
			
		||||
			byte[] data;
 | 
			
		||||
			try {
 | 
			
		||||
				data = Convert.FromBase64String( encoded );
 | 
			
		||||
			} catch( FormatException ) {
 | 
			
		||||
				return null;
 | 
			
		||||
				return "";
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			try {
 | 
			
		||||
@ -40,7 +40,7 @@ namespace Launcher2 {
 | 
			
		||||
					c[i] = (char)data[i];
 | 
			
		||||
				return new String( c );
 | 
			
		||||
			} catch {
 | 
			
		||||
				if( encoded.Length > 64 || data.Length > 64 ) return null;
 | 
			
		||||
				if( encoded.Length > 64 || data.Length > 64 ) return "";
 | 
			
		||||
				
 | 
			
		||||
				char[] c = new char[data.Length];
 | 
			
		||||
				for( int i = 0; i < c.Length; i++ )
 | 
			
		||||
 | 
			
		||||
@ -99,7 +99,6 @@ namespace OpenTK
 | 
			
		||||
				glContext.MakeCurrent(WindowInfo);
 | 
			
		||||
				glContext.LoadAll();
 | 
			
		||||
				VSync = true;
 | 
			
		||||
				//glWindow.WindowInfoChanged += delegate(object sender, EventArgs e) { OnWindowInfoChangedInternal(e); };
 | 
			
		||||
			} catch (Exception e) {
 | 
			
		||||
				Debug.Print(e.ToString());
 | 
			
		||||
				base.Dispose();
 | 
			
		||||
@ -141,11 +140,11 @@ namespace OpenTK
 | 
			
		||||
		/// <param name="e">
 | 
			
		||||
		/// The <see cref="System.ComponentModel.CancelEventArgs" /> for this event.
 | 
			
		||||
		/// Set e.Cancel to true in order to stop the GameWindow from closing.</param>
 | 
			
		||||
		protected override void OnClosing(System.ComponentModel.CancelEventArgs e) {
 | 
			
		||||
			base.OnClosing(e);
 | 
			
		||||
		protected override void OnClosing(object sender, System.ComponentModel.CancelEventArgs e) {
 | 
			
		||||
			base.OnClosing(sender, e);
 | 
			
		||||
			if (!e.Cancel) {
 | 
			
		||||
				isExiting = true;
 | 
			
		||||
				OnUnloadInternal(EventArgs.Empty);
 | 
			
		||||
				OnUnload(EventArgs.Empty);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
@ -170,8 +169,8 @@ namespace OpenTK
 | 
			
		||||
			EnsureUndisposed();
 | 
			
		||||
			try {
 | 
			
		||||
				Visible = true;   // Make sure the GameWindow is visible.
 | 
			
		||||
				OnLoadInternal(EventArgs.Empty);
 | 
			
		||||
				OnResize(EventArgs.Empty);
 | 
			
		||||
				OnLoad(EventArgs.Empty);
 | 
			
		||||
				OnResize(null, EventArgs.Empty);
 | 
			
		||||
				Debug.Print("Entering main loop.");
 | 
			
		||||
				render_watch.Start();
 | 
			
		||||
				
 | 
			
		||||
@ -297,24 +296,11 @@ namespace OpenTK
 | 
			
		||||
			if (RenderFrame != null) RenderFrame(this, e);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		/// <summary> Called when the WindowInfo for this GameWindow has changed.</summary>
 | 
			
		||||
		/// <param name="e">Not used.</param>
 | 
			
		||||
		protected virtual void OnWindowInfoChanged(EventArgs e) { }
 | 
			
		||||
		
 | 
			
		||||
		protected override void OnResize(EventArgs e) {
 | 
			
		||||
			base.OnResize(e);
 | 
			
		||||
		protected override void OnResize(object sender, EventArgs e) {
 | 
			
		||||
			base.OnResize(sender, e);
 | 
			
		||||
			glContext.Update(base.WindowInfo);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		private void OnLoadInternal(EventArgs e)  { OnLoad(e); }
 | 
			
		||||
		
 | 
			
		||||
		private void OnRenderFrameInternal(FrameEventArgs e) { if (Exists && !isExiting) OnRenderFrame(e); }
 | 
			
		||||
		
 | 
			
		||||
		private void OnUnloadInternal(EventArgs e) { OnUnload(e); }
 | 
			
		||||
 | 
			
		||||
		private void OnWindowInfoChangedInternal(EventArgs e) {
 | 
			
		||||
			glContext.MakeCurrent(WindowInfo);
 | 
			
		||||
			OnWindowInfoChanged(e);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@ -92,9 +92,6 @@ namespace OpenTK {
 | 
			
		||||
		/// <summary> Processes pending window events. </summary>
 | 
			
		||||
		void ProcessEvents();
 | 
			
		||||
		
 | 
			
		||||
		/// <summary> Causes the window to be immediately redrawn. </summary>
 | 
			
		||||
		void Invalidate();
 | 
			
		||||
		
 | 
			
		||||
		/// <summary> Transforms the specified point from screen to client coordinates.  </summary>
 | 
			
		||||
		/// <param name="point"> A <see cref="System.Drawing.Point"/> to transform. </param>
 | 
			
		||||
		/// <returns> The point transformed to client coordinates. </returns>
 | 
			
		||||
 | 
			
		||||
@ -123,11 +123,6 @@ namespace OpenTK {
 | 
			
		||||
			ProcessEvents(false);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		/// <summary> Causes the window to be immediately redrawn. </summary>
 | 
			
		||||
		public void Invalidate() {
 | 
			
		||||
			implementation.Invalidate();
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		/// <summary> Gets or sets a <see cref="System.Drawing.Rectangle"/> structure that contains the external bounds of this window, in screen coordinates.
 | 
			
		||||
		/// External bounds include the title bar, borders and drawing area of the window. </summary>
 | 
			
		||||
		public Rectangle Bounds {
 | 
			
		||||
@ -314,80 +309,71 @@ namespace OpenTK {
 | 
			
		||||
		
 | 
			
		||||
		/// <summary> Called when the NativeWindow has closed. </summary>
 | 
			
		||||
		/// <param name="e">Not used.</param>
 | 
			
		||||
		protected virtual void OnClosed(EventArgs e) {
 | 
			
		||||
		protected virtual void OnClosed(object sender, EventArgs e) {
 | 
			
		||||
			if (Closed != null) Closed(this, e);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		/// <summary> Called when the NativeWindow is about to close. </summary>
 | 
			
		||||
		/// <param name="e"> The <see cref="System.ComponentModel.CancelEventArgs" /> for this event.
 | 
			
		||||
		/// Set e.Cancel to true in order to stop the NativeWindow from closing.</param>
 | 
			
		||||
		protected virtual void OnClosing(CancelEventArgs e) {
 | 
			
		||||
		protected virtual void OnClosing(object sender, CancelEventArgs e) {
 | 
			
		||||
			if (Closing != null) Closing(this, e);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		/// <summary> Called when the NativeWindow is disposed. </summary>
 | 
			
		||||
		/// <param name="e">Not used.</param>
 | 
			
		||||
		protected virtual void OnDisposed(EventArgs e) {
 | 
			
		||||
		protected virtual void OnDisposed(object sender, EventArgs e) {
 | 
			
		||||
			if (Disposed != null) Disposed(this, e);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		/// <summary> Called when the <see cref="OpenTK.INativeWindow.Focused"/> property of the NativeWindow has changed. </summary>
 | 
			
		||||
		/// <param name="e">Not used.</param>
 | 
			
		||||
		protected virtual void OnFocusedChanged(EventArgs e) {
 | 
			
		||||
		protected virtual void OnFocusedChanged(object sender, EventArgs e) {
 | 
			
		||||
			if (FocusedChanged != null) FocusedChanged(this, e);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		/// <summary> Called when the <see cref="OpenTK.INativeWindow.Icon"/> property of the NativeWindow has changed. </summary>
 | 
			
		||||
		/// <param name="e">Not used.</param>
 | 
			
		||||
		protected virtual void OnIconChanged(EventArgs e) {
 | 
			
		||||
		protected virtual void OnIconChanged(object sender, EventArgs e) {
 | 
			
		||||
			if (IconChanged != null) IconChanged(this, e);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		/// <summary> Called when a character is typed. </summary>
 | 
			
		||||
		/// <param name="e">The <see cref="OpenTK.KeyPressEventArgs"/> for this event.</param>
 | 
			
		||||
		protected virtual void OnKeyPress(KeyPressEventArgs e) {
 | 
			
		||||
		protected virtual void OnKeyPress(object sender, KeyPressEventArgs e) {
 | 
			
		||||
			if (KeyPress != null) KeyPress(this, e);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		/// <summary> Called when the NativeWindow is moved. </summary>
 | 
			
		||||
		/// <param name="e">Not used.</param>
 | 
			
		||||
		protected virtual void OnMove(EventArgs e) {
 | 
			
		||||
		protected virtual void OnMove(object sender, EventArgs e) {
 | 
			
		||||
			if (Move != null) Move(this, e);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		/// <summary> Called whenever the mouse cursor reenters the window <see cref="Bounds"/>. </summary>
 | 
			
		||||
		/// <param name="e">Not used.</param>
 | 
			
		||||
		protected virtual void OnMouseEnter(EventArgs e) {
 | 
			
		||||
		protected virtual void OnMouseEnter(object sender, EventArgs e) {
 | 
			
		||||
			if (MouseEnter != null) MouseEnter(this, e);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		/// <summary> Called whenever the mouse cursor leaves the window <see cref="Bounds"/>. </summary>
 | 
			
		||||
		/// <param name="e">Not used.</param>
 | 
			
		||||
		protected virtual void OnMouseLeave(EventArgs e) {
 | 
			
		||||
		protected virtual void OnMouseLeave(object sender, EventArgs e) {
 | 
			
		||||
			if (MouseLeave != null) MouseLeave(this, e);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		/// <summary> Called when the NativeWindow is resized. </summary>
 | 
			
		||||
		/// <param name="e">Not used.</param>
 | 
			
		||||
		protected virtual void OnResize(EventArgs e) {
 | 
			
		||||
		protected virtual void OnResize(object sender, EventArgs e) {
 | 
			
		||||
			if (Resize != null) Resize(this, e);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		/// <summary> Called when the <see cref="OpenTK.INativeWindow.Title"/> property of the NativeWindow has changed. </summary>
 | 
			
		||||
		/// <param name="e">Not used.</param>
 | 
			
		||||
		protected virtual void OnTitleChanged(EventArgs e) {
 | 
			
		||||
		protected virtual void OnTitleChanged(object sender, EventArgs e) {
 | 
			
		||||
			if (TitleChanged != null) TitleChanged(this, e);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		/// <summary> Called when the <see cref="OpenTK.INativeWindow.Visible"/> property of the NativeWindow has changed. </summary>
 | 
			
		||||
		/// <param name="e">Not used.</param>
 | 
			
		||||
		protected virtual void OnVisibleChanged(EventArgs e) {
 | 
			
		||||
		protected virtual void OnVisibleChanged(object sender, EventArgs e) {
 | 
			
		||||
			if (VisibleChanged != null) VisibleChanged(this, e);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		/// <summary> Called when the WindowState of this NativeWindow has changed. </summary>
 | 
			
		||||
		/// <param name="e">Not used.</param>
 | 
			
		||||
		protected virtual void OnWindowStateChanged(EventArgs e) {
 | 
			
		||||
		protected virtual void OnWindowStateChanged(object sender, EventArgs e) {
 | 
			
		||||
			if (WindowStateChanged != null) WindowStateChanged(this, e);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
@ -400,68 +386,44 @@ namespace OpenTK {
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		private void OnClosedInternal(object sender, EventArgs e)  {
 | 
			
		||||
			OnClosed(e);
 | 
			
		||||
			OnClosed(null, e);
 | 
			
		||||
			Events = false;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		private void OnClosingInternal(object sender, CancelEventArgs e) { OnClosing(e); }
 | 
			
		||||
		
 | 
			
		||||
		private void OnDisposedInternal(object sender, EventArgs e) { OnDisposed(e); }
 | 
			
		||||
		
 | 
			
		||||
		private void OnFocusedChangedInternal(object sender, EventArgs e) { OnFocusedChanged(e); }
 | 
			
		||||
 | 
			
		||||
		private void OnIconChangedInternal(object sender, EventArgs e) { OnIconChanged(e); }
 | 
			
		||||
 | 
			
		||||
		private void OnKeyPressInternal(object sender, KeyPressEventArgs e) { OnKeyPress(e); }
 | 
			
		||||
		
 | 
			
		||||
		private void OnMouseEnterInternal(object sender, EventArgs e) { OnMouseEnter(e); }
 | 
			
		||||
		
 | 
			
		||||
		private void OnMouseLeaveInternal(object sender, EventArgs e) { OnMouseLeave(e); }
 | 
			
		||||
		
 | 
			
		||||
		private void OnMoveInternal(object sender, EventArgs e) { OnMove(e); }
 | 
			
		||||
 | 
			
		||||
		private void OnResizeInternal(object sender, EventArgs e) { OnResize(e); }
 | 
			
		||||
		
 | 
			
		||||
		private void OnTitleChangedInternal(object sender, EventArgs e) { OnTitleChanged(e); }
 | 
			
		||||
 | 
			
		||||
		private void OnVisibleChangedInternal(object sender, EventArgs e) { OnVisibleChanged(e); }
 | 
			
		||||
		
 | 
			
		||||
		private void OnWindowStateChangedInternal(object sender, EventArgs e) { OnWindowStateChanged(e); }
 | 
			
		||||
		
 | 
			
		||||
		private bool Events {
 | 
			
		||||
			set {
 | 
			
		||||
				if (value) {
 | 
			
		||||
					if (events) {
 | 
			
		||||
						throw new InvalidOperationException("Event propagation is already enabled.");
 | 
			
		||||
					}
 | 
			
		||||
					implementation.Closed += OnClosedInternal;
 | 
			
		||||
					implementation.Closing += OnClosingInternal;
 | 
			
		||||
					implementation.Disposed += OnDisposedInternal;
 | 
			
		||||
					implementation.FocusedChanged += OnFocusedChangedInternal;
 | 
			
		||||
					implementation.IconChanged += OnIconChangedInternal;
 | 
			
		||||
					implementation.KeyPress += OnKeyPressInternal;
 | 
			
		||||
					implementation.MouseEnter += OnMouseEnterInternal;
 | 
			
		||||
					implementation.MouseLeave += OnMouseLeaveInternal;
 | 
			
		||||
					implementation.Move += OnMoveInternal;
 | 
			
		||||
					implementation.Resize += OnResizeInternal;
 | 
			
		||||
					implementation.TitleChanged += OnTitleChangedInternal;
 | 
			
		||||
					implementation.VisibleChanged += OnVisibleChangedInternal;
 | 
			
		||||
					implementation.WindowStateChanged += OnWindowStateChangedInternal;
 | 
			
		||||
					implementation.Closed += OnClosed;
 | 
			
		||||
					implementation.Closing += OnClosing;
 | 
			
		||||
					implementation.Disposed += OnDisposed;
 | 
			
		||||
					implementation.FocusedChanged += OnFocusedChanged;
 | 
			
		||||
					implementation.IconChanged += OnIconChanged;
 | 
			
		||||
					implementation.KeyPress += OnKeyPress;
 | 
			
		||||
					implementation.MouseEnter += OnMouseEnter;
 | 
			
		||||
					implementation.MouseLeave += OnMouseLeave;
 | 
			
		||||
					implementation.Move += OnMove;
 | 
			
		||||
					implementation.Resize += OnResize;
 | 
			
		||||
					implementation.TitleChanged += OnTitleChanged;
 | 
			
		||||
					implementation.VisibleChanged += OnVisibleChanged;
 | 
			
		||||
					implementation.WindowStateChanged += OnWindowStateChanged;
 | 
			
		||||
					events = true;
 | 
			
		||||
				} else if (events) {
 | 
			
		||||
					implementation.Closed -= OnClosedInternal;
 | 
			
		||||
					implementation.Closing -= OnClosingInternal;
 | 
			
		||||
					implementation.Disposed -= OnDisposedInternal;
 | 
			
		||||
					implementation.FocusedChanged -= OnFocusedChangedInternal;
 | 
			
		||||
					implementation.IconChanged -= OnIconChangedInternal;
 | 
			
		||||
					implementation.KeyPress -= OnKeyPressInternal;
 | 
			
		||||
					implementation.MouseEnter -= OnMouseEnterInternal;
 | 
			
		||||
					implementation.MouseLeave -= OnMouseLeaveInternal;
 | 
			
		||||
					implementation.Move -= OnMoveInternal;
 | 
			
		||||
					implementation.Resize -= OnResizeInternal;
 | 
			
		||||
					implementation.TitleChanged -= OnTitleChangedInternal;
 | 
			
		||||
					implementation.VisibleChanged -= OnVisibleChangedInternal;
 | 
			
		||||
					implementation.WindowStateChanged -= OnWindowStateChangedInternal;
 | 
			
		||||
					implementation.Closed -= OnClosed;
 | 
			
		||||
					implementation.Closing -= OnClosing;
 | 
			
		||||
					implementation.Disposed -= OnDisposed;
 | 
			
		||||
					implementation.FocusedChanged -= OnFocusedChanged;
 | 
			
		||||
					implementation.IconChanged -= OnIconChanged;
 | 
			
		||||
					implementation.KeyPress -= OnKeyPress;
 | 
			
		||||
					implementation.MouseEnter -= OnMouseEnter;
 | 
			
		||||
					implementation.MouseLeave -= OnMouseLeave;
 | 
			
		||||
					implementation.Move -= OnMove;
 | 
			
		||||
					implementation.Resize -= OnResize;
 | 
			
		||||
					implementation.TitleChanged -= OnTitleChanged;
 | 
			
		||||
					implementation.VisibleChanged -= OnVisibleChanged;
 | 
			
		||||
					implementation.WindowStateChanged -= OnWindowStateChanged;
 | 
			
		||||
					events = false;
 | 
			
		||||
				} else {
 | 
			
		||||
					throw new InvalidOperationException("Event propagation is already disabled.");
 | 
			
		||||
 | 
			
		||||
@ -650,10 +650,6 @@ namespace OpenTK.Platform.MacOS
 | 
			
		||||
		{
 | 
			
		||||
			Application.ProcessEvents();
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		public void Invalidate() {
 | 
			
		||||
			// TODO: what do we need to do here?
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public Point PointToClient(Point point)
 | 
			
		||||
		{
 | 
			
		||||
 | 
			
		||||
@ -714,9 +714,6 @@ namespace OpenTK.Platform.Windows
 | 
			
		||||
				API.DispatchMessage(ref msg);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		public void Invalidate() {
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public IWindowInfo WindowInfo {
 | 
			
		||||
			get { return child_window; }
 | 
			
		||||
 | 
			
		||||
@ -432,22 +432,6 @@ namespace OpenTK.Platform.X11 {
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		public void Invalidate() {
 | 
			
		||||
			XEvent xev = new XEvent();
 | 
			
		||||
			xev.ExposeEvent.type = XEventName.Expose;
 | 
			
		||||
			xev.ExposeEvent.display = window.Display;
 | 
			
		||||
			xev.ExposeEvent.window = window.WindowHandle;
 | 
			
		||||
			xev.ExposeEvent.x = 0;
 | 
			
		||||
			xev.ExposeEvent.y = 0;
 | 
			
		||||
			xev.ExposeEvent.width = client_rectangle.Width;
 | 
			
		||||
			xev.ExposeEvent.height = client_rectangle.Height;
 | 
			
		||||
			xev.ExposeEvent.count = 0;
 | 
			
		||||
			
 | 
			
		||||
			API.XSendEvent(window.Display, window.WindowHandle, false,
 | 
			
		||||
			               EventMask.ExposureMask, ref xev);
 | 
			
		||||
			API.XFlush(window.Display);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		public Rectangle Bounds {
 | 
			
		||||
			get { return bounds; }
 | 
			
		||||
			set {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user