Added proper positions

This commit is contained in:
2026-09-29 18:21:21 +00:00
committed by JonathanMcCaffrey
parent 6a33670865
commit bf409c0c3c
87 changed files with 311 additions and 229 deletions
@@ -1,5 +1,4 @@
using Microsoft.Maui.Graphics;
using Microsoft.Maui.Storage;
using IImage = Microsoft.Maui.Graphics.IImage;
namespace ZeroSpace.MapEditor.Services;
@@ -9,22 +8,21 @@ namespace ZeroSpace.MapEditor.Services;
/// </summary>
public static class MapBackground
{
private const string AssetName = "galaxymap.png";
private const string AssetName = "Resources\\Raw\\galaxymap.png";
public static async Task<IImage?> LoadAsync()
{
try
{
await using var packageStream = await FileSystem.OpenAppPackageFileAsync(AssetName);
// Copy into memory and leave the buffer undisposed: some platform
// image implementations read from the stream lazily.
var buffer = new MemoryStream();
await packageStream.CopyToAsync(buffer);
buffer.Position = 0;
#if WINDOWS
return new Microsoft.Maui.Graphics.Platform.PlatformImage(buffer);
#elif MACCATALYST
return new Microsoft.Maui.Graphics.Platform.PlatformImage(buffer);
#if WINDOWS || MACCATALYST
return Microsoft.Maui.Graphics.Platform.PlatformImage.FromStream(buffer);
#else
return null;
#endif
@@ -36,4 +34,4 @@ public static class MapBackground
return null;
}
}
}
}
@@ -1,6 +1,7 @@
using Microsoft.Maui.Graphics;
using ZeroSpace.MapEditor.Models;
using ZeroSpace.MapEditor.Services;
using IImage = Microsoft.Maui.Graphics.IImage;
namespace ZeroSpace.MapEditor.Views;
@@ -26,7 +26,9 @@
<PackageReference Include="Microsoft.Maui.Controls" Version="10.0.110" />
<PackageReference Include="CommunityToolkit.Maui.Core" Version="15.0.1" />
<!-- In-game galaxy map screenshot shown as the canvas background. -->
<MauiAsset Include="Resources\Raw\galaxymap.png" />
<MauiAsset Include="Resources\Raw\galaxymap.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</MauiAsset>
</ItemGroup>
</Project>