Adjust selected outline size dynamically depending on distance, fix direct connect settings not being loaded in the launcher.

This commit is contained in:
UnknownShadow200 2015-12-30 12:14:46 +11:00
parent 85f53e6597
commit 0a17f9e8f1
2 changed files with 20 additions and 15 deletions

View File

@ -7,24 +7,29 @@ namespace ClassicalSharp.Renderers {
public class PickingRenderer : IDisposable { public class PickingRenderer : IDisposable {
IGraphicsApi graphics; IGraphicsApi graphics;
BlockInfo info; Game game;
int vb; int vb;
public PickingRenderer( Game window ) { public PickingRenderer( Game game ) {
graphics = window.Graphics; graphics = game.Graphics;
vb = graphics.CreateDynamicVb( VertexFormat.Pos3fCol4b, verticesCount ); vb = graphics.CreateDynamicVb( VertexFormat.Pos3fCol4b, verticesCount );
info = window.BlockInfo; this.game = game;
} }
FastColour col = FastColour.Black; FastColour col = FastColour.Black;
int index; int index;
const int verticesCount = 16 * 6; const int verticesCount = 16 * 6;
VertexPos3fCol4b[] vertices = new VertexPos3fCol4b[verticesCount]; VertexPos3fCol4b[] vertices = new VertexPos3fCol4b[verticesCount];
const float size = 1/32f;
const float offset = 0.01f; const float offset = 0.01f;
public void Render( double delta, PickedPos pickedPos ) { public void Render( double delta, PickedPos pickedPos ) {
index = 0; index = 0;
Player player = game.LocalPlayer;
Vector3 camPos = game.Camera.GetCameraPos( player.EyePosition );
float dist = (camPos - pickedPos.Min).LengthSquared;
float size = dist < 12 * 12 ? 1/64f : 1/32f;
if( dist > 32 * 32 ) size = 1/16f;
Vector3 p1 = pickedPos.Min - new Vector3( offset, offset, offset ); Vector3 p1 = pickedPos.Min - new Vector3( offset, offset, offset );
Vector3 p2 = pickedPos.Max + new Vector3( offset, offset, offset ); Vector3 p2 = pickedPos.Max + new Vector3( offset, offset, offset );

View File

@ -111,17 +111,17 @@ namespace Launcher2 {
if( !Options.Load() ) if( !Options.Load() )
return; return;
string user = Options.Get( "launcher-DC-username" ) ?? ""; string user = Options.Get( "launcher-dc-username" ) ?? "";
string ip = Options.Get( "launcher-DC-ip" ) ?? "127.0.0.1"; string ip = Options.Get( "launcher-dc-ip" ) ?? "127.0.0.1";
string port = Options.Get( "launcher-DC-port" ) ?? "25565"; string port = Options.Get( "launcher-dc-port" ) ?? "25565";
bool ccSkins = Options.GetBool( "launcher-DC-ccskins", true ); bool ccSkins = Options.GetBool( "launcher-dc-ccskins", true );
IPAddress address; IPAddress address;
if( !IPAddress.TryParse( ip, out address ) ) ip = "127.0.0.1"; if( !IPAddress.TryParse( ip, out address ) ) ip = "127.0.0.1";
ushort portNum; ushort portNum;
if( !UInt16.TryParse( port, out portNum ) ) port = "25565"; if( !UInt16.TryParse( port, out portNum ) ) port = "25565";
string mppass = Options.Get( "launcher-DC-mppass" ) ?? null; string mppass = Options.Get( "launcher-dc-mppass" );
mppass = Secure.Decode( mppass, user ); mppass = Secure.Decode( mppass, user );
Set( 0, user ); Set( 0, user );
@ -134,11 +134,11 @@ namespace Launcher2 {
if( !Options.Load() ) if( !Options.Load() )
return; return;
Options.Set( "launcher-DC-username", data.Username ); Options.Set( "launcher-dc-username", data.Username );
Options.Set( "launcher-DC-ip", data.Ip ); Options.Set( "launcher-dc-ip", data.Ip );
Options.Set( "launcher-DC-port", data.Port ); Options.Set( "launcher-dc-port", data.Port );
Options.Set( "launcher-DC-mppass", Secure.Encode( data.Mppass, data.Username ) ); Options.Set( "launcher-dc-mppass", Secure.Encode( data.Mppass, data.Username ) );
Options.Set( "launcher-DC-ccskins", ccSkins ); Options.Set( "launcher-dc-ccskins", ccSkins );
Options.Save(); Options.Save();
} }