Fix padding issues, also be more helpful when using 'OpenGL build with Intel GPU on windows.'

This commit is contained in:
UnknownShadow200 2016-04-19 10:17:24 +10:00
parent 976aab75ab
commit e51aefe4d7
5 changed files with 15 additions and 9 deletions

View File

@ -231,6 +231,8 @@ namespace ClassicalSharp {
public void ReducePadding( ref Texture tex, int point ) { public void ReducePadding( ref Texture tex, int point ) {
if( !UseBitmappedChat ) return; if( !UseBitmappedChat ) return;
point = AdjTextSize( point );
int padding = (tex.Height - point) / 4; int padding = (tex.Height - point) / 4;
float vAdj = (float)padding / Utils.NextPowerOf2( tex.Height ); float vAdj = (float)padding / Utils.NextPowerOf2( tex.Height );
tex.V1 += vAdj; tex.V2 -= vAdj; tex.V1 += vAdj; tex.V2 -= vAdj;
@ -239,6 +241,8 @@ namespace ClassicalSharp {
public void ReducePadding( ref int height, int point ) { public void ReducePadding( ref int height, int point ) {
if( !UseBitmappedChat ) return; if( !UseBitmappedChat ) return;
point = AdjTextSize( point );
int padding = (height - point) / 4; int padding = (height - point) / 4;
height -= padding * 2; height -= padding * 2;
} }

View File

@ -43,6 +43,8 @@ namespace ClassicalSharp.Audio {
if( type == SoundType.None || monoOutputs == null ) if( type == SoundType.None || monoOutputs == null )
return; return;
Sound snd = board.PickRandomSound( type ); Sound snd = board.PickRandomSound( type );
if( snd == null ) return;
chunk.Channels = snd.Channels; chunk.Channels = snd.Channels;
chunk.Frequency = snd.SampleRate; chunk.Frequency = snd.SampleRate;
chunk.BitsPerSample = snd.BitsPerSample; chunk.BitsPerSample = snd.BitsPerSample;

View File

@ -153,7 +153,10 @@ namespace ClassicalSharp {
LoadIcon(); LoadIcon();
string connectString = "Connecting to " + IPAddress + ":" + Port + ".."; string connectString = "Connecting to " + IPAddress + ":" + Port + "..";
Graphics.WarnIfNecessary( Chat ); if( Graphics.WarnIfNecessary( Chat ) ) {
MapBordersRenderer.SetUseLegacyMode( true );
((StandardEnvRenderer)EnvRenderer).SetUseLegacyMode( true );
}
SetNewScreen( new LoadingMapScreen( this, connectString, "Waiting for handshake" ) ); SetNewScreen( new LoadingMapScreen( this, connectString, "Waiting for handshake" ) );
Network.Connect( IPAddress, Port ); Network.Connect( IPAddress, Port );
} }

View File

@ -222,8 +222,7 @@ namespace ClassicalSharp.GraphicsAPI {
} }
/// <summary> Adds a warning to chat if this graphics API has problems with the current user's GPU. </summary> /// <summary> Adds a warning to chat if this graphics API has problems with the current user's GPU. </summary>
public virtual void WarnIfNecessary( Chat chat ) { public virtual bool WarnIfNecessary( Chat chat ) { return false; }
}
/// <summary> Informs the graphic api to update its state in preparation for a new frame. </summary> /// <summary> Informs the graphic api to update its state in preparation for a new frame. </summary>
public abstract void BeginFrame( Game game ); public abstract void BeginFrame( Game game );

View File

@ -386,15 +386,13 @@ namespace ClassicalSharp.GraphicsAPI {
isIntelRenderer = renderer.Contains( "Intel" ); isIntelRenderer = renderer.Contains( "Intel" );
} }
public override void WarnIfNecessary( Chat chat ) { public override bool WarnIfNecessary( Chat chat ) {
if( !isIntelRenderer ) return; if( !isIntelRenderer ) return false;
chat.Add( "&cIntel graphics cards are known to have issues with the OpenGL build." ); chat.Add( "&cIntel graphics cards are known to have issues with the OpenGL build." );
chat.Add( "&cVSync may not work, and you may see disappearing clouds and map edges." ); chat.Add( "&cVSync may not work, and you may see disappearing clouds and map edges." );
chat.Add( " " ); chat.Add( "&cFor Windows, try downloading the Direct3D 9 build instead.");
chat.Add( "&cFor Windows, try downloading the Direct3D 9 build as it doesn't have" ); return true;
chat.Add( "&cthese problems. Alternatively, the disappearing graphics can be" );
chat.Add( "&cpartially fixed by typing \"/client render legacy\" into chat." );
} }
// Based on http://www.opentk.com/doc/graphics/save-opengl-rendering-to-disk // Based on http://www.opentk.com/doc/graphics/save-opengl-rendering-to-disk