Announcement texture should be in top quarter, fix non-32 bpp terrain.png files crashing client when saved to texturecache (Thanks goodlyay), fix hotkeys not being removed when closing client then the launcher (Thanks 123DontMessWitMe).

This commit is contained in:
UnknownShadow200 2016-02-07 11:59:53 +11:00
parent 20205a42fb
commit 4811f15bf3
3 changed files with 18 additions and 4 deletions

View File

@ -68,7 +68,7 @@ namespace ClassicalSharp {
clientStatus.Init();
announcement = ChatTextWidget.Create( game, 0, 0, null,
Anchor.Centre, Anchor.Centre, announcementFont );
announcement.YOffset = game.Height / 4;
announcement.YOffset = -game.Height / 4;
clock = ChatTextWidget.Create( game, 0, 0, null,
Anchor.BottomOrRight, Anchor.LeftOrTop, chatItalicFont );
}
@ -247,7 +247,7 @@ namespace ClassicalSharp {
public override void OnResize( int oldWidth, int oldHeight, int width, int height ) {
announcement.OnResize( oldWidth, oldHeight, width, height );
announcement.YOffset = height / 4;
announcement.YOffset = -height / 4;
announcement.MoveTo( announcement.X, announcement.YOffset - announcement.Height / 2 );
blockSize = (int)(23 * 2 * game.GuiHotbarScale);
textInput.YOffset = blockSize + 5;

View File

@ -65,8 +65,13 @@ namespace ClassicalSharp {
DownloadedItem item;
if( game.AsyncDownloader.TryGetItem( "terrain", out item ) ) {
if( item.Data != null ) {
game.ChangeTerrainAtlas( (Bitmap)item.Data );
TextureCache.AddToCache( item.Url, (Bitmap)item.Data );
Bitmap bmp = (Bitmap)item.Data;
if( !FastBitmap.CheckFormat( bmp.PixelFormat ) ) {
Utils.LogDebug( "Converting terrain atlas to 32bpp image" );
game.Drawer2D.ConvertTo32Bpp( ref bmp );
}
game.ChangeTerrainAtlas( bmp );
TextureCache.AddToCache( item.Url, bmp );
} else if( Is304Status( item.WebEx ) ) {
Bitmap bmp = TextureCache.GetBitmapFromCache( item.Url );
if( bmp == null ) // Should never happen, but handle anyways.

View File

@ -159,6 +159,15 @@ namespace ClassicalSharp {
static void LoadFrom( StreamReader reader ) {
string line;
// remove all the unchanged options
List<string> toRemoveKeys = new List<string>();
foreach( KeyValuePair<string, string> kvp in OptionsSet ) {
if( !OptionsChanged.ContainsKey( kvp.Key ) )
toRemoveKeys.Add( kvp.Key );
}
foreach( string key in toRemoveKeys )
OptionsSet.Remove( key );
while( (line = reader.ReadLine()) != null ) {
if( line.Length == 0 && line[0] == '#' ) continue;