Added Base Project

This commit is contained in:
Müller Wayan
2025-02-23 14:29:32 +01:00
parent cda7948be9
commit a6130d4ff0
364 changed files with 12117 additions and 0 deletions
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SFML.Net" Version="2.6.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Firebird2D.Requirement\Firebird2D.Requirement.csproj" />
<ProjectReference Include="..\Firebird2D.SFMLExtensions\Firebird2D.SFMLExtensions.csproj" />
</ItemGroup>
</Project>
+14
View File
@@ -0,0 +1,14 @@
using SFML.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Firebird2D.Datatypes
{
public interface ISpatial
{
public FloatRect Bounds { get; }
}
}
+179
View File
@@ -0,0 +1,179 @@
using Firebird2D.Requirement;
using SFML.Graphics;
using System.Diagnostics.CodeAnalysis;
using Firebird2D.SFMLExtensions;
using System.Drawing;
using SFML.System;
namespace Firebird2D.Datatypes
{
public class Quadtree<T> where T : ISpatial
{
private readonly List<T> _elements = [];
private readonly int _bucketCapacity;
private readonly int _maxDepth;
private Quadtree<T>? _topLeft, _topRight, _bottomLeft, _bottomRight;
public FloatRect Bounds { get; }
public int Level { get; init; }
[MemberNotNullWhen(false, nameof(_topLeft), nameof(_topRight), nameof(_bottomLeft), nameof(_bottomRight))]
public bool IsLeaf
=> _topLeft == null || _topRight == null || _bottomLeft == null || _bottomRight == null;
public bool AllowOutOfBounds { get; set; }
public Quadtree(FloatRect bounds, int bucketCapacity, int maxDepth)
{
Bounds = bounds;
_bucketCapacity = bucketCapacity;
_maxDepth = maxDepth;
}
public Quadtree(FloatRect bounds): this(bounds,32,5) { }
public void Insert(T element)
{
Require.NotNull(element, nameof(element));
if (!(Bounds.Contains(element.Bounds) || AllowOutOfBounds))
throw new ArgumentException(string.Format("{0} is out of Quadtreebounds", nameof(element)), nameof(element));
if (_elements.Count >= _bucketCapacity)
Split();
Quadtree<T>? containingChild = GetContainingChild(element.Bounds);
if (containingChild != null)
{
containingChild.Insert(element);
}
else
{
_elements.Add(element);
}
}
public bool Remove(T element)
{
Require.NotNull(element, nameof(element));
Quadtree<T>? containingChild = GetContainingChild(element.Bounds);
bool removed = containingChild?.Remove(element) ?? _elements.Remove(element);
if (removed && CountElements() <= _bucketCapacity)
Merge();
return removed;
}
public int CountElements()
{
int count = _elements.Count;
if(!IsLeaf)
{
count += _topLeft.CountElements();
count += _topRight.CountElements();
count += _bottomLeft.CountElements();
count += _bottomRight.CountElements();
}
return count;
}
public IEnumerable<T> GetElements()
{
List<T> children = new();
Queue<Quadtree<T>> nodes = new Queue<Quadtree<T>>();
nodes.Enqueue(this);
while (nodes.Count > 0)
{
Quadtree<T> node = nodes.Dequeue();
if (!node.IsLeaf)
{
nodes.Enqueue(node._topLeft);
nodes.Enqueue(node._topRight);
nodes.Enqueue(node._bottomLeft);
nodes.Enqueue(node._bottomRight);
}
children.AddRange(node._elements);
}
return children;
}
private void Split()
{
if (!IsLeaf)
return;
if (Level + 1 > _maxDepth)
return;
_topLeft = CreateChild(Bounds.Location());
_topRight = CreateChild(new Vector2f(Bounds.Center().X, Bounds.Location().Y));
_bottomLeft = CreateChild(new Vector2f(Bounds.Location().X, Bounds.Center().Y));
_bottomRight = CreateChild(Bounds.Center());
List<T> elements = _elements.ToList();
foreach (T element in elements)
{
Quadtree<T>? containingChild = GetContainingChild(element.Bounds);
if (containingChild != null)
{
_elements.Remove(element);
containingChild.Insert(element);
}
}
}
private Quadtree<T> CreateChild(Vector2f location)
=> new(new FloatRect(location, Bounds.Size / 2), _bucketCapacity, _maxDepth) { Level = Level + 1 };
private void Merge()
{
if (IsLeaf)
return;
_elements.AddRange(_topLeft._elements);
_elements.AddRange(_topRight._elements);
_elements.AddRange(_bottomLeft._elements);
_elements.AddRange(_bottomRight._elements);
_topLeft = _topRight = _bottomLeft = _bottomRight = null;
}
private Quadtree<T>? GetContainingChild(FloatRect bounds)
{
if (IsLeaf)
return null;
if(_topLeft.Bounds.Contains(bounds))
return _topLeft;
if (_topRight.Bounds.Contains(bounds))
return _topRight;
if (_bottomLeft.Bounds.Contains(bounds))
return _bottomLeft;
if (_bottomRight.Bounds.Contains(bounds))
return _bottomRight;
return null;
}
}
}
@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
@@ -0,0 +1,23 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.42000
//
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Firebird2D.Datatypes")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Firebird2D.Datatypes")]
[assembly: System.Reflection.AssemblyTitleAttribute("Firebird2D.Datatypes")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Von der MSBuild WriteCodeFragment-Klasse generiert.
@@ -0,0 +1 @@
446a2185d2b171485127b79a872b0f0b15f5920c013f3bc16b19f4e25f29b398
@@ -0,0 +1,13 @@
is_global = true
build_property.TargetFramework = net8.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = Firebird2D.Datatypes
build_property.ProjectDir = C:\Users\wayan\source\repos\SFML_Test\Firebird2D.Datatypes\
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
@@ -0,0 +1,8 @@
// <auto-generated/>
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Threading;
global using global::System.Threading.Tasks;
@@ -0,0 +1,299 @@
{
"format": 1,
"restore": {
"C:\\Users\\wayan\\source\\repos\\SFML_Test\\Firebird2D.Datatypes\\Firebird2D.Datatypes.csproj": {}
},
"projects": {
"C:\\Users\\wayan\\source\\repos\\SFML_Test\\Firebird2D.Datatypes\\Firebird2D.Datatypes.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\Users\\wayan\\source\\repos\\SFML_Test\\Firebird2D.Datatypes\\Firebird2D.Datatypes.csproj",
"projectName": "Firebird2D.Datatypes",
"projectPath": "C:\\Users\\wayan\\source\\repos\\SFML_Test\\Firebird2D.Datatypes\\Firebird2D.Datatypes.csproj",
"packagesPath": "C:\\Users\\wayan\\.nuget\\packages\\",
"outputPath": "C:\\Users\\wayan\\source\\repos\\SFML_Test\\Firebird2D.Datatypes\\obj\\",
"projectStyle": "PackageReference",
"fallbackFolders": [
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
],
"configFilePaths": [
"C:\\Users\\wayan\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"net8.0"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"C:\\TwinCAT\\Functions\\TE2000-HMI-Engineering\\Infrastructure\\Packages": {},
"C:\\TwinCAT\\Functions\\TE2000-HMI-Engineering\\References": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net8.0": {
"targetAlias": "net8.0",
"projectReferences": {
"C:\\Users\\wayan\\source\\repos\\SFML_Test\\Firebird2D.Requirement\\Firebird2D.Requirement.csproj": {
"projectPath": "C:\\Users\\wayan\\source\\repos\\SFML_Test\\Firebird2D.Requirement\\Firebird2D.Requirement.csproj"
},
"C:\\Users\\wayan\\source\\repos\\SFML_Test\\Firebird2D.SFMLExtensions\\Firebird2D.SFMLExtensions.csproj": {
"projectPath": "C:\\Users\\wayan\\source\\repos\\SFML_Test\\Firebird2D.SFMLExtensions\\Firebird2D.SFMLExtensions.csproj"
}
}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
},
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
"auditMode": "direct"
}
},
"frameworks": {
"net8.0": {
"targetAlias": "net8.0",
"dependencies": {
"SFML.Net": {
"target": "Package",
"version": "[2.6.0, )"
}
},
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.303/PortableRuntimeIdentifierGraph.json"
}
}
},
"C:\\Users\\wayan\\source\\repos\\SFML_Test\\Firebird2D.Logger\\Firebird2D.Logger.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\Users\\wayan\\source\\repos\\SFML_Test\\Firebird2D.Logger\\Firebird2D.Logger.csproj",
"projectName": "Firebird2D.Logger",
"projectPath": "C:\\Users\\wayan\\source\\repos\\SFML_Test\\Firebird2D.Logger\\Firebird2D.Logger.csproj",
"packagesPath": "C:\\Users\\wayan\\.nuget\\packages\\",
"outputPath": "C:\\Users\\wayan\\source\\repos\\SFML_Test\\Firebird2D.Logger\\obj\\",
"projectStyle": "PackageReference",
"fallbackFolders": [
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
],
"configFilePaths": [
"C:\\Users\\wayan\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"net8.0"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"C:\\TwinCAT\\Functions\\TE2000-HMI-Engineering\\Infrastructure\\Packages": {},
"C:\\TwinCAT\\Functions\\TE2000-HMI-Engineering\\References": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net8.0": {
"targetAlias": "net8.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
},
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
"auditMode": "direct"
}
},
"frameworks": {
"net8.0": {
"targetAlias": "net8.0",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.303/PortableRuntimeIdentifierGraph.json"
}
}
},
"C:\\Users\\wayan\\source\\repos\\SFML_Test\\Firebird2D.Requirement\\Firebird2D.Requirement.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\Users\\wayan\\source\\repos\\SFML_Test\\Firebird2D.Requirement\\Firebird2D.Requirement.csproj",
"projectName": "Firebird2D.Requirement",
"projectPath": "C:\\Users\\wayan\\source\\repos\\SFML_Test\\Firebird2D.Requirement\\Firebird2D.Requirement.csproj",
"packagesPath": "C:\\Users\\wayan\\.nuget\\packages\\",
"outputPath": "C:\\Users\\wayan\\source\\repos\\SFML_Test\\Firebird2D.Requirement\\obj\\",
"projectStyle": "PackageReference",
"fallbackFolders": [
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
],
"configFilePaths": [
"C:\\Users\\wayan\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"net8.0"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"C:\\TwinCAT\\Functions\\TE2000-HMI-Engineering\\Infrastructure\\Packages": {},
"C:\\TwinCAT\\Functions\\TE2000-HMI-Engineering\\References": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net8.0": {
"targetAlias": "net8.0",
"projectReferences": {
"C:\\Users\\wayan\\source\\repos\\SFML_Test\\Firebird2D.Logger\\Firebird2D.Logger.csproj": {
"projectPath": "C:\\Users\\wayan\\source\\repos\\SFML_Test\\Firebird2D.Logger\\Firebird2D.Logger.csproj"
}
}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
},
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
"auditMode": "direct"
}
},
"frameworks": {
"net8.0": {
"targetAlias": "net8.0",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.303/PortableRuntimeIdentifierGraph.json"
}
}
},
"C:\\Users\\wayan\\source\\repos\\SFML_Test\\Firebird2D.SFMLExtensions\\Firebird2D.SFMLExtensions.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\Users\\wayan\\source\\repos\\SFML_Test\\Firebird2D.SFMLExtensions\\Firebird2D.SFMLExtensions.csproj",
"projectName": "Firebird2D.SFMLExtensions",
"projectPath": "C:\\Users\\wayan\\source\\repos\\SFML_Test\\Firebird2D.SFMLExtensions\\Firebird2D.SFMLExtensions.csproj",
"packagesPath": "C:\\Users\\wayan\\.nuget\\packages\\",
"outputPath": "C:\\Users\\wayan\\source\\repos\\SFML_Test\\Firebird2D.SFMLExtensions\\obj\\",
"projectStyle": "PackageReference",
"fallbackFolders": [
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
],
"configFilePaths": [
"C:\\Users\\wayan\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"net8.0"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"C:\\TwinCAT\\Functions\\TE2000-HMI-Engineering\\Infrastructure\\Packages": {},
"C:\\TwinCAT\\Functions\\TE2000-HMI-Engineering\\References": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net8.0": {
"targetAlias": "net8.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
},
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
"auditMode": "direct"
}
},
"frameworks": {
"net8.0": {
"targetAlias": "net8.0",
"dependencies": {
"SFML.Net": {
"target": "Package",
"version": "[2.6.0, )"
}
},
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.303/PortableRuntimeIdentifierGraph.json"
}
}
}
}
}
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\wayan\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.10.1</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\wayan\.nuget\packages\" />
<SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" />
</ItemGroup>
</Project>
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,15 @@
{
"version": 2,
"dgSpecHash": "D2basdGOZMk=",
"success": true,
"projectFilePath": "C:\\Users\\wayan\\source\\repos\\SFML_Test\\Firebird2D.Datatypes\\Firebird2D.Datatypes.csproj",
"expectedPackageFiles": [
"C:\\Users\\wayan\\.nuget\\packages\\csfml\\2.6.1\\csfml.2.6.1.nupkg.sha512",
"C:\\Users\\wayan\\.nuget\\packages\\sfml.audio\\2.6.0\\sfml.audio.2.6.0.nupkg.sha512",
"C:\\Users\\wayan\\.nuget\\packages\\sfml.graphics\\2.6.0\\sfml.graphics.2.6.0.nupkg.sha512",
"C:\\Users\\wayan\\.nuget\\packages\\sfml.net\\2.6.0\\sfml.net.2.6.0.nupkg.sha512",
"C:\\Users\\wayan\\.nuget\\packages\\sfml.system\\2.6.0\\sfml.system.2.6.0.nupkg.sha512",
"C:\\Users\\wayan\\.nuget\\packages\\sfml.window\\2.6.0\\sfml.window.2.6.0.nupkg.sha512"
],
"logs": []
}