mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-15 18:45:23 -04:00
Quick fix for the last commit.
This commit is contained in:
parent
0ba33ce2a3
commit
7413788adc
@ -43,7 +43,7 @@ namespace ClassicalSharp {
|
|||||||
public event EventHandler ColourCodesChanged;
|
public event EventHandler ColourCodesChanged;
|
||||||
internal void RaiseColourCodesChanged() { Raise( ColourCodesChanged ); }
|
internal void RaiseColourCodesChanged() { Raise( ColourCodesChanged ); }
|
||||||
|
|
||||||
ChatEventArgs chatArgs = new ChatEventArgs();
|
ChatEventArgs chatArgs = new ChatEventArgs();
|
||||||
protected void Raise( EventHandler handler ) {
|
protected void Raise( EventHandler handler ) {
|
||||||
if( handler != null )
|
if( handler != null )
|
||||||
handler( this, EventArgs.Empty );
|
handler( this, EventArgs.Empty );
|
||||||
|
@ -150,32 +150,25 @@ namespace ClassicalSharp {
|
|||||||
/// <remarks> Affected by both the current resolution of the window, as well as the
|
/// <remarks> Affected by both the current resolution of the window, as well as the
|
||||||
/// scaling specified by the user (field HotbarScale). </remarks>
|
/// scaling specified by the user (field HotbarScale). </remarks>
|
||||||
public float GuiHotbarScale {
|
public float GuiHotbarScale {
|
||||||
get {
|
get { return MinWindowScale * HotbarScale; }
|
||||||
float scaleX = Width / 640f, scaleY = Height / 480f;
|
|
||||||
return Math.Min( scaleX, scaleY ) * HotbarScale;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Calculates the amount that the block inventory menu should be scaled by when rendered. </summary>
|
/// <summary> Calculates the amount that the block inventory menu should be scaled by when rendered. </summary>
|
||||||
/// <remarks> Affected by both the current resolution of the window, as well as the
|
/// <remarks> Affected by both the current resolution of the window, as well as the
|
||||||
/// scaling specified by the user (field InventoryScale). </remarks>
|
/// scaling specified by the user (field InventoryScale). </remarks>
|
||||||
public float GuiInventoryScale {
|
public float GuiInventoryScale {
|
||||||
get {
|
get { return MinWindowScale * InventoryScale; }
|
||||||
float scaleX = Width / 640f, scaleY = Height / 480f;
|
|
||||||
return Math.Min( scaleX, scaleY ) * InventoryScale;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Calculates the amount that 2D chat widgets should be scaled by when rendered. </summary>
|
/// <summary> Calculates the amount that 2D chat widgets should be scaled by when rendered. </summary>
|
||||||
/// <remarks> Affected by both the current resolution of the window, as well as the
|
/// <remarks> Affected by both the current resolution of the window, as well as the
|
||||||
/// scaling specified by the user (field ChatScale). </remarks>
|
/// scaling specified by the user (field ChatScale). </remarks>
|
||||||
public float GuiChatScale {
|
public float GuiChatScale {
|
||||||
get {
|
get { return MinWindowScale * ChatScale; }
|
||||||
float scaleX = Width / 640f, scaleY = Height / 480f;
|
|
||||||
return Math.Min( scaleX, scaleY ) * ChatScale;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float MinWindowScale { get { return Math.Min( Width / 640f, Height / 480f ); } }
|
||||||
|
|
||||||
string defTexturePack = "default.zip";
|
string defTexturePack = "default.zip";
|
||||||
/// <summary> Gets or sets the path of the default texture pack that should be used by the client. </summary>
|
/// <summary> Gets or sets the path of the default texture pack that should be used by the client. </summary>
|
||||||
/// <remarks> If the custom default texture pack specified by the user could not be found,
|
/// <remarks> If the custom default texture pack specified by the user could not be found,
|
||||||
|
@ -190,24 +190,24 @@ namespace ClassicalSharp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Stopwatch frameTimer = new Stopwatch();
|
Stopwatch frameTimer = new Stopwatch();
|
||||||
internal void RenderFrame( FrameEventArgs e ) {
|
internal void RenderFrame( double delta ) {
|
||||||
frameTimer.Reset();
|
frameTimer.Reset();
|
||||||
frameTimer.Start();
|
frameTimer.Start();
|
||||||
|
|
||||||
Graphics.BeginFrame( this );
|
Graphics.BeginFrame( this );
|
||||||
Graphics.BindIb( defaultIb );
|
Graphics.BindIb( defaultIb );
|
||||||
accumulator += e.Time;
|
accumulator += delta;
|
||||||
Vertices = 0;
|
Vertices = 0;
|
||||||
if( !Focused && !ScreenLockedInput )
|
if( !Focused && !ScreenLockedInput )
|
||||||
SetNewScreen( new PauseScreen( this ) );
|
SetNewScreen( new PauseScreen( this ) );
|
||||||
|
|
||||||
CheckScheduledTasks( e.Time );
|
CheckScheduledTasks( delta );
|
||||||
float t = (float)( ticksAccumulator / ticksPeriod );
|
float t = (float)( ticksAccumulator / ticksPeriod );
|
||||||
LocalPlayer.SetInterpPosition( t );
|
LocalPlayer.SetInterpPosition( t );
|
||||||
|
|
||||||
Graphics.Clear();
|
Graphics.Clear();
|
||||||
Graphics.SetMatrixMode( MatrixType.Modelview );
|
Graphics.SetMatrixMode( MatrixType.Modelview );
|
||||||
Matrix4 modelView = Camera.GetView( e.Time );
|
Matrix4 modelView = Camera.GetView( delta );
|
||||||
View = modelView;
|
View = modelView;
|
||||||
Graphics.LoadMatrix( ref modelView );
|
Graphics.LoadMatrix( ref modelView );
|
||||||
Culling.CalcFrustumEquations( ref Projection, ref modelView );
|
Culling.CalcFrustumEquations( ref Projection, ref modelView );
|
||||||
@ -215,36 +215,36 @@ namespace ClassicalSharp {
|
|||||||
bool visible = activeScreen == null || !activeScreen.BlocksWorld;
|
bool visible = activeScreen == null || !activeScreen.BlocksWorld;
|
||||||
if( Map.IsNotLoaded ) visible = false;
|
if( Map.IsNotLoaded ) visible = false;
|
||||||
if( visible ) {
|
if( visible ) {
|
||||||
AxisLinesRenderer.Render( e.Time );
|
AxisLinesRenderer.Render( delta );
|
||||||
Players.RenderModels( Graphics, e.Time, t );
|
Players.RenderModels( Graphics, delta, t );
|
||||||
Players.RenderNames( Graphics, e.Time, t );
|
Players.RenderNames( Graphics, delta, t );
|
||||||
CurrentCameraPos = Camera.GetCameraPos( LocalPlayer.EyePosition );
|
CurrentCameraPos = Camera.GetCameraPos( LocalPlayer.EyePosition );
|
||||||
|
|
||||||
ParticleManager.Render( e.Time, t );
|
ParticleManager.Render( delta, t );
|
||||||
Camera.GetPickedBlock( SelectedPos ); // TODO: only pick when necessary
|
Camera.GetPickedBlock( SelectedPos ); // TODO: only pick when necessary
|
||||||
EnvRenderer.Render( e.Time );
|
EnvRenderer.Render( delta );
|
||||||
if( SelectedPos.Valid && !HideGui )
|
if( SelectedPos.Valid && !HideGui )
|
||||||
Picking.Render( e.Time, SelectedPos );
|
Picking.Render( delta, SelectedPos );
|
||||||
MapRenderer.Render( e.Time );
|
MapRenderer.Render( delta );
|
||||||
SelectionManager.Render( e.Time );
|
SelectionManager.Render( delta );
|
||||||
Players.RenderHoveredNames( Graphics, e.Time, t );
|
Players.RenderHoveredNames( Graphics, delta, t );
|
||||||
|
|
||||||
bool left = IsMousePressed( MouseButton.Left );
|
bool left = IsMousePressed( MouseButton.Left );
|
||||||
bool middle = IsMousePressed( MouseButton.Middle );
|
bool middle = IsMousePressed( MouseButton.Middle );
|
||||||
bool right = IsMousePressed( MouseButton.Right );
|
bool right = IsMousePressed( MouseButton.Right );
|
||||||
InputHandler.PickBlocks( true, left, middle, right );
|
InputHandler.PickBlocks( true, left, middle, right );
|
||||||
if( !HideGui )
|
if( !HideGui )
|
||||||
BlockHandRenderer.Render( e.Time, t );
|
BlockHandRenderer.Render( delta, t );
|
||||||
} else {
|
} else {
|
||||||
SelectedPos.SetAsInvalid();
|
SelectedPos.SetAsInvalid();
|
||||||
}
|
}
|
||||||
|
|
||||||
Graphics.Mode2D( Width, Height, EnvRenderer is StandardEnvRenderer );
|
Graphics.Mode2D( Width, Height, EnvRenderer is StandardEnvRenderer );
|
||||||
fpsScreen.Render( e.Time );
|
fpsScreen.Render( delta );
|
||||||
if( activeScreen == null || !activeScreen.HidesHud )
|
if( activeScreen == null || !activeScreen.HidesHud )
|
||||||
hudScreen.Render( e.Time );
|
hudScreen.Render( delta );
|
||||||
if( activeScreen != null )
|
if( activeScreen != null )
|
||||||
activeScreen.Render( e.Time );
|
activeScreen.Render( delta );
|
||||||
Graphics.Mode3D( EnvRenderer is StandardEnvRenderer );
|
Graphics.Mode3D( EnvRenderer is StandardEnvRenderer );
|
||||||
|
|
||||||
if( screenshotRequested )
|
if( screenshotRequested )
|
||||||
|
@ -67,8 +67,13 @@ namespace ClassicalSharp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnRenderFrame( FrameEventArgs e ) {
|
protected override void OnRenderFrame( FrameEventArgs e ) {
|
||||||
game.RenderFrame( e );
|
game.RenderFrame( e.Time );
|
||||||
base.OnRenderFrame( e );
|
base.OnRenderFrame( e );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnResize( object sender, EventArgs e ) {
|
||||||
|
game.OnResize();
|
||||||
|
base.OnResize( sender, e );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user