Asynchronous loading of map previews in the map chooser dialog

This commit is contained in:
Carko
2013-01-13 15:33:43 +01:00
committed by Chris Forbes
parent c5313375f0
commit 4395a04d57
2 changed files with 22 additions and 9 deletions

View File

@@ -26,7 +26,7 @@ namespace OpenRA.Widgets
public bool IgnoreMouseInput = false;
public bool ShowSpawnPoints = true;
static Cache<Map,Bitmap> PreviewCache = new Cache<Map, Bitmap>(stub => Minimap.RenderMapPreview( new Map( stub.Path )));
static readonly Cache<Map,Bitmap> PreviewCache = new Cache<Map, Bitmap>(stub => Minimap.RenderMapPreview( new Map( stub.Path )));
public MapPreviewWidget() : base() { }
@@ -118,5 +118,16 @@ namespace OpenRA.Widgets
}
}
}
/// <summary>
/// Forces loading the preview into the map cache.
/// </summary>
public Bitmap LoadMapPreview()
{
var map = Map();
if( map == null ) return null;
return PreviewCache[map];
}
}
}