diff --git a/ClassicalSharp/2D/Drawing/GdiPlusDrawer2D.cs b/ClassicalSharp/2D/Drawing/GdiPlusDrawer2D.cs
index d0fbe168c..c22fd2135 100644
--- a/ClassicalSharp/2D/Drawing/GdiPlusDrawer2D.cs
+++ b/ClassicalSharp/2D/Drawing/GdiPlusDrawer2D.cs
@@ -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 );
diff --git a/ClassicalSharp/2D/Drawing/IDrawer2D.cs b/ClassicalSharp/2D/Drawing/IDrawer2D.cs
index b670a4dd7..53b0475c9 100644
--- a/ClassicalSharp/2D/Drawing/IDrawer2D.cs
+++ b/ClassicalSharp/2D/Drawing/IDrawer2D.cs
@@ -26,21 +26,21 @@ namespace ClassicalSharp {
/// Draws a 2D flat rectangle of the specified dimensions at the
/// specified coordinates in the currently bound bitmap.
- 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 );
/// Draws the outline of a 2D flat rectangle of the specified dimensions
/// at the specified coordinates in the currently bound bitmap.
- 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 );
/// Draws a 2D rectangle with rounded borders of the specified dimensions
/// at the specified coordinates in the currently bound bitmap.
- 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 );
/// Clears the entire bound bitmap to the specified colour.
- public abstract void Clear( Color colour );
+ public abstract void Clear( FastColour colour );
/// Clears the entire bound bitmap to the specified colour.
- 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 );
/// Disposes of any resources used by this class that are associated with the underlying bitmap.
public abstract void Dispose();
@@ -85,12 +85,11 @@ namespace ClassicalSharp {
}
protected List parts = new List( 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) );
diff --git a/ClassicalSharp/2D/Screens/BlockSelectScreen.cs b/ClassicalSharp/2D/Screens/BlockSelectScreen.cs
index 84084e1cf..525618135 100644
--- a/ClassicalSharp/2D/Screens/BlockSelectScreen.cs
+++ b/ClassicalSharp/2D/Screens/BlockSelectScreen.cs
@@ -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++ ) {
diff --git a/ClassicalSharp/2D/Screens/ErrorScreen.cs b/ClassicalSharp/2D/Screens/ErrorScreen.cs
index 852ca8ee0..ebe3e8dce 100644
--- a/ClassicalSharp/2D/Screens/ErrorScreen.cs
+++ b/ClassicalSharp/2D/Screens/ErrorScreen.cs
@@ -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;
diff --git a/ClassicalSharp/2D/Screens/FilesScreen.cs b/ClassicalSharp/2D/Screens/FilesScreen.cs
index 1ac554cbd..7b95a45f2 100644
--- a/ClassicalSharp/2D/Screens/FilesScreen.cs
+++ b/ClassicalSharp/2D/Screens/FilesScreen.cs
@@ -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 ) {
diff --git a/ClassicalSharp/2D/Screens/FpsScreen.cs b/ClassicalSharp/2D/Screens/FpsScreen.cs
index 96b60e535..b2a46ceb9 100644
--- a/ClassicalSharp/2D/Screens/FpsScreen.cs
+++ b/ClassicalSharp/2D/Screens/FpsScreen.cs
@@ -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 );
}
diff --git a/ClassicalSharp/2D/Screens/LoadingMapScreen.cs b/ClassicalSharp/2D/Screens/LoadingMapScreen.cs
index 13bffbcfa..29e192ed6 100644
--- a/ClassicalSharp/2D/Screens/LoadingMapScreen.cs
+++ b/ClassicalSharp/2D/Screens/LoadingMapScreen.cs
@@ -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;
}
diff --git a/ClassicalSharp/2D/Screens/Menu/EnvSettingsScreen.cs b/ClassicalSharp/2D/Screens/Menu/EnvSettingsScreen.cs
index bf41c953a..e03cdb33d 100644
--- a/ClassicalSharp/2D/Screens/Menu/EnvSettingsScreen.cs
+++ b/ClassicalSharp/2D/Screens/Menu/EnvSettingsScreen.cs
@@ -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,
diff --git a/ClassicalSharp/2D/Screens/Menu/KeyMappingsScreen.cs b/ClassicalSharp/2D/Screens/Menu/KeyMappingsScreen.cs
index 869e55beb..641556685 100644
--- a/ClassicalSharp/2D/Screens/Menu/KeyMappingsScreen.cs
+++ b/ClassicalSharp/2D/Screens/Menu/KeyMappingsScreen.cs
@@ -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;
diff --git a/ClassicalSharp/2D/Screens/Menu/LoadLevelScreen.cs b/ClassicalSharp/2D/Screens/Menu/LoadLevelScreen.cs
index 1ff9e346f..3bdaecfd6 100644
--- a/ClassicalSharp/2D/Screens/Menu/LoadLevelScreen.cs
+++ b/ClassicalSharp/2D/Screens/Menu/LoadLevelScreen.cs
@@ -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 {
diff --git a/ClassicalSharp/2D/Screens/Menu/MenuInputScreen.cs b/ClassicalSharp/2D/Screens/Menu/MenuInputScreen.cs
index 2548fd671..98142d8a2 100644
--- a/ClassicalSharp/2D/Screens/Menu/MenuInputScreen.cs
+++ b/ClassicalSharp/2D/Screens/Menu/MenuInputScreen.cs
@@ -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;
diff --git a/ClassicalSharp/2D/Screens/Menu/MenuScreen.cs b/ClassicalSharp/2D/Screens/Menu/MenuScreen.cs
index e45afc2b2..81002eabd 100644
--- a/ClassicalSharp/2D/Screens/Menu/MenuScreen.cs
+++ b/ClassicalSharp/2D/Screens/Menu/MenuScreen.cs
@@ -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 ) {
}
}
}
\ No newline at end of file
diff --git a/ClassicalSharp/2D/Screens/Menu/OptionsScreen.cs b/ClassicalSharp/2D/Screens/Menu/OptionsScreen.cs
index 70689f76b..128e5980c 100644
--- a/ClassicalSharp/2D/Screens/Menu/OptionsScreen.cs
+++ b/ClassicalSharp/2D/Screens/Menu/OptionsScreen.cs
@@ -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,
diff --git a/ClassicalSharp/2D/Screens/Menu/SaveLevelScreen.cs b/ClassicalSharp/2D/Screens/Menu/SaveLevelScreen.cs
index 18e4d2921..7d6c1c948 100644
--- a/ClassicalSharp/2D/Screens/Menu/SaveLevelScreen.cs
+++ b/ClassicalSharp/2D/Screens/Menu/SaveLevelScreen.cs
@@ -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;
diff --git a/ClassicalSharp/2D/Screens/Menu/TexturePackScreen.cs b/ClassicalSharp/2D/Screens/Menu/TexturePackScreen.cs
index 13b8d3978..4219b7d03 100644
--- a/ClassicalSharp/2D/Screens/Menu/TexturePackScreen.cs
+++ b/ClassicalSharp/2D/Screens/Menu/TexturePackScreen.cs
@@ -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 ) ) );
}
diff --git a/ClassicalSharp/2D/Widgets/PlayerListWidget.cs b/ClassicalSharp/2D/Widgets/PlayerListWidget.cs
index d18233bfc..bf89cc6c5 100644
--- a/ClassicalSharp/2D/Widgets/PlayerListWidget.cs
+++ b/ClassicalSharp/2D/Widgets/PlayerListWidget.cs
@@ -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 );
diff --git a/ClassicalSharp/Game/Game.cs b/ClassicalSharp/Game/Game.cs
index c3989c445..3b8572bc4 100644
--- a/ClassicalSharp/Game/Game.cs
+++ b/ClassicalSharp/Game/Game.cs
@@ -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 ) {
diff --git a/ClassicalSharp/Utils/FastColour.cs b/ClassicalSharp/Utils/FastColour.cs
index d9aa194c9..1bad30cb2 100644
--- a/ClassicalSharp/Utils/FastColour.cs
+++ b/ClassicalSharp/Utils/FastColour.cs
@@ -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 );
diff --git a/Launcher2/Gui/Screens/ClassiCubeServersScreen.cs b/Launcher2/Gui/Screens/ClassiCubeServersScreen.cs
index 4b8cae1e6..d88007676 100644
--- a/Launcher2/Gui/Screens/ClassiCubeServersScreen.cs
+++ b/Launcher2/Gui/Screens/ClassiCubeServersScreen.cs
@@ -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,
diff --git a/Launcher2/LauncherWindow.cs b/Launcher2/LauncherWindow.cs
index cca1eed64..722966534 100644
--- a/Launcher2/LauncherWindow.cs
+++ b/Launcher2/LauncherWindow.cs
@@ -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 );
diff --git a/Launcher2/Secure.cs b/Launcher2/Secure.cs
index 7799d0536..77fb5b408 100644
--- a/Launcher2/Secure.cs
+++ b/Launcher2/Secure.cs
@@ -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++ )
diff --git a/OpenTK/GameWindow.cs b/OpenTK/GameWindow.cs
index fddb22149..7958b4856 100644
--- a/OpenTK/GameWindow.cs
+++ b/OpenTK/GameWindow.cs
@@ -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
///
/// The for this event.
/// Set e.Cancel to true in order to stop the GameWindow from closing.
- 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);
}
- /// Called when the WindowInfo for this GameWindow has changed.
- /// Not used.
- 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);
- }
}
}
\ No newline at end of file
diff --git a/OpenTK/INativeWindow.cs b/OpenTK/INativeWindow.cs
index f56c55473..b517d2518 100644
--- a/OpenTK/INativeWindow.cs
+++ b/OpenTK/INativeWindow.cs
@@ -92,9 +92,6 @@ namespace OpenTK {
/// Processes pending window events.
void ProcessEvents();
- /// Causes the window to be immediately redrawn.
- void Invalidate();
-
/// Transforms the specified point from screen to client coordinates.
/// A to transform.
/// The point transformed to client coordinates.
diff --git a/OpenTK/NativeWindow.cs b/OpenTK/NativeWindow.cs
index a56cda27f..ee6c7c1a2 100644
--- a/OpenTK/NativeWindow.cs
+++ b/OpenTK/NativeWindow.cs
@@ -123,11 +123,6 @@ namespace OpenTK {
ProcessEvents(false);
}
- /// Causes the window to be immediately redrawn.
- public void Invalidate() {
- implementation.Invalidate();
- }
-
/// Gets or sets a 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.
public Rectangle Bounds {
@@ -314,80 +309,71 @@ namespace OpenTK {
/// Called when the NativeWindow has closed.
/// Not used.
- protected virtual void OnClosed(EventArgs e) {
+ protected virtual void OnClosed(object sender, EventArgs e) {
if (Closed != null) Closed(this, e);
}
/// Called when the NativeWindow is about to close.
/// The for this event.
/// Set e.Cancel to true in order to stop the NativeWindow from closing.
- protected virtual void OnClosing(CancelEventArgs e) {
+ protected virtual void OnClosing(object sender, CancelEventArgs e) {
if (Closing != null) Closing(this, e);
}
/// Called when the NativeWindow is disposed.
- /// Not used.
- protected virtual void OnDisposed(EventArgs e) {
+ protected virtual void OnDisposed(object sender, EventArgs e) {
if (Disposed != null) Disposed(this, e);
}
/// Called when the property of the NativeWindow has changed.
- /// Not used.
- protected virtual void OnFocusedChanged(EventArgs e) {
+ protected virtual void OnFocusedChanged(object sender, EventArgs e) {
if (FocusedChanged != null) FocusedChanged(this, e);
}
/// Called when the property of the NativeWindow has changed.
- /// Not used.
- protected virtual void OnIconChanged(EventArgs e) {
+ protected virtual void OnIconChanged(object sender, EventArgs e) {
if (IconChanged != null) IconChanged(this, e);
}
/// Called when a character is typed.
/// The for this event.
- protected virtual void OnKeyPress(KeyPressEventArgs e) {
+ protected virtual void OnKeyPress(object sender, KeyPressEventArgs e) {
if (KeyPress != null) KeyPress(this, e);
}
/// Called when the NativeWindow is moved.
- /// Not used.
- protected virtual void OnMove(EventArgs e) {
+ protected virtual void OnMove(object sender, EventArgs e) {
if (Move != null) Move(this, e);
}
/// Called whenever the mouse cursor reenters the window .
- /// Not used.
- protected virtual void OnMouseEnter(EventArgs e) {
+ protected virtual void OnMouseEnter(object sender, EventArgs e) {
if (MouseEnter != null) MouseEnter(this, e);
}
/// Called whenever the mouse cursor leaves the window .
- /// Not used.
- protected virtual void OnMouseLeave(EventArgs e) {
+ protected virtual void OnMouseLeave(object sender, EventArgs e) {
if (MouseLeave != null) MouseLeave(this, e);
}
/// Called when the NativeWindow is resized.
/// Not used.
- protected virtual void OnResize(EventArgs e) {
+ protected virtual void OnResize(object sender, EventArgs e) {
if (Resize != null) Resize(this, e);
}
/// Called when the property of the NativeWindow has changed.
- /// Not used.
- protected virtual void OnTitleChanged(EventArgs e) {
+ protected virtual void OnTitleChanged(object sender, EventArgs e) {
if (TitleChanged != null) TitleChanged(this, e);
}
/// Called when the property of the NativeWindow has changed.
- /// Not used.
- protected virtual void OnVisibleChanged(EventArgs e) {
+ protected virtual void OnVisibleChanged(object sender, EventArgs e) {
if (VisibleChanged != null) VisibleChanged(this, e);
}
/// Called when the WindowState of this NativeWindow has changed.
- /// Not used.
- 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.");
diff --git a/OpenTK/Platform/MacOS/CarbonGLNative.cs b/OpenTK/Platform/MacOS/CarbonGLNative.cs
index ca156cea8..f58cfc013 100644
--- a/OpenTK/Platform/MacOS/CarbonGLNative.cs
+++ b/OpenTK/Platform/MacOS/CarbonGLNative.cs
@@ -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)
{
diff --git a/OpenTK/Platform/Windows/WinGLNative.cs b/OpenTK/Platform/Windows/WinGLNative.cs
index feac5f44a..4dd4680d0 100644
--- a/OpenTK/Platform/Windows/WinGLNative.cs
+++ b/OpenTK/Platform/Windows/WinGLNative.cs
@@ -714,9 +714,6 @@ namespace OpenTK.Platform.Windows
API.DispatchMessage(ref msg);
}
}
-
- public void Invalidate() {
- }
public IWindowInfo WindowInfo {
get { return child_window; }
diff --git a/OpenTK/Platform/X11/X11GLNative.cs b/OpenTK/Platform/X11/X11GLNative.cs
index 42abdff16..108539510 100644
--- a/OpenTK/Platform/X11/X11GLNative.cs
+++ b/OpenTK/Platform/X11/X11GLNative.cs
@@ -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 {