mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-14 18:15:28 -04: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;
|
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 );
|
Brush brush = GetOrCreateBrush( colour );
|
||||||
g.FillRectangle( brush, x, y, width, height );
|
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 ) ) {
|
using( Pen pen = new Pen( colour, lineWidth ) ) {
|
||||||
pen.Alignment = PenAlignment.Inset;
|
pen.Alignment = PenAlignment.Inset;
|
||||||
g.DrawRectangle( pen, x, y, width, height );
|
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();
|
GraphicsPath path = new GraphicsPath();
|
||||||
float x1 = x, y1 = y, x2 = x + width, y2 = y + height;
|
float x1 = x, y1 = y, x2 = x + width, y2 = y + height;
|
||||||
|
|
||||||
@ -107,11 +107,11 @@ namespace ClassicalSharp {
|
|||||||
path.Dispose();
|
path.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Clear( Color colour ) {
|
public override void Clear( FastColour colour ) {
|
||||||
g.Clear( 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;
|
g.SmoothingMode = SmoothingMode.None;
|
||||||
Brush brush = GetOrCreateBrush( colour );
|
Brush brush = GetOrCreateBrush( colour );
|
||||||
g.FillRectangle( brush, x, y, width, height );
|
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
|
/// <summary> Draws a 2D flat rectangle of the specified dimensions at the
|
||||||
/// specified coordinates in the currently bound bitmap. </summary>
|
/// 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
|
/// <summary> Draws the outline of a 2D flat rectangle of the specified dimensions
|
||||||
/// at the specified coordinates in the currently bound bitmap. </summary>
|
/// 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
|
/// <summary> Draws a 2D rectangle with rounded borders of the specified dimensions
|
||||||
/// at the specified coordinates in the currently bound bitmap. </summary>
|
/// 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>
|
/// <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>
|
/// <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>
|
/// <summary> Disposes of any resources used by this class that are associated with the underlying bitmap. </summary>
|
||||||
public abstract void Dispose();
|
public abstract void Dispose();
|
||||||
@ -85,12 +85,11 @@ namespace ClassicalSharp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected List<TextPart> parts = new List<TextPart>( 64 );
|
protected List<TextPart> parts = new List<TextPart>( 64 );
|
||||||
protected static Color white = Color.FromArgb( 255, 255, 255 );
|
|
||||||
protected struct TextPart {
|
protected struct TextPart {
|
||||||
public string Text;
|
public string Text;
|
||||||
public Color TextColour;
|
public FastColour TextColour;
|
||||||
|
|
||||||
public TextPart( string text, Color col ) {
|
public TextPart( string text, FastColour col ) {
|
||||||
Text = text;
|
Text = text;
|
||||||
TextColour = col;
|
TextColour = col;
|
||||||
}
|
}
|
||||||
@ -100,7 +99,7 @@ namespace ClassicalSharp {
|
|||||||
parts.Clear();
|
parts.Clear();
|
||||||
if( String.IsNullOrEmpty( value ) ) {
|
if( String.IsNullOrEmpty( value ) ) {
|
||||||
} else if( value.IndexOf( '&' ) == -1 ) {
|
} else if( value.IndexOf( '&' ) == -1 ) {
|
||||||
parts.Add( new TextPart( value, white ) );
|
parts.Add( new TextPart( value, FastColour.White ) );
|
||||||
} else {
|
} else {
|
||||||
SplitText( value );
|
SplitText( value );
|
||||||
}
|
}
|
||||||
@ -114,7 +113,7 @@ namespace ClassicalSharp {
|
|||||||
|
|
||||||
if( partLength > 0 ) {
|
if( partLength > 0 ) {
|
||||||
string part = value.Substring( i, partLength );
|
string part = value.Substring( i, partLength );
|
||||||
Color col = Color.FromArgb(
|
FastColour col = new FastColour(
|
||||||
191 * ((code >> 2) & 1) + 64 * (code >> 3),
|
191 * ((code >> 2) & 1) + 64 * (code >> 3),
|
||||||
191 * ((code >> 1) & 1) + 64 * (code >> 3),
|
191 * ((code >> 1) & 1) + 64 * (code >> 3),
|
||||||
191 * ((code >> 0) & 1) + 64 * (code >> 3) );
|
191 * ((code >> 0) & 1) + 64 * (code >> 3) );
|
||||||
|
@ -39,7 +39,7 @@ namespace ClassicalSharp {
|
|||||||
using( Bitmap bmp = IDrawer2D.CreatePow2Bitmap( size ) ) {
|
using( Bitmap bmp = IDrawer2D.CreatePow2Bitmap( size ) ) {
|
||||||
using( IDrawer2D drawer = game.Drawer2D ) {
|
using( IDrawer2D drawer = game.Drawer2D ) {
|
||||||
drawer.SetBitmap( bmp );
|
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 );
|
progressBoxTexture = drawer.Make2DTexture( bmp, size, (int)progX, (int)progY );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ namespace ClassicalSharp {
|
|||||||
} else if( path.EndsWith( ".fcm" ) ) {
|
} else if( path.EndsWith( ".fcm" ) ) {
|
||||||
mapFile = new MapFcm3();
|
mapFile = new MapFcm3();
|
||||||
} else if( path.EndsWith( ".cw" ) ) {
|
} else if( path.EndsWith( ".cw" ) ) {
|
||||||
mapFile = new MapCw();
|
mapFile = new MapCw();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -29,7 +29,7 @@ namespace ClassicalSharp {
|
|||||||
Make( 140, -50, "Mouse sensitivity", Anchor.Centre, OnWidgetClick,
|
Make( 140, -50, "Mouse sensitivity", Anchor.Centre, OnWidgetClick,
|
||||||
g => g.MouseSensitivity.ToString(),
|
g => g.MouseSensitivity.ToString(),
|
||||||
(g, v) => { g.MouseSensitivity = Int32.Parse( v );
|
(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,
|
Make( 140, 0, "Chat font size", Anchor.Centre, OnWidgetClick,
|
||||||
g => g.Chat.FontSize.ToString(),
|
g => g.Chat.FontSize.ToString(),
|
||||||
|
@ -301,8 +301,8 @@ namespace ClassicalSharp {
|
|||||||
Graphics.SetMatrixMode( MatrixType.Modelview );
|
Graphics.SetMatrixMode( MatrixType.Modelview );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnResize( EventArgs e ) {
|
protected override void OnResize( object sender, EventArgs e ) {
|
||||||
base.OnResize( e );
|
base.OnResize( sender, e );
|
||||||
Graphics.OnWindowResize( this );
|
Graphics.OnWindowResize( this );
|
||||||
UpdateProjection();
|
UpdateProjection();
|
||||||
if( activeScreen != null ) {
|
if( activeScreen != null ) {
|
||||||
|
@ -38,9 +38,9 @@ namespace ClassicalSharp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public FastColour( int argb ) {
|
public FastColour( int argb ) {
|
||||||
A = (byte)( argb >> 24 );
|
A = (byte)(argb >> 24);
|
||||||
R = (byte)( argb >> 16 );
|
R = (byte)(argb >> 16);
|
||||||
G = (byte)( argb >> 8 );
|
G = (byte)(argb >> 8);
|
||||||
B = (byte)argb;
|
B = (byte)argb;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,14 +53,14 @@ namespace ClassicalSharp {
|
|||||||
|
|
||||||
public static FastColour Scale( FastColour value, float t ) {
|
public static FastColour Scale( FastColour value, float t ) {
|
||||||
FastColour result = value;
|
FastColour result = value;
|
||||||
result.R = (byte)( value.R * t );
|
result.R = (byte)(value.R * t);
|
||||||
result.G = (byte)( value.G * t );
|
result.G = (byte)(value.G * t);
|
||||||
result.B = (byte)( value.B * t );
|
result.B = (byte)(value.B * t);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void GetShaded( FastColour normal, ref FastColour xSide,
|
public static void GetShaded( FastColour normal, ref FastColour xSide,
|
||||||
ref FastColour zSide, ref FastColour yBottom ) {
|
ref FastColour zSide, ref FastColour yBottom ) {
|
||||||
xSide = FastColour.Scale( normal, 0.6f );
|
xSide = FastColour.Scale( normal, 0.6f );
|
||||||
zSide = FastColour.Scale( normal, 0.8f );
|
zSide = FastColour.Scale( normal, 0.8f );
|
||||||
yBottom = FastColour.Scale( normal, 0.5f );
|
yBottom = FastColour.Scale( normal, 0.5f );
|
||||||
|
@ -68,7 +68,7 @@ namespace Launcher2 {
|
|||||||
MakeTextInputAt( Get( widgetIndex ), 270, -25, 5 );
|
MakeTextInputAt( Get( widgetIndex ), 270, -25, 5 );
|
||||||
|
|
||||||
MakeTextAt( inputFont, "../play/", -210, 55 );
|
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( "Connect", 100, 30, 180, 5, ConnectToServer );
|
||||||
MakeButtonAt( "Back", 70, 30, 195, 50,
|
MakeButtonAt( "Back", 70, 30, 195, 50,
|
||||||
|
@ -88,7 +88,6 @@ namespace Launcher2 {
|
|||||||
Dirty = false;
|
Dirty = false;
|
||||||
screen.Dirty = false;
|
screen.Dirty = false;
|
||||||
screenGraphics.DrawImage( Framebuffer, 0, 0, Framebuffer.Width, Framebuffer.Height );
|
screenGraphics.DrawImage( Framebuffer, 0, 0, Framebuffer.Width, Framebuffer.Height );
|
||||||
Window.Invalidate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static FastColour clearColour = new FastColour( 30, 30, 30 );
|
internal static FastColour clearColour = new FastColour( 30, 30, 30 );
|
||||||
|
@ -24,13 +24,13 @@ namespace Launcher2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static string Decode( string encoded, string key ) {
|
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;
|
byte[] data;
|
||||||
try {
|
try {
|
||||||
data = Convert.FromBase64String( encoded );
|
data = Convert.FromBase64String( encoded );
|
||||||
} catch( FormatException ) {
|
} catch( FormatException ) {
|
||||||
return null;
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -40,7 +40,7 @@ namespace Launcher2 {
|
|||||||
c[i] = (char)data[i];
|
c[i] = (char)data[i];
|
||||||
return new String( c );
|
return new String( c );
|
||||||
} catch {
|
} catch {
|
||||||
if( encoded.Length > 64 || data.Length > 64 ) return null;
|
if( encoded.Length > 64 || data.Length > 64 ) return "";
|
||||||
|
|
||||||
char[] c = new char[data.Length];
|
char[] c = new char[data.Length];
|
||||||
for( int i = 0; i < c.Length; i++ )
|
for( int i = 0; i < c.Length; i++ )
|
||||||
|
@ -99,7 +99,6 @@ namespace OpenTK
|
|||||||
glContext.MakeCurrent(WindowInfo);
|
glContext.MakeCurrent(WindowInfo);
|
||||||
glContext.LoadAll();
|
glContext.LoadAll();
|
||||||
VSync = true;
|
VSync = true;
|
||||||
//glWindow.WindowInfoChanged += delegate(object sender, EventArgs e) { OnWindowInfoChangedInternal(e); };
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Debug.Print(e.ToString());
|
Debug.Print(e.ToString());
|
||||||
base.Dispose();
|
base.Dispose();
|
||||||
@ -141,11 +140,11 @@ namespace OpenTK
|
|||||||
/// <param name="e">
|
/// <param name="e">
|
||||||
/// The <see cref="System.ComponentModel.CancelEventArgs" /> for this event.
|
/// The <see cref="System.ComponentModel.CancelEventArgs" /> for this event.
|
||||||
/// Set e.Cancel to true in order to stop the GameWindow from closing.</param>
|
/// Set e.Cancel to true in order to stop the GameWindow from closing.</param>
|
||||||
protected override void OnClosing(System.ComponentModel.CancelEventArgs e) {
|
protected override void OnClosing(object sender, System.ComponentModel.CancelEventArgs e) {
|
||||||
base.OnClosing(e);
|
base.OnClosing(sender, e);
|
||||||
if (!e.Cancel) {
|
if (!e.Cancel) {
|
||||||
isExiting = true;
|
isExiting = true;
|
||||||
OnUnloadInternal(EventArgs.Empty);
|
OnUnload(EventArgs.Empty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,8 +169,8 @@ namespace OpenTK
|
|||||||
EnsureUndisposed();
|
EnsureUndisposed();
|
||||||
try {
|
try {
|
||||||
Visible = true; // Make sure the GameWindow is visible.
|
Visible = true; // Make sure the GameWindow is visible.
|
||||||
OnLoadInternal(EventArgs.Empty);
|
OnLoad(EventArgs.Empty);
|
||||||
OnResize(EventArgs.Empty);
|
OnResize(null, EventArgs.Empty);
|
||||||
Debug.Print("Entering main loop.");
|
Debug.Print("Entering main loop.");
|
||||||
render_watch.Start();
|
render_watch.Start();
|
||||||
|
|
||||||
@ -297,24 +296,11 @@ namespace OpenTK
|
|||||||
if (RenderFrame != null) RenderFrame(this, e);
|
if (RenderFrame != null) RenderFrame(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Called when the WindowInfo for this GameWindow has changed.</summary>
|
protected override void OnResize(object sender, EventArgs e) {
|
||||||
/// <param name="e">Not used.</param>
|
base.OnResize(sender, e);
|
||||||
protected virtual void OnWindowInfoChanged(EventArgs e) { }
|
|
||||||
|
|
||||||
protected override void OnResize(EventArgs e) {
|
|
||||||
base.OnResize(e);
|
|
||||||
glContext.Update(base.WindowInfo);
|
glContext.Update(base.WindowInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnLoadInternal(EventArgs e) { OnLoad(e); }
|
|
||||||
|
|
||||||
private void OnRenderFrameInternal(FrameEventArgs e) { if (Exists && !isExiting) OnRenderFrame(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>
|
/// <summary> Processes pending window events. </summary>
|
||||||
void ProcessEvents();
|
void ProcessEvents();
|
||||||
|
|
||||||
/// <summary> Causes the window to be immediately redrawn. </summary>
|
|
||||||
void Invalidate();
|
|
||||||
|
|
||||||
/// <summary> Transforms the specified point from screen to client coordinates. </summary>
|
/// <summary> Transforms the specified point from screen to client coordinates. </summary>
|
||||||
/// <param name="point"> A <see cref="System.Drawing.Point"/> to transform. </param>
|
/// <param name="point"> A <see cref="System.Drawing.Point"/> to transform. </param>
|
||||||
/// <returns> The point transformed to client coordinates. </returns>
|
/// <returns> The point transformed to client coordinates. </returns>
|
||||||
|
@ -123,11 +123,6 @@ namespace OpenTK {
|
|||||||
ProcessEvents(false);
|
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.
|
/// <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>
|
/// External bounds include the title bar, borders and drawing area of the window. </summary>
|
||||||
public Rectangle Bounds {
|
public Rectangle Bounds {
|
||||||
@ -314,80 +309,71 @@ namespace OpenTK {
|
|||||||
|
|
||||||
/// <summary> Called when the NativeWindow has closed. </summary>
|
/// <summary> Called when the NativeWindow has closed. </summary>
|
||||||
/// <param name="e">Not used.</param>
|
/// <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);
|
if (Closed != null) Closed(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Called when the NativeWindow is about to close. </summary>
|
/// <summary> Called when the NativeWindow is about to close. </summary>
|
||||||
/// <param name="e"> The <see cref="System.ComponentModel.CancelEventArgs" /> for this event.
|
/// <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>
|
/// 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);
|
if (Closing != null) Closing(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Called when the NativeWindow is disposed. </summary>
|
/// <summary> Called when the NativeWindow is disposed. </summary>
|
||||||
/// <param name="e">Not used.</param>
|
protected virtual void OnDisposed(object sender, EventArgs e) {
|
||||||
protected virtual void OnDisposed(EventArgs e) {
|
|
||||||
if (Disposed != null) Disposed(this, e);
|
if (Disposed != null) Disposed(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Called when the <see cref="OpenTK.INativeWindow.Focused"/> property of the NativeWindow has changed. </summary>
|
/// <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(object sender, EventArgs e) {
|
||||||
protected virtual void OnFocusedChanged(EventArgs e) {
|
|
||||||
if (FocusedChanged != null) FocusedChanged(this, e);
|
if (FocusedChanged != null) FocusedChanged(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Called when the <see cref="OpenTK.INativeWindow.Icon"/> property of the NativeWindow has changed. </summary>
|
/// <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(object sender, EventArgs e) {
|
||||||
protected virtual void OnIconChanged(EventArgs e) {
|
|
||||||
if (IconChanged != null) IconChanged(this, e);
|
if (IconChanged != null) IconChanged(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Called when a character is typed. </summary>
|
/// <summary> Called when a character is typed. </summary>
|
||||||
/// <param name="e">The <see cref="OpenTK.KeyPressEventArgs"/> for this event.</param>
|
/// <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);
|
if (KeyPress != null) KeyPress(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Called when the NativeWindow is moved. </summary>
|
/// <summary> Called when the NativeWindow is moved. </summary>
|
||||||
/// <param name="e">Not used.</param>
|
protected virtual void OnMove(object sender, EventArgs e) {
|
||||||
protected virtual void OnMove(EventArgs e) {
|
|
||||||
if (Move != null) Move(this, e);
|
if (Move != null) Move(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Called whenever the mouse cursor reenters the window <see cref="Bounds"/>. </summary>
|
/// <summary> Called whenever the mouse cursor reenters the window <see cref="Bounds"/>. </summary>
|
||||||
/// <param name="e">Not used.</param>
|
protected virtual void OnMouseEnter(object sender, EventArgs e) {
|
||||||
protected virtual void OnMouseEnter(EventArgs e) {
|
|
||||||
if (MouseEnter != null) MouseEnter(this, e);
|
if (MouseEnter != null) MouseEnter(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Called whenever the mouse cursor leaves the window <see cref="Bounds"/>. </summary>
|
/// <summary> Called whenever the mouse cursor leaves the window <see cref="Bounds"/>. </summary>
|
||||||
/// <param name="e">Not used.</param>
|
protected virtual void OnMouseLeave(object sender, EventArgs e) {
|
||||||
protected virtual void OnMouseLeave(EventArgs e) {
|
|
||||||
if (MouseLeave != null) MouseLeave(this, e);
|
if (MouseLeave != null) MouseLeave(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Called when the NativeWindow is resized. </summary>
|
/// <summary> Called when the NativeWindow is resized. </summary>
|
||||||
/// <param name="e">Not used.</param>
|
/// <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);
|
if (Resize != null) Resize(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Called when the <see cref="OpenTK.INativeWindow.Title"/> property of the NativeWindow has changed. </summary>
|
/// <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(object sender, EventArgs e) {
|
||||||
protected virtual void OnTitleChanged(EventArgs e) {
|
|
||||||
if (TitleChanged != null) TitleChanged(this, e);
|
if (TitleChanged != null) TitleChanged(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Called when the <see cref="OpenTK.INativeWindow.Visible"/> property of the NativeWindow has changed. </summary>
|
/// <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(object sender, EventArgs e) {
|
||||||
protected virtual void OnVisibleChanged(EventArgs e) {
|
|
||||||
if (VisibleChanged != null) VisibleChanged(this, e);
|
if (VisibleChanged != null) VisibleChanged(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Called when the WindowState of this NativeWindow has changed. </summary>
|
/// <summary> Called when the WindowState of this NativeWindow has changed. </summary>
|
||||||
/// <param name="e">Not used.</param>
|
protected virtual void OnWindowStateChanged(object sender, EventArgs e) {
|
||||||
protected virtual void OnWindowStateChanged(EventArgs e) {
|
|
||||||
if (WindowStateChanged != null) WindowStateChanged(this, e);
|
if (WindowStateChanged != null) WindowStateChanged(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -400,68 +386,44 @@ namespace OpenTK {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void OnClosedInternal(object sender, EventArgs e) {
|
private void OnClosedInternal(object sender, EventArgs e) {
|
||||||
OnClosed(e);
|
OnClosed(null, e);
|
||||||
Events = false;
|
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 {
|
private bool Events {
|
||||||
set {
|
set {
|
||||||
if (value) {
|
if (value) {
|
||||||
if (events) {
|
if (events) {
|
||||||
throw new InvalidOperationException("Event propagation is already enabled.");
|
throw new InvalidOperationException("Event propagation is already enabled.");
|
||||||
}
|
}
|
||||||
implementation.Closed += OnClosedInternal;
|
implementation.Closed += OnClosed;
|
||||||
implementation.Closing += OnClosingInternal;
|
implementation.Closing += OnClosing;
|
||||||
implementation.Disposed += OnDisposedInternal;
|
implementation.Disposed += OnDisposed;
|
||||||
implementation.FocusedChanged += OnFocusedChangedInternal;
|
implementation.FocusedChanged += OnFocusedChanged;
|
||||||
implementation.IconChanged += OnIconChangedInternal;
|
implementation.IconChanged += OnIconChanged;
|
||||||
implementation.KeyPress += OnKeyPressInternal;
|
implementation.KeyPress += OnKeyPress;
|
||||||
implementation.MouseEnter += OnMouseEnterInternal;
|
implementation.MouseEnter += OnMouseEnter;
|
||||||
implementation.MouseLeave += OnMouseLeaveInternal;
|
implementation.MouseLeave += OnMouseLeave;
|
||||||
implementation.Move += OnMoveInternal;
|
implementation.Move += OnMove;
|
||||||
implementation.Resize += OnResizeInternal;
|
implementation.Resize += OnResize;
|
||||||
implementation.TitleChanged += OnTitleChangedInternal;
|
implementation.TitleChanged += OnTitleChanged;
|
||||||
implementation.VisibleChanged += OnVisibleChangedInternal;
|
implementation.VisibleChanged += OnVisibleChanged;
|
||||||
implementation.WindowStateChanged += OnWindowStateChangedInternal;
|
implementation.WindowStateChanged += OnWindowStateChanged;
|
||||||
events = true;
|
events = true;
|
||||||
} else if (events) {
|
} else if (events) {
|
||||||
implementation.Closed -= OnClosedInternal;
|
implementation.Closed -= OnClosed;
|
||||||
implementation.Closing -= OnClosingInternal;
|
implementation.Closing -= OnClosing;
|
||||||
implementation.Disposed -= OnDisposedInternal;
|
implementation.Disposed -= OnDisposed;
|
||||||
implementation.FocusedChanged -= OnFocusedChangedInternal;
|
implementation.FocusedChanged -= OnFocusedChanged;
|
||||||
implementation.IconChanged -= OnIconChangedInternal;
|
implementation.IconChanged -= OnIconChanged;
|
||||||
implementation.KeyPress -= OnKeyPressInternal;
|
implementation.KeyPress -= OnKeyPress;
|
||||||
implementation.MouseEnter -= OnMouseEnterInternal;
|
implementation.MouseEnter -= OnMouseEnter;
|
||||||
implementation.MouseLeave -= OnMouseLeaveInternal;
|
implementation.MouseLeave -= OnMouseLeave;
|
||||||
implementation.Move -= OnMoveInternal;
|
implementation.Move -= OnMove;
|
||||||
implementation.Resize -= OnResizeInternal;
|
implementation.Resize -= OnResize;
|
||||||
implementation.TitleChanged -= OnTitleChangedInternal;
|
implementation.TitleChanged -= OnTitleChanged;
|
||||||
implementation.VisibleChanged -= OnVisibleChangedInternal;
|
implementation.VisibleChanged -= OnVisibleChanged;
|
||||||
implementation.WindowStateChanged -= OnWindowStateChangedInternal;
|
implementation.WindowStateChanged -= OnWindowStateChanged;
|
||||||
events = false;
|
events = false;
|
||||||
} else {
|
} else {
|
||||||
throw new InvalidOperationException("Event propagation is already disabled.");
|
throw new InvalidOperationException("Event propagation is already disabled.");
|
||||||
|
@ -651,10 +651,6 @@ namespace OpenTK.Platform.MacOS
|
|||||||
Application.ProcessEvents();
|
Application.ProcessEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Invalidate() {
|
|
||||||
// TODO: what do we need to do here?
|
|
||||||
}
|
|
||||||
|
|
||||||
public Point PointToClient(Point point)
|
public Point PointToClient(Point point)
|
||||||
{
|
{
|
||||||
IntPtr handle = window.WindowRef;
|
IntPtr handle = window.WindowRef;
|
||||||
|
@ -715,9 +715,6 @@ namespace OpenTK.Platform.Windows
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Invalidate() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public IWindowInfo WindowInfo {
|
public IWindowInfo WindowInfo {
|
||||||
get { return child_window; }
|
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 {
|
public Rectangle Bounds {
|
||||||
get { return bounds; }
|
get { return bounds; }
|
||||||
set {
|
set {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user