Skip to content

Commit

Permalink
native AoT compatible. bump to 0.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sub-c committed Sep 2, 2024
1 parent 97b9d7f commit c21ec3a
Show file tree
Hide file tree
Showing 11 changed files with 376 additions and 364 deletions.
4 changes: 2 additions & 2 deletions MSBuild.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<BuildConfiguration>Release</BuildConfiguration>
<BuildTargets>Clean;Restore;Rebuild;Pack</BuildTargets>
<MajorVersion>0</MajorVersion>
<MinorVersion>9</MinorVersion>
<BuildVersion>4</BuildVersion>
<MinorVersion>10</MinorVersion>
<BuildVersion>0</BuildVersion>
<Version>$(MajorVersion).$(MinorVersion).$(BuildVersion)</Version>
</PropertyGroup>

Expand Down
31 changes: 16 additions & 15 deletions Source/AllegroDotNet.Sandbox/AllegroDotNet.Sandbox.csproj
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AssemblyName>AllegroDotNet.Sandbox</AssemblyName>
<RootNamespace>SubC.AllegroDotNet.Sandbox</RootNamespace>
<Platforms>x64;AnyCPU</Platforms>
</PropertyGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AssemblyName>AllegroDotNet.Sandbox</AssemblyName>
<RootNamespace>SubC.AllegroDotNet.Sandbox</RootNamespace>
<Platforms>x64;AnyCPU</Platforms>
<PublishAot Condition="'$(TargetFramework)' == 'net8.0'">true</PublishAot>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="SubC.AllegroDotNet.Win64" Version="5.2.8.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="SubC.AllegroDotNet.Win64" Version="5.2.9" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\AllegroDotNet\AllegroDotNet.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AllegroDotNet\AllegroDotNet.csproj" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions Source/AllegroDotNet.Sandbox/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@


var transform1 = new AllegroTransform();
transform1.M[0, 1] = 5;
transform1[0, 1] = 5;
var transform2 = new AllegroTransform();
transform2.M[0, 2] = 10;
transform2[0, 2] = 10;
Al.CopyTransform(ref transform1, in transform2);
//Al.UseTransform(in transform1);
var usedTransform = Al.GetCurrentTransform();
Expand Down
6 changes: 6 additions & 0 deletions Source/AllegroDotNet/Al.System.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ public static partial class Al
/// <returns>True if Allegro was initialized, otherwise false.</returns>
public static bool Init()
{
#if NET8_0_OR_GREATER
// Native AoT compatible
foreach (LibraryVersion libraryVersion in Enum.GetValuesAsUnderlyingType(typeof(LibraryVersion)))
#else
// NET Standard 2.0 compatible
foreach (LibraryVersion libraryVersion in Enum.GetValues(typeof(LibraryVersion)))
#endif
{
if (InstallSystem(libraryVersion))
return true;
Expand Down
4 changes: 3 additions & 1 deletion Source/AllegroDotNet/AllegroDotNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
<RepositoryType>git</RepositoryType>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageTags>game 2d allegro allegro5 interop directx opengl multimedia sound input graphics</PackageTags>
<PackageReleaseNotes>Fix AllegroTimeout.</PackageReleaseNotes>
<PackageReleaseNotes>Removed `M` property from AllegroTransform. Made library native AoT compatible with .NET 8.</PackageReleaseNotes>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PublishAot Condition="'$(TargetFramework)' == 'net8.0'">true</PublishAot>
<IsAotCompatible Condition="'$(TargetFramework)' == 'net8.0'">true</IsAotCompatible>
</PropertyGroup>

<ItemGroup>
Expand Down
10 changes: 5 additions & 5 deletions Source/AllegroDotNet/Models/AllegroMemoryInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,26 @@ namespace SubC.AllegroDotNet.Models;
public struct AllegroMemoryInterface
{
public Delegates.MemoryInterfaceCalloc Calloc
{
get => mi_calloc;
{
readonly get => mi_calloc;
set => mi_calloc = value;
}

public Delegates.MemoryInterfaceFree Free
{
get => mi_free;
readonly get => mi_free;
set => mi_free = value;
}

public Delegates.MemoryInterfaceMalloc Malloc
{
get => mi_malloc;
readonly get => mi_malloc;
set => mi_malloc = value;
}

public Delegates.MemoryInterfaceRealloc Realloc
{
get => mi_realloc;
readonly get => mi_realloc;
set => mi_realloc = value;
}

Expand Down
8 changes: 4 additions & 4 deletions Source/AllegroDotNet/Models/AllegroTransform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ namespace SubC.AllegroDotNet.Models;
[StructLayout(LayoutKind.Sequential)]
public struct AllegroTransform
{
public float[,] M
public float this[int row, int col]
{
readonly get => m;
set => m = value;
readonly get => m[row * 4 + col];
set => m[row * 4 + col] = value;
}

[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
private float[,] m = new float[4, 4];
private float[] m = new float[16];

public AllegroTransform()
{
Expand Down
31 changes: 16 additions & 15 deletions Source/Ex.Blend/Ex.Blend.csproj
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<BaseOutputPath>..\..\Artifacts\bin\</BaseOutputPath>
<Platforms>x64;AnyCPU</Platforms>
</PropertyGroup>
<BaseOutputPath>..\..\Artifacts\bin\</BaseOutputPath>
<Platforms>x64;AnyCPU</Platforms>
<PublishAot Condition="'$(TargetFramework)' == 'net8.0'">true</PublishAot>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="SubC.AllegroDotNet.Win64" Version="5.2.8.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="SubC.AllegroDotNet.Win64" Version="5.2.8.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\AllegroDotNet\AllegroDotNet.csproj" />
<ProjectReference Include="..\Ex.Data\Ex.Data.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AllegroDotNet\AllegroDotNet.csproj" />
<ProjectReference Include="..\Ex.Data\Ex.Data.csproj" />
</ItemGroup>

</Project>
31 changes: 16 additions & 15 deletions Source/Ex.Camera/Ex.Camera.csproj
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<BaseOutputPath>..\..\Artifacts\bin\</BaseOutputPath>
<Platforms>x64;AnyCPU</Platforms>
</PropertyGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<BaseOutputPath>..\..\Artifacts\bin\</BaseOutputPath>
<Platforms>x64;AnyCPU</Platforms>
<PublishAot Condition="'$(TargetFramework)' == 'net8.0'">true</PublishAot>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="SubC.AllegroDotNet.Win64" Version="5.2.8.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="SubC.AllegroDotNet.Win64" Version="5.2.8.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\AllegroDotNet\AllegroDotNet.csproj" />
<ProjectReference Include="..\Ex.Data\Ex.Data.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AllegroDotNet\AllegroDotNet.csproj" />
<ProjectReference Include="..\Ex.Data\Ex.Data.csproj" />
</ItemGroup>

</Project>
Loading

0 comments on commit c21ec3a

Please sign in to comment.