Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kni.Extended #892

Merged
merged 8 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ jobs:
dotnet-version: 6.0.x

- name: Build MonoGame.Extended
run: dotnet build --nologo --verbosity minimal --configuration Release
run: dotnet build MonoGame.Extended.sln --nologo --verbosity minimal --configuration Release

- name: Test MonoGame.Extended
run: dotnet test --nologo --verbosity minimal --configuration Release
run: dotnet test MonoGame.Extended.sln --nologo --verbosity minimal --configuration Release

- name: Pack MonoGame.Extended
run: dotnet pack --nologo --verbosity minimal --configuration Release
run: dotnet pack MonoGame.Extended.sln --nologo --verbosity minimal --configuration Release

- name: Upload Artifacts
uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-request-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
dotnet-version: 6.0.x

- name: Test MonoGame.Extended
run: dotnet test --nologo --verbosity minimal --configuration Release
run: dotnet test MonoGame.Extended.sln --nologo --verbosity minimal --configuration Release
236 changes: 236 additions & 0 deletions KNI.Extended.sln

Large diffs are not rendered by default.

18 changes: 17 additions & 1 deletion benchmarks/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,26 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<ItemGroup>
<ItemGroup Condition="!$(DefineConstants.Contains('KNI'))">
<PackageReference Include="MonoGame.Framework.DesktopGL"
Version="3.8.1.303"
PrivateAssets="All" />
</ItemGroup>

<ItemGroup Condition="$(DefineConstants.Contains('KNI'))">
<PackageReference Include="nkast.Xna.Framework"
Version="3.12.9001" />
<PackageReference Include="nkast.Xna.Framework.Content"
Version="3.12.9001" />
<PackageReference Include="nkast.Xna.Framework.Graphics"
Version="3.12.9001" />
<PackageReference Include="nkast.Xna.Framework.Input"
Version="3.12.9001" />
<PackageReference Include="nkast.Xna.Framework.Game"
Version="3.12.9001" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet"
Version="0.13.12" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<DefineConstants>$(DefineConstants);KNI</DefineConstants>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\src\cs\MonoGame.Extended.Collisions\KNI.Extended.Collisions.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<DefineConstants>$(DefineConstants);KNI</DefineConstants>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\source\MonoGame.Extended\KNI.Extended.csproj" />
</ItemGroup>

</Project>
15 changes: 14 additions & 1 deletion source/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,23 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<ItemGroup>
<ItemGroup Condition="!$(DefineConstants.Contains('KNI'))">
<PackageReference Include="MonoGame.Framework.DesktopGL"
Version="3.8.1.303"
PrivateAssets="All" />
</ItemGroup>

<ItemGroup Condition="$(DefineConstants.Contains('KNI'))">
<PackageReference Include="nkast.Xna.Framework"
Version="3.12.9001" />
<PackageReference Include="nkast.Xna.Framework.Content"
Version="3.12.9001" />
<PackageReference Include="nkast.Xna.Framework.Graphics"
Version="3.12.9001" />
<PackageReference Include="nkast.Xna.Framework.Input"
Version="3.12.9001" />
<PackageReference Include="nkast.Xna.Framework.Game"
Version="3.12.9001" />
</ItemGroup>

</Project>
13 changes: 13 additions & 0 deletions source/MonoGame.Extended.Animations/KNI.Extended.Animations.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<DefineConstants>$(DefineConstants);KNI</DefineConstants>
<Description>Animations to make KNI more awesome.</Description>
<PackageTags>kni animations spritesheet sprite</PackageTags>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\MonoGame.Extended\KNI.Extended.csproj" />
</ItemGroup>

</Project>
13 changes: 13 additions & 0 deletions source/MonoGame.Extended.Collisions/KNI.Extended.Collisions.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<DefineConstants>$(DefineConstants);KNI</DefineConstants>
<Description>Collisions to make KNI more awesome.</Description>
<PackageTags>kni collisions</PackageTags>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\MonoGame.Extended\KNI.Extended.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Microsoft.Xna.Framework.Content.Pipeline;
using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler;
using MonoGame.Extended.BitmapFonts;

namespace MonoGame.Extended.Content.Pipeline.BitmapFonts
{
Expand Down Expand Up @@ -43,12 +44,12 @@ protected override void Write(ContentWriter writer, BitmapFontProcessorResult re

public override string GetRuntimeType(TargetPlatform targetPlatform)
{
return "MonoGame.Extended.BitmapFonts.BitmapFont, MonoGame.Extended";
return typeof(BitmapFont).AssemblyQualifiedName;
}

public override string GetRuntimeReader(TargetPlatform targetPlatform)
{
return "MonoGame.Extended.BitmapFonts.BitmapFontReader, MonoGame.Extended";
return typeof(BitmapFontReader).AssemblyQualifiedName;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<Content Include="$(ArtifactsPath)/bin/Kni.Extended.Content.Pipeline/release/*.dll" Pack="True" PackagePath="tools" />
<Content Include="MonoGame.Extended.Content.Pipeline.targets" Pack="true" PackagePath="build" />
</ItemGroup>

<PropertyGroup>
<DefineConstants>$(DefineConstants);KNI</DefineConstants>
<Description>Content Pipeline importers and processors to make KNI more awesome.</Description>
<PackageTags>kni content importer processor reader tiled texturepacker bmfont animations</PackageTags>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Autofac" Version="5.2.0" />

<PackageReference Include="nkast.Xna.Framework.Content.Pipeline"
Version="3.12.9001" />
<PackageReference Include="nkast.Xna.Framework.Content.Pipeline.Graphics"
Version="3.12.9001" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\MonoGame.Extended.Tiled\KNI.Extended.Tiled.csproj" />
<ProjectReference Include="..\MonoGame.Extended\KNI.Extended.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.IO;
using Microsoft.Xna.Framework.Content.Pipeline;
using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler;
using MonoGame.Extended.Graphics;

namespace MonoGame.Extended.Content.Pipeline.TextureAtlases
{
Expand Down Expand Up @@ -34,12 +35,12 @@ protected override void Write(ContentWriter writer, TexturePackerProcessorResult

public override string GetRuntimeType(TargetPlatform targetPlatform)
{
return "MonoGame.Extended.Graphics.Texture2DAtlas, MonoGame.Extended";
return typeof(Texture2DAtlas).AssemblyQualifiedName;
}

public override string GetRuntimeReader(TargetPlatform targetPlatform)
{
return "MonoGame.Extended.Content.ContentReaders.Texture2DAtlasReader, MonoGame.Extended";
return typeof(ContentReaders.Texture2DAtlasReader).AssemblyQualifiedName;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@ namespace MonoGame.Extended.Content.Pipeline.Tiled
[ContentTypeWriter]
public class TiledMapTilesetWriter : ContentTypeWriter<TiledMapTilesetContentItem>
{
public override string GetRuntimeReader(TargetPlatform targetPlatform) => "MonoGame.Extended.Tiled.TiledMapTilesetReader, MonoGame.Extended.Tiled";
public override string GetRuntimeReader(TargetPlatform targetPlatform)
{
return typeof(TiledMapTilesetReader).AssemblyQualifiedName;
}

public override string GetRuntimeType(TargetPlatform targetPlatform) => "MonoGame.Extended.Tiled.TiledMapTileset, MonoGame.Extended.Tiled";
public override string GetRuntimeType(TargetPlatform targetPlatform)
{
return typeof(TiledMapTileset).AssemblyQualifiedName;
}

protected override void Write(ContentWriter writer, TiledMapTilesetContentItem contentItem)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,14 @@ public static TiledMapObjectType GetObjectType(TiledMapObjectContent content)
return TiledMapObjectType.Rectangle;
}

public override string GetRuntimeType(TargetPlatform targetPlatform) => "MonoGame.Extended.Tiled.TiledMap, MonoGame.Extended.Tiled";
public override string GetRuntimeType(TargetPlatform targetPlatform)
{
return typeof(TiledMap).AssemblyQualifiedName;
}

public override string GetRuntimeReader(TargetPlatform targetPlatform) => "MonoGame.Extended.Tiled.TiledMapReader, MonoGame.Extended.Tiled";
public override string GetRuntimeReader(TargetPlatform targetPlatform)
{
return typeof(TiledMapReader).AssemblyQualifiedName;
}
}
}
13 changes: 13 additions & 0 deletions source/MonoGame.Extended.Entities/KNI.Extended.Entities.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<DefineConstants>$(DefineConstants);KNI</DefineConstants>
<Description>An Entity Component System to make KNI more awesome.</Description>
<PackageTags>kni ecs entity component system</PackageTags>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\MonoGame.Extended\KNI.Extended.csproj" />
</ItemGroup>

</Project>
26 changes: 26 additions & 0 deletions source/MonoGame.Extended.Graphics/KNI.Extended.Graphics.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<DefineConstants>$(DefineConstants);KNI</DefineConstants>
<Description>Graphics makes KNI more awesome.</Description>
<PackageTags>kni graphics batcher effects</PackageTags>
</PropertyGroup>

<ItemGroup>
<None Remove="Effects\Resources\DefaultEffect.dx11.mgfxo" />
<None Remove="Effects\Resources\DefaultEffect.fx" />
<None Remove="Effects\Resources\DefaultEffect.ogl.mgfxo" />
<None Remove="Effects\Resources\Macros.fxh" />
<None Remove="Effects\Resources\Structures.fxh" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="Effects\Resources\DefaultEffect.dx11.mgfxo" />
<EmbeddedResource Include="Effects\Resources\DefaultEffect.ogl.mgfxo" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\MonoGame.Extended\KNI.Extended.csproj" />
</ItemGroup>

</Project>
14 changes: 14 additions & 0 deletions source/MonoGame.Extended.Gui/KNI.Extended.Gui.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<DefineConstants>$(DefineConstants);KNI</DefineConstants>
<Description>A GUI system for KNI written from the ground up to make KNI more awesome.</Description>
<PackageTags>kni gui</PackageTags>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\MonoGame.Extended.Input\KNI.Extended.Input.csproj" />
<ProjectReference Include="..\MonoGame.Extended\KNI.Extended.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public GamePadListener(GamePadListenerSettings settings)
RepeatDelay = settings.RepeatDelay;

_previousGameTime = new GameTime();
_previousState = GamePadState.Default;
_previousState = new GamePadState();
AristurtleDev marked this conversation as resolved.
Show resolved Hide resolved
}

/// <summary>
Expand Down Expand Up @@ -455,7 +455,7 @@ internal static void CheckConnections()
{
_gamePadConnections[(int) index] = !_gamePadConnections[(int) index];
ControllerConnectionChanged?.Invoke(null,
new GamePadEventArgs(GamePadState.Default, GamePad.GetState(index), TimeSpan.Zero, index));
new GamePadEventArgs(new GamePadState(), GamePad.GetState(index), TimeSpan.Zero, index));
}
}
}
Expand Down
13 changes: 13 additions & 0 deletions source/MonoGame.Extended.Input/KNI.Extended.Input.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<DefineConstants>$(DefineConstants);KNI</DefineConstants>
<Description>An event based input system to MonoGame more awesome.</Description>
<PackageTags>kni input event based listeners</PackageTags>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\MonoGame.Extended\KNI.Extended.csproj" />
</ItemGroup>

</Project>
13 changes: 13 additions & 0 deletions source/MonoGame.Extended.Particles/KNI.Extended.Particles.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<DefineConstants>$(DefineConstants);KNI</DefineConstants>
<Description>A high performance particle system to make KNI more awesome.</Description>
<PackageTags>kni particle system</PackageTags>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\MonoGame.Extended\KNI.Extended.csproj" />
</ItemGroup>

</Project>
14 changes: 14 additions & 0 deletions source/MonoGame.Extended.Tiled/KNI.Extended.Tiled.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<DefineConstants>$(DefineConstants);KNI</DefineConstants>
<Description>Support for Tiled maps to make KNI more awesome. See http://www.mapeditor.org</Description>
<PackageTags>kni tiled maps orthographic isometric</PackageTags>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\MonoGame.Extended.Graphics\KNI.Extended.Graphics.csproj" />
<ProjectReference Include="..\MonoGame.Extended\KNI.Extended.csproj" />
</ItemGroup>

</Project>
13 changes: 13 additions & 0 deletions source/MonoGame.Extended.Tweening/KNI.Extended.Tweening.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<DefineConstants>$(DefineConstants);KNI</DefineConstants>
<Description>A tweening system to make KNI more awesome.</Description>
<PackageTags>kni animations tweening</PackageTags>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\MonoGame.Extended\KNI.Extended.csproj" />
</ItemGroup>

</Project>
7 changes: 5 additions & 2 deletions source/MonoGame.Extended/BitmapFonts/BitmapFont.cs
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,11 @@ public static BitmapFont FromStream(GraphicsDevice graphicsDevice, FileStream st
if (!pages.ContainsKey(bmfFile.Pages[i]))
{
string texturePath = Path.Combine(bmfFile.Path, bmfFile.Pages[i]);
Texture2D texture = Texture2D.FromFile(graphicsDevice, texturePath);
pages.Add(bmfFile.Pages[i], texture);
using (Stream textureStream = File.OpenRead(texturePath))
{
Texture2D texture = Texture2D.FromStream(graphicsDevice, textureStream);
pages.Add(bmfFile.Pages[i], texture);
}
}
}

Expand Down
Loading
Loading