mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-14 10:05:44 -04:00
Fix crashing on close, remove file that somehow magically appeared?
This commit is contained in:
parent
25d7cbda9e
commit
f99e9eeb3a
@ -12,6 +12,7 @@ namespace ClassicalSharp {
|
|||||||
protected internal int PlayerTextureId = -1, MobTextureId = -1;
|
protected internal int PlayerTextureId = -1, MobTextureId = -1;
|
||||||
|
|
||||||
public override void Despawn() {
|
public override void Despawn() {
|
||||||
|
if( api == null ) return;
|
||||||
api.DeleteTexture( ref PlayerTextureId );
|
api.DeleteTexture( ref PlayerTextureId );
|
||||||
api.DeleteTexture( ref nameTex.ID );
|
api.DeleteTexture( ref nameTex.ID );
|
||||||
}
|
}
|
||||||
|
@ -53,16 +53,17 @@ namespace OpenTK {
|
|||||||
del = null;
|
del = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected bool IsInvalidAddress( IntPtr address ) {
|
||||||
|
return address == IntPtr.Zero || address == new IntPtr(1) ||
|
||||||
|
address == new IntPtr(2) || address == new IntPtr(-1);
|
||||||
|
}
|
||||||
|
|
||||||
// Creates a System.Delegate that can be used to call a dynamically exported OpenGL function.
|
// Creates a System.Delegate that can be used to call a dynamically exported OpenGL function.
|
||||||
protected internal void GetExtensionDelegate<T>( string name, out T del ) where T : class {
|
protected internal void GetExtensionDelegate<T>( string name, out T del ) where T : class {
|
||||||
IntPtr address = GetAddress( name );
|
IntPtr address = GetAddress( name );
|
||||||
if (address == IntPtr.Zero || address == new IntPtr(1) ||
|
del = IsInvalidAddress( address ) ? null :
|
||||||
address == new IntPtr(2) || address == new IntPtr(-1)) {
|
(T)(object)Marshal.GetDelegateForFunctionPointer( address, typeof( T ) );
|
||||||
del = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
del = (T)(object)Marshal.GetDelegateForFunctionPointer( address, typeof(T) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,40 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace ClassicalSharp.Renderers {
|
|
||||||
|
|
||||||
/// <summary> Minimialistic environment renderer - only sets the clear colour to be sky colour.
|
|
||||||
/// (no fog, clouds, or proper overhead sky) </summary>
|
|
||||||
public class MinimalEnvRenderer : EnvRenderer {
|
|
||||||
|
|
||||||
public MinimalEnvRenderer( Game window ) {
|
|
||||||
Window = window;
|
|
||||||
Map = Window.Map;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Render( double deltaTime ) {
|
|
||||||
Graphics.ClearColour( Map.SkyCol );
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Init() {
|
|
||||||
base.Init();
|
|
||||||
Graphics.Fog = false;
|
|
||||||
Graphics.ClearColour( Map.SkyCol );
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnNewMap( object sender, EventArgs e ) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnNewMapLoaded( object sender, EventArgs e ) {
|
|
||||||
Graphics.ClearColour( Map.SkyCol );
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void CloudsColourChanged() {
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void FogColourChanged() {
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void SkyColourChanged() {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user