blish-hud / Blish-HUD

A Guild Wars 2 overlay with extreme extensibility through compiled modules.
https://blishhud.com
MIT License
320 stars 59 forks source link

Bug: StandardWindow.Emblem can not handle AsyncTexture2D from GameService.Content.DatAssetCache.TryGetTextureFromAssetId #899

Open Taschenbuch opened 1 year ago

Taschenbuch commented 1 year ago

StandardWindow.Emblem is of type Texture2D and can not handle AsyncTexture2D from GameService.Content.DatAssetCache.TryGetTextureFromAssetId. This results in the window emblem not being displayed. Example code

GameService.Content.DatAssetCache.TryGetTextureFromAssetId(603447, out AsyncTexture2D mugTexture);

new StandardWindow(
    _windowBackgroundTexture,
    new Rectangle(40, 26, 913, 691),
    new Rectangle(70, 71, 839, 605))
{
    Parent        = GameService.Graphics.SpriteScreen,
    Title         = "Example Window Title",
    Emblem        = mugTexture,
    Subtitle      = "Example Subtitle",
    Location      = new Point(300, 300),
    SavesPosition = true,
    // Id has to be unique not only in your module but also within blish core and any other module
    Id = $"{nameof(ExampleModule)}_My_Unique_ID_123" 
};

_exampleWindow.Show(new OverlaySettingsView());
dlamkins commented 1 year ago

We actually tried to fix this a while back but realized it was, unfortunately, a breaking change that caused some issues and had to be reverted. :(