mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-14 19:29:36 +01:00
Merge remote-tracking branch 'origin/master' into 25-11-01-cef-update
This commit is contained in:
@@ -19,7 +19,7 @@ resharper_place_field_attribute_on_same_line = if_owner_is_single_line
|
||||
resharper_wrap_chained_binary_patterns = chop_if_long
|
||||
resharper_wrap_chained_method_calls = chop_if_long
|
||||
|
||||
[*.{csproj,xml,yml,dll.config,targets,props}]
|
||||
[*.{csproj,xml,yml,dll.config,targets,props,slnx}]
|
||||
indent_size = 2
|
||||
|
||||
[nuget.config]
|
||||
|
||||
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
@@ -8,5 +8,3 @@
|
||||
*Command.cs @moonheart08
|
||||
*Commands.cs @moonheart08
|
||||
|
||||
# Physics
|
||||
**/Robust.Shared/Physics/** @metalgearsloth
|
||||
|
||||
@@ -22,7 +22,7 @@ jobs:
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4.1.0
|
||||
with:
|
||||
dotnet-version: 9.0.x
|
||||
dotnet-version: 10.0.x
|
||||
|
||||
- name: Install dependencies
|
||||
run: dotnet restore
|
||||
|
||||
2
.github/workflows/build-docfx.yml
vendored
2
.github/workflows/build-docfx.yml
vendored
@@ -14,7 +14,7 @@ jobs:
|
||||
- name: Setup .NET Core
|
||||
uses: actions/setup-dotnet@v4.1.0
|
||||
with:
|
||||
dotnet-version: 9.0.x
|
||||
dotnet-version: 10.0.x
|
||||
|
||||
- name: Install dependencies
|
||||
run: dotnet restore
|
||||
|
||||
8
.github/workflows/build-test.yml
vendored
8
.github/workflows/build-test.yml
vendored
@@ -22,12 +22,10 @@ jobs:
|
||||
- name: Setup .NET Core
|
||||
uses: actions/setup-dotnet@v4.1.0
|
||||
with:
|
||||
dotnet-version: 9.0.x
|
||||
dotnet-version: 10.0.x
|
||||
- name: Install dependencies
|
||||
run: dotnet restore
|
||||
- name: Build
|
||||
run: dotnet build --no-restore /p:WarningsAsErrors=nullable
|
||||
- name: Robust.UnitTesting
|
||||
run: dotnet test --no-build Robust.UnitTesting/Robust.UnitTesting.csproj -- NUnit.ConsoleOut=0
|
||||
- name: Robust.Analyzers.Tests
|
||||
run: dotnet test --no-build Robust.Analyzers.Tests/Robust.Analyzers.Tests.csproj -- NUnit.ConsoleOut=0
|
||||
- name: Run tests
|
||||
run: dotnet test --no-build -- NUnit.ConsoleOut=0
|
||||
|
||||
2
.github/workflows/publish-client.yml
vendored
2
.github/workflows/publish-client.yml
vendored
@@ -23,7 +23,7 @@ jobs:
|
||||
- name: Setup .NET Core
|
||||
uses: actions/setup-dotnet@v4.1.0
|
||||
with:
|
||||
dotnet-version: 9.0.x
|
||||
dotnet-version: 10.0.x
|
||||
|
||||
- name: Package client
|
||||
run: Tools/package_client_build.py
|
||||
|
||||
4
.github/workflows/test-content.yml
vendored
4
.github/workflows/test-content.yml
vendored
@@ -20,7 +20,7 @@ jobs:
|
||||
- name: Setup .NET Core
|
||||
uses: actions/setup-dotnet@v4.1.0
|
||||
with:
|
||||
dotnet-version: 9.0.x
|
||||
dotnet-version: 10.0.x
|
||||
- name: Disable submodule autoupdate
|
||||
run: touch BuildChecker/DISABLE_SUBMODULE_AUTOUPDATE
|
||||
|
||||
@@ -30,6 +30,8 @@ jobs:
|
||||
git fetch origin ${{ github.sha }}
|
||||
git checkout FETCH_HEAD
|
||||
git submodule update --init --recursive
|
||||
- name: Replace global.json
|
||||
run: cp RobustToolbox/global.json .
|
||||
- name: Install dependencies
|
||||
run: dotnet restore
|
||||
- name: Build
|
||||
|
||||
27
Directory.Build.props
Normal file
27
Directory.Build.props
Normal file
@@ -0,0 +1,27 @@
|
||||
<Project>
|
||||
<ItemDefinitionGroup>
|
||||
<PackageReference>
|
||||
<!--
|
||||
Make all packages used by RT default to having everything private except what's needed to run the game (runtime, native)
|
||||
This is to avoid having them leak to content, as they are primarily an implementation detail.
|
||||
Where necessary, this can be overriden by doing PrivateAssets="none" on the PackageReference entry.
|
||||
-->
|
||||
<PrivateAssets>compile;contentFiles;build;buildMultitargeting;buildTransitive;analyzers</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemDefinitionGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<!--
|
||||
Disable transitive project references.
|
||||
This is just to avoid venues of leaky implementation details into content.
|
||||
Being strict is always good.
|
||||
-->
|
||||
<DisableTransitiveProjectReferences>True</DisableTransitiveProjectReferences>
|
||||
|
||||
<!--
|
||||
Shut up broken package pruning warnings.
|
||||
We need these unpruneable packages because of transitive dependency pinning.
|
||||
-->
|
||||
<NoWarn>$(NoWarn);NU1510</NoWarn>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -10,73 +10,75 @@
|
||||
<ManagePackageVersionsCentrally />
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />
|
||||
<PackageVersion Include="BenchmarkDotNet" Version="0.15.8" />
|
||||
<PackageVersion Include="DiscordRichPresence" Version="1.2.1.24" />
|
||||
<PackageVersion Include="JetBrains.Annotations" Version="2024.3.0" />
|
||||
<PackageVersion Include="JetBrains.Profiler.Api" Version="1.4.8" />
|
||||
<PackageVersion Include="JetBrains.Annotations" Version="2025.2.4" />
|
||||
<PackageVersion Include="JetBrains.Profiler.Api" Version="1.4.10" />
|
||||
<PackageVersion Include="Linguini.Bundle" Version="0.8.1" />
|
||||
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0" />
|
||||
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzer.Testing" Version="1.1.2" />
|
||||
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing" Version="1.1.2" />
|
||||
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing" Version="1.1.2" />
|
||||
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.12.0" />
|
||||
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Features" Version="4.12.0" />
|
||||
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.12.0" />
|
||||
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.12.0" />
|
||||
<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="4.12.0" />
|
||||
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.12.0" />
|
||||
<PackageVersion Include="Microsoft.CodeCoverage" Version="17.12.0" />
|
||||
<PackageVersion Include="Microsoft.Data.Sqlite.Core" Version="9.0.0" />
|
||||
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="5.0.0" />
|
||||
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Features" Version="5.0.0" />
|
||||
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="5.0.0" />
|
||||
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="5.0.0" />
|
||||
<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="5.0.0" />
|
||||
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="5.0.0" />
|
||||
<PackageVersion Include="Microsoft.CodeCoverage" Version="18.0.1" />
|
||||
<PackageVersion Include="Microsoft.Data.Sqlite.Core" Version="10.0.0" />
|
||||
<PackageVersion Include="Microsoft.DotNet.RemoteExecutor" Version="8.0.0-beta.24059.4" />
|
||||
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.0" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.0" />
|
||||
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
|
||||
<PackageVersion Include="Microsoft.Extensions.ObjectPool" Version="9.0.0" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Primitives" Version="9.0.0" />
|
||||
<PackageVersion Include="Microsoft.ILVerification" Version="9.0.0" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Logging" Version="10.0.0" />
|
||||
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0" />
|
||||
<PackageVersion Include="Microsoft.Extensions.ObjectPool" Version="10.0.0" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Primitives" Version="10.0.0" />
|
||||
<PackageVersion Include="Microsoft.ILVerification" Version="10.0.0" />
|
||||
<PackageVersion Include="Microsoft.IO.RecyclableMemoryStream" Version="3.0.1" />
|
||||
<PackageVersion Include="Microsoft.NET.ILLink.Tasks" Version="9.0.0" />
|
||||
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
|
||||
<PackageVersion Include="Microsoft.NET.ILLink.Tasks" Version="10.0.0" />
|
||||
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
|
||||
<PackageVersion Include="Microsoft.Win32.Registry" Version="5.0.0" />
|
||||
<PackageVersion Include="Moq" Version="4.20.72" />
|
||||
<PackageVersion Include="NUnit" Version="4.3.2" />
|
||||
<PackageVersion Include="NUnit.Analyzers" Version="4.5.0" />
|
||||
<PackageVersion Include="NUnit3TestAdapter" Version="4.6.0" />
|
||||
<PackageVersion Include="NUnit" Version="4.4.0" />
|
||||
<PackageVersion Include="NUnit.Analyzers" Version="4.11.2" />
|
||||
<PackageVersion Include="NUnit3TestAdapter" Version="5.2.0" />
|
||||
<PackageVersion Include="Nett" Version="0.15.0" />
|
||||
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.2" />
|
||||
<PackageVersion Include="OpenTK.Audio.OpenAL" Version="4.9.4" />
|
||||
<PackageVersion Include="OpenToolkit.Graphics" Version="4.0.0-pre9.1" />
|
||||
<PackageVersion Include="Pidgin" Version="3.3.0" />
|
||||
<PackageVersion Include="Pidgin" Version="3.5.1" />
|
||||
<PackageVersion Include="Robust.Natives" Version="0.2.3" />
|
||||
<PackageVersion Include="Robust.Natives.Zstd" Version="0.1.1-zstd1.5.7" />
|
||||
<PackageVersion Include="Robust.Natives.Cef" Version="131.3.5" />
|
||||
<PackageVersion Include="Robust.Shared.AuthLib" Version="0.1.2" />
|
||||
<PackageVersion Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.10" />
|
||||
<PackageVersion Include="SQLitePCLRaw.bundle_e_sqlite3" Version="3.0.2" />
|
||||
<PackageVersion Include="SQLitePCLRaw.provider.sqlite3" Version="2.1.10" />
|
||||
<PackageVersion Include="Serilog" Version="4.2.0" />
|
||||
<PackageVersion Include="Serilog" Version="4.3.0" />
|
||||
<PackageVersion Include="Serilog.Sinks.Loki" Version="4.0.0-beta3" />
|
||||
<PackageVersion Include="SharpZstd.Interop" Version="1.5.2-beta2" />
|
||||
<PackageVersion Include="SixLabors.ImageSharp" Version="3.1.11" />
|
||||
<PackageVersion Include="SpaceWizards.HttpListener" Version="0.1.1" />
|
||||
<PackageVersion Include="SixLabors.ImageSharp" Version="3.1.12" />
|
||||
<PackageVersion Include="SpaceWizards.HttpListener" Version="0.2.0" />
|
||||
<PackageVersion Include="SpaceWizards.NFluidsynth" Version="0.2.2" />
|
||||
<PackageVersion Include="SpaceWizards.Sdl" Version="1.0.0" />
|
||||
<PackageVersion Include="SpaceWizards.SharpFont" Version="1.1.0" />
|
||||
<PackageVersion Include="SpaceWizards.Sodium" Version="0.2.1" />
|
||||
<PackageVersion Include="SpaceWizards.Sodium" Version="0.3.0" />
|
||||
<PackageVersion Include="SpaceWizards.Fontconfig.Interop" Version="1.0.0" />
|
||||
<PackageVersion Include="libsodium" Version="1.0.20.1" />
|
||||
<PackageVersion Include="System.Management" Version="9.0.8" />
|
||||
<PackageVersion Include="TerraFX.Interop.Windows" Version="10.0.26100.1" />
|
||||
<PackageVersion Include="TerraFX.Interop.Xlib" Version="6.4.0" />
|
||||
<PackageVersion Include="System.Management" Version="10.0.0" />
|
||||
<PackageVersion Include="TerraFX.Interop.Windows" Version="10.0.26100.5" />
|
||||
<PackageVersion Include="TerraFX.Interop.Xlib" Version="6.4.0.2" />
|
||||
<!-- Intentionally kept back, there is a bug that breaks audio for systems without AVX instructions. And the fix is not yet published. -->
|
||||
<PackageVersion Include="VorbisPizza" Version="1.3.0" />
|
||||
<PackageVersion Include="YamlDotNet" Version="16.3.0" />
|
||||
<PackageVersion Include="prometheus-net" Version="8.2.1" />
|
||||
<PackageVersion Include="prometheus-net.DotNetRuntime" Version="4.4.0" />
|
||||
<PackageVersion Include="prometheus-net.DotNetRuntime" Version="4.4.1" />
|
||||
<PackageVersion Include="PolySharp" Version="1.15.0" />
|
||||
|
||||
<PackageVersion Include="System.CommandLine" Version="2.0.1" />
|
||||
<!-- Transitive deps that we need to pin versions for to avoid NuGet warnings. -->
|
||||
<PackageVersion Include="System.Formats.Asn1" Version="9.0.0" />
|
||||
<PackageVersion Include="System.Reflection.Metadata" Version="9.0.0" />
|
||||
<PackageVersion Include="System.Text.Json" Version="9.0.0" />
|
||||
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.12.0" />
|
||||
<PackageVersion Include="System.Formats.Asn1" Version="10.0.0" />
|
||||
<PackageVersion Include="System.Reflection.Metadata" Version="10.0.0" />
|
||||
<PackageVersion Include="System.Text.Json" Version="10.0.0" />
|
||||
<PackageVersion Include="Newtonsoft.Json" Version="13.0.4" />
|
||||
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
6
Imports/Benchmarks.props
Normal file
6
Imports/Benchmarks.props
Normal file
@@ -0,0 +1,6 @@
|
||||
<Project>
|
||||
<!-- Include this .props file from content to get access to the APIs in these projects. -->
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(MSBuildThisFileDirectory)\..\Robust.Benchmarks\Robust.Benchmarks.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
6
Imports/Client.props
Normal file
6
Imports/Client.props
Normal file
@@ -0,0 +1,6 @@
|
||||
<Project>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(MSBuildThisFileDirectory)\..\Robust.Client\Robust.Client.csproj" />
|
||||
<ProjectReference Include="$(MSBuildThisFileDirectory)\..\Avalonia.Base\Avalonia.Base.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
6
Imports/Lidgren.props
Normal file
6
Imports/Lidgren.props
Normal file
@@ -0,0 +1,6 @@
|
||||
<Project>
|
||||
<!-- Include this .props file from content to get access to the APIs in these projects. -->
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(MSBuildThisFileDirectory)\..\Lidgren.Network\Lidgren.Network.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
6
Imports/Packaging.props
Normal file
6
Imports/Packaging.props
Normal file
@@ -0,0 +1,6 @@
|
||||
<Project>
|
||||
<!-- Include this .props file from content to get access to the APIs in these projects. -->
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(MSBuildThisFileDirectory)\..\Robust.Packaging\Robust.Packaging.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
6
Imports/Server.props
Normal file
6
Imports/Server.props
Normal file
@@ -0,0 +1,6 @@
|
||||
<Project>
|
||||
<!-- Include this .props file from content to get access to the APIs in these projects. -->
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(MSBuildThisFileDirectory)\..\Robust.Server\Robust.Server.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
8
Imports/Shared.props
Normal file
8
Imports/Shared.props
Normal file
@@ -0,0 +1,8 @@
|
||||
<Project>
|
||||
<!-- Include this .props file from content to get access to the APIs in these projects. -->
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(MSBuildThisFileDirectory)\..\Robust.Shared\Robust.Shared.csproj" />
|
||||
<ProjectReference Include="$(MSBuildThisFileDirectory)\..\Robust.Shared.Maths\Robust.Shared.Maths.csproj" />
|
||||
<ProjectReference Include="$(MSBuildThisFileDirectory)\..\NetSerializer\NetSerializer\NetSerializer.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
9
Imports/Testing.props
Normal file
9
Imports/Testing.props
Normal file
@@ -0,0 +1,9 @@
|
||||
<Project>
|
||||
<!-- Include this .props file from content to get access to the APIs in these projects. -->
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(MSBuildThisFileDirectory)\..\Robust.Shared.Maths.Testing\Robust.Shared.Maths.Testing.csproj" />
|
||||
<ProjectReference Include="$(MSBuildThisFileDirectory)\..\Robust.Shared.Testing\Robust.Shared.Testing.csproj" />
|
||||
<ProjectReference Include="$(MSBuildThisFileDirectory)\..\Robust.Server.Testing\Robust.Server.Testing.csproj" />
|
||||
<ProjectReference Include="$(MSBuildThisFileDirectory)\..\Robust.UnitTesting\Robust.UnitTesting.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
5
Imports/WebView.props
Normal file
5
Imports/WebView.props
Normal file
@@ -0,0 +1,5 @@
|
||||
<Project>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(MSBuildThisFileDirectory)\..\Robust.Client.WebView\Robust.Client.WebView.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -13,7 +13,7 @@
|
||||
</When>
|
||||
<Otherwise>
|
||||
<PropertyGroup>
|
||||
<DefineConstants>$(DefineConstants);LINUX;UNIX</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);LINUX;UNIX;FREEDESKTOP</DefineConstants>
|
||||
</PropertyGroup>
|
||||
</Otherwise>
|
||||
</Choose>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Project>
|
||||
|
||||
<!-- This file automatically reset by Tools/version.py -->
|
||||
<!-- This file automatically reset by Tools/version.py -->
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<Project>
|
||||
<!-- Engine-specific properties. Content should not use this file. -->
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<LangVersion>13</LangVersion>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<LangVersion>14</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<WarningsAsErrors>nullable</WarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -31,5 +31,6 @@
|
||||
<Python>python3</Python>
|
||||
<Python Condition="'$(ActualOS)' == 'Windows'">py -3</Python>
|
||||
<UseSystemSqlite Condition="'$(TargetOS)' == 'FreeBSD'">True</UseSystemSqlite>
|
||||
<IsFreedesktop Condition="'$(TargetOS)' == 'FreeBSD' Or '$(TargetOS)' == 'Linux'">True</IsFreedesktop>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
||||
17
MSBuild/Robust.ProjectReferences.targets
Normal file
17
MSBuild/Robust.ProjectReferences.targets
Normal file
@@ -0,0 +1,17 @@
|
||||
<Project>
|
||||
<!--
|
||||
Disallow content from using direct references to Robust project files.
|
||||
Content should use the .props files in Imports/ instead.
|
||||
-->
|
||||
|
||||
<PropertyGroup>
|
||||
<AllowDirectRobustReferences Condition="'$(AllowDirectRobustReferences)' != ''">false</AllowDirectRobustReferences>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="_RTCheckForDirectReferences" BeforeTargets="BeforeResolveReferences"
|
||||
Condition="'$(AllowDirectRobustReferences)' != 'true'">
|
||||
<Error File="%(ProjectReference.DefiningProjectFullPath)"
|
||||
Text="Content may not reference %(Filename) directly"
|
||||
Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('%(Identity)', 'RobustToolbox')) and !$([System.Text.RegularExpressions.Regex]::IsMatch('%(DefiningProjectFullPath)', '([Mm]icrosoft|RobustToolbox)'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -3,8 +3,9 @@
|
||||
<!-- Import this at the end of any project files in Robust and Content. -->
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
||||
<RTCullDotnetAnalyzers Condition="'$(RTCullDotnetAnalyzers)' == ''">true</RTCullDotnetAnalyzers>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="Robust.Custom.targets" Condition="Exists('Robust.Custom.targets')"/>
|
||||
@@ -29,4 +30,18 @@
|
||||
|
||||
<!-- serialization generator -->
|
||||
<Import Project="Robust.Serialization.Generator.targets" Condition="'$(SkipRobustAnalyzer)' != 'true'" />
|
||||
|
||||
<!-- Robust API system -->
|
||||
<Import Project="Robust.ProjectReferences.targets" />
|
||||
|
||||
<!--
|
||||
We don't use these features and they add a not-insignificant amount of time to build perf.
|
||||
Am I micro-optimizing? Maybe.
|
||||
-->
|
||||
<Target Name="_RTRemoveSlowAnalyzers" BeforeTargets="AfterResolveReferences" Returns="@(Analyzer)">
|
||||
<ItemGroup Condition="'$(RTCullDotnetAnalyzers)' == 'true'">
|
||||
<Analyzer Remove="@(Analyzer)" Condition="'%(Analyzer.AssemblyName)' == 'Microsoft.Interop.ComInterfaceGenerator'" />
|
||||
<Analyzer Remove="@(Analyzer)" Condition="'%(Analyzer.AssemblyName)' == 'Microsoft.Interop.JavaScript.JSImportGenerator'" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
</Project>
|
||||
|
||||
Submodule NetSerializer updated: 84ab8fec64...61b47fbbbd
@@ -1,18 +0,0 @@
|
||||
//
|
||||
// Cursor.cs
|
||||
//
|
||||
// Copyright (C) 2019 OpenTK
|
||||
//
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the MIT license. See the LICENSE file for details.
|
||||
//
|
||||
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// Opaque handle to a GLFW cursor.
|
||||
/// </summary>
|
||||
public struct Cursor
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
//
|
||||
// ClientApi.cs
|
||||
//
|
||||
// Copyright (C) 2019 OpenTK
|
||||
//
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the MIT license. See the LICENSE file for details.
|
||||
//
|
||||
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// The context client APIs.
|
||||
/// </summary>
|
||||
/// <seealso cref="GLFW.WindowHint(WindowHintClientApi,ClientApi)"/>
|
||||
public enum ClientApi
|
||||
{
|
||||
/// <summary>
|
||||
/// No context API is created.
|
||||
/// </summary>
|
||||
NoApi = 0,
|
||||
|
||||
/// <summary>
|
||||
/// OpenGL context is created.
|
||||
/// </summary>
|
||||
OpenGlApi = 0x00030001,
|
||||
|
||||
/// <summary>
|
||||
/// OpenGL ES context is created.
|
||||
/// </summary>
|
||||
OpenGlEsApi = 0x00030002
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
//
|
||||
// ConnectedState.cs
|
||||
//
|
||||
// Copyright (C) 2019 OpenTK
|
||||
//
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the MIT license. See the LICENSE file for details.
|
||||
//
|
||||
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies connected state of devices.
|
||||
/// </summary>
|
||||
public enum ConnectedState
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates that a device is connected.
|
||||
/// </summary>
|
||||
Connected = 0x00040001,
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that a device is disconnected.
|
||||
/// </summary>
|
||||
Disconnected = 0x00040002
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
//
|
||||
// ContextApi.cs
|
||||
//
|
||||
// Copyright (C) 2019 OpenTK
|
||||
//
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the MIT license. See the LICENSE file for details.
|
||||
//
|
||||
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// The context API used to create the window context.
|
||||
/// </summary>
|
||||
public enum ContextApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Uses the native context API to create the window context.
|
||||
/// </summary>
|
||||
NativeContextApi = 0x00036001,
|
||||
|
||||
/// <summary>
|
||||
/// Uses Egl to create the window context.
|
||||
/// </summary>
|
||||
EglContextApi = 0x00036002
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
//
|
||||
// CursorModeValue.cs
|
||||
//
|
||||
// Copyright (C) 2018 OpenTK
|
||||
//
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the MIT license. See the LICENSE file for details.
|
||||
//
|
||||
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// The GLFW cursor modes.
|
||||
/// See <a href="https://www.glfw.org/docs/latest/input_guide.html#cursor_mode">cursor modes</a>.
|
||||
/// </summary>
|
||||
public enum CursorModeValue
|
||||
{
|
||||
/// <summary>
|
||||
/// The regular arrow cursor (or another cursor set with <see cref="GLFW.SetCursor"/>) is used
|
||||
/// and cursor motion is not limited.
|
||||
/// </summary>
|
||||
CursorNormal = 0x00034001,
|
||||
|
||||
/// <summary>
|
||||
/// Hides the arrow cursor when over a window.
|
||||
/// </summary>
|
||||
CursorHidden = 0x00034002,
|
||||
|
||||
/// <summary>
|
||||
/// Will hide the cursor and lock it to the specified window.
|
||||
/// GLFW will then take care of all the details of cursor re-centering and offset calculation
|
||||
/// and providing the application with a virtual cursor position.
|
||||
/// This virtual position is provided normally via both the cursor position callback and through polling.
|
||||
/// </summary>
|
||||
CursorDisabled = 0x00034003
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
//
|
||||
// CursorShape.cs
|
||||
//
|
||||
// Copyright (C) 2019 OpenTK
|
||||
//
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the MIT license. See the LICENSE file for details.
|
||||
//
|
||||
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// Standard cursor shapes.
|
||||
/// </summary>
|
||||
public enum CursorShape
|
||||
{
|
||||
/// <summary>
|
||||
/// The standard arrow shape. Used in almost all situations.
|
||||
/// </summary>
|
||||
Arrow = 0x00036001,
|
||||
|
||||
/// <summary>
|
||||
/// The I-Beam shape. Used when mousing over a place where text can be entered.
|
||||
/// </summary>
|
||||
IBeam = 0x00036002,
|
||||
|
||||
/// <summary>
|
||||
/// The crosshair shape. Used when dragging and dropping.
|
||||
/// </summary>
|
||||
Crosshair = 0x00036003,
|
||||
|
||||
/// <summary>
|
||||
/// The hand shape. Used when mousing over something that can be dragged around.
|
||||
/// </summary>
|
||||
Hand = 0x00036004,
|
||||
|
||||
/// <summary>
|
||||
/// The horizontal resize shape. Used when mousing over something that can be horizontally resized.
|
||||
/// </summary>
|
||||
HResize = 0x00036005,
|
||||
|
||||
/// <summary>
|
||||
/// The vertical resize shape. Used when mousing over something that can be vertically resized.
|
||||
/// </summary>
|
||||
VResize = 0x00036006
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
//
|
||||
// CursorStateAttribute.cs
|
||||
//
|
||||
// Copyright (C) 2018 OpenTK
|
||||
//
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the MIT license. See the LICENSE file for details.
|
||||
//
|
||||
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// Attribute for setting <see cref="CursorModeValue"/> of the cursor.
|
||||
/// </summary>
|
||||
/// <seealso cref="GLFW.SetInputMode(Window*,CursorStateAttribute,CursorModeValue)"/>
|
||||
/// <seealso cref="GLFW.GetInputMode(Window*,CursorStateAttribute)"/>
|
||||
public enum CursorStateAttribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Attribute for setting <see cref="CursorModeValue"/> of the cursor.
|
||||
/// </summary>
|
||||
Cursor = 0x00033001,
|
||||
}
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
//
|
||||
// ErrorCode.cs
|
||||
//
|
||||
// Copyright (C) 2019 OpenTK
|
||||
//
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the MIT license. See the LICENSE file for details.
|
||||
//
|
||||
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// Error codes, used in the error callback.
|
||||
/// </summary>
|
||||
public enum ErrorCode
|
||||
{
|
||||
/// <summary>
|
||||
/// Everything is running as intended. Yay!
|
||||
/// </summary>
|
||||
NoError = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Called a function before calling <see cref="GLFW.Init"/>. Initialize GLFW and then try again.
|
||||
/// </summary>
|
||||
NotInitialized = 0x00010001,
|
||||
|
||||
/// <summary>
|
||||
/// No OpenGL/OpenGL ES context on this thread.
|
||||
/// </summary>
|
||||
NoContext = 0x00010002,
|
||||
|
||||
/// <summary>
|
||||
/// Used an invalid enum value on a function.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This should hopefully never happen in the bindings, due to the added type safety of C# enums VS. GLFW's native #defines
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
InvalidEnum = 0x00010003,
|
||||
|
||||
/// <summary>
|
||||
/// Called a function with an invalid argument.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This can happen if you request an OpenGL version that doesn't exist, like 2.7.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If you request a version of OpenGL that exists, but isn't supported by this graphics card, it will return VersionUnavailable instead.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
InvalidValue = 0x00010004,
|
||||
|
||||
/// <summary>
|
||||
/// A memory allocation failed on GLFW's end.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Report this to the GLFW issue tracker if encountered.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
OutOfMemory = 0x00010005,
|
||||
|
||||
/// <summary>
|
||||
/// The requested API is not available on the system.
|
||||
/// </summary>
|
||||
ApiUnavailable = 0x00010006,
|
||||
|
||||
/// <summary>
|
||||
/// The requested OpenGL version is not available on the system.
|
||||
/// </summary>
|
||||
VersionUnavailable = 0x00010007,
|
||||
|
||||
/// <summary>
|
||||
/// A platform-specific error occurred that doesn't fit into any more specific category.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Report this to the GLFW issue tracker if encountered.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
PlatformError = 0x00010008,
|
||||
|
||||
/// <summary>
|
||||
/// The requested format is unavailable.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// If emitted during window creation, the requested pixel format isn't available.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If emitted when using the clipboard, the contents of the clipboard couldn't be converted to the requested format.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
FormatUnavailable = 0x00010009,
|
||||
|
||||
/// <summary>
|
||||
/// There is no OpenGL/OpenGL ES context attached to this window.
|
||||
/// </summary>
|
||||
NoWindowContext = 0x0001000A
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
//
|
||||
// InitHint.cs
|
||||
//
|
||||
// Copyright (C) 2019 OpenTK
|
||||
//
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the MIT license. See the LICENSE file for details.
|
||||
//
|
||||
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// Initialization hints are set before <see cref="GLFW.Init"/> and affect how the library behaves until termination.
|
||||
/// Hints are set with <see cref="GLFW.InitHint(InitHintBool, bool)"/>.
|
||||
/// </summary>
|
||||
public enum InitHintBool
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to specify whether to also expose joystick hats as buttons,
|
||||
/// for compatibility with earlier versions of GLFW that did not have
|
||||
/// <see cref="GLFW.GetJoystickHats"/>.
|
||||
/// Set this with <see cref="GLFW.InitHint(InitHintBool, bool)"/>.
|
||||
/// </summary>
|
||||
JoystickHatButtons = 0x00050001,
|
||||
|
||||
/// <summary>
|
||||
/// Used to specify whether to set the current directory to the application to the Contents/Resources
|
||||
/// subdirectory of the application's bundle, if present.
|
||||
/// Set this with <see cref="GLFW.InitHint(InitHintBool, bool)"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Only affects macOS; no effect on other platforms.
|
||||
/// </remarks>
|
||||
CocoaChdirResources = 0x00051001,
|
||||
|
||||
/// <summary>
|
||||
/// Used to specify whether to create a basic menu bar, either from a nib or manually,
|
||||
/// when the first window is created, which is when AppKit is initialized.
|
||||
/// Set this with <see cref="GLFW.InitHint(InitHintBool, bool)"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Only affects macOS; no effect on other platforms.
|
||||
/// </remarks>
|
||||
CocoaMenubar = 0x00051002
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// Initialization hints are set before <see cref="GLFW.Init"/> and affect how the library behaves until termination.
|
||||
/// Hints are set with <see cref="GLFW.InitHint(InitHintInt, int)"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// While this enum has no members,
|
||||
/// it can still be useful because it allows you to access the direct <c>glfwInitHint(int, int)</c> API.
|
||||
/// In case a future version of GLFW adds an int-taking int hint and we don't handle it.
|
||||
/// </remarks>
|
||||
public enum InitHintInt
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
//
|
||||
// InputAction.cs
|
||||
//
|
||||
// Copyright (C) 2019 OpenTK
|
||||
//
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the MIT license. See the LICENSE file for details.
|
||||
//
|
||||
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines event information for <see cref="GLFWCallbacks.KeyCallback"/>
|
||||
/// or <see cref="GLFWCallbacks.MouseButtonCallback"/>.
|
||||
/// </summary>
|
||||
public enum InputAction : byte
|
||||
{
|
||||
/// <summary>
|
||||
/// The key or mouse button was released.
|
||||
/// </summary>
|
||||
Release = 0,
|
||||
|
||||
/// <summary>
|
||||
/// The key or mouse button was pressed.
|
||||
/// </summary>
|
||||
Press = 1,
|
||||
|
||||
/// <summary>
|
||||
/// The key was held down until it repeated.
|
||||
/// </summary>
|
||||
Repeat = 2
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// Status of a joystick hat.
|
||||
/// </summary>
|
||||
public enum JoystickHats : byte
|
||||
{
|
||||
/// <summary>
|
||||
/// Hat is centered.
|
||||
/// </summary>
|
||||
Centered = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Hat is pointing up.
|
||||
/// </summary>
|
||||
Up = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Hat is pointing right.
|
||||
/// </summary>
|
||||
Right = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Hat is pointing down.
|
||||
/// </summary>
|
||||
Down = 4,
|
||||
|
||||
/// <summary>
|
||||
/// Hat is pointing left.
|
||||
/// </summary>
|
||||
Left = 8,
|
||||
|
||||
/// <summary>
|
||||
/// Hat is pointing up and to the right.
|
||||
/// </summary>
|
||||
RightUp = Right | Up,
|
||||
|
||||
/// <summary>
|
||||
/// Hat is pointing down and to the right.
|
||||
/// </summary>
|
||||
RightDown = Right | Down,
|
||||
|
||||
/// <summary>
|
||||
/// Hat is pointing up and to the left.
|
||||
/// </summary>
|
||||
LeftUp = Left | Up,
|
||||
|
||||
/// <summary>
|
||||
/// Hat is pointing down and to the left.
|
||||
/// </summary>
|
||||
LeftDown = Left | Down,
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
//
|
||||
// KeyModifiers.cs
|
||||
//
|
||||
// Copyright (C) 2019 OpenTK
|
||||
//
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the MIT license. See the LICENSE file for details.
|
||||
//
|
||||
|
||||
using System;
|
||||
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// Key modifiers, such as Shift or CTRL.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum KeyModifiers : byte
|
||||
{
|
||||
/// <summary>
|
||||
/// if one or more Shift keys were held down.
|
||||
/// </summary>
|
||||
Shift = 0x0001,
|
||||
|
||||
/// <summary>
|
||||
/// If one or more Control keys were held down.
|
||||
/// </summary>
|
||||
Control = 0x0002,
|
||||
|
||||
/// <summary>
|
||||
/// If one or more Alt keys were held down.
|
||||
/// </summary>
|
||||
Alt = 0x0004,
|
||||
|
||||
/// <summary>
|
||||
/// If one or more Super keys were held down.
|
||||
/// </summary>
|
||||
Super = 0x0008,
|
||||
|
||||
/// <summary>
|
||||
/// If caps lock is enabled.
|
||||
/// </summary>
|
||||
CapsLock = 0x0010,
|
||||
|
||||
/// <summary>
|
||||
/// If num lock is enabled.
|
||||
/// </summary>
|
||||
NumLock = 0x0020,
|
||||
}
|
||||
}
|
||||
@@ -1,627 +0,0 @@
|
||||
//
|
||||
// Keys.cs
|
||||
//
|
||||
// Copyright (C) 2019 OpenTK
|
||||
//
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the MIT license. See the LICENSE file for details.
|
||||
//
|
||||
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies key codes and modifiers in US keyboard layout.
|
||||
/// </summary>
|
||||
public enum Keys : short
|
||||
{
|
||||
/// <summary>
|
||||
/// An unknown key.
|
||||
/// </summary>
|
||||
Unknown = -1,
|
||||
|
||||
/// <summary>
|
||||
/// The spacebar key.
|
||||
/// </summary>
|
||||
Space = 32,
|
||||
|
||||
/// <summary>
|
||||
/// The apostrophe key.
|
||||
/// </summary>
|
||||
Apostrophe = 39 /* ' */,
|
||||
|
||||
/// <summary>
|
||||
/// The comma key.
|
||||
/// </summary>
|
||||
Comma = 44 /* , */,
|
||||
|
||||
/// <summary>
|
||||
/// The minus key.
|
||||
/// </summary>
|
||||
Minus = 45 /* - */,
|
||||
|
||||
/// <summary>
|
||||
/// The period key.
|
||||
/// </summary>
|
||||
Period = 46 /* . */,
|
||||
|
||||
/// <summary>
|
||||
/// The slash key.
|
||||
/// </summary>
|
||||
Slash = 47 /* / */,
|
||||
|
||||
/// <summary>
|
||||
/// The 0 key.
|
||||
/// </summary>
|
||||
D0 = 48,
|
||||
|
||||
/// <summary>
|
||||
/// The 1 key.
|
||||
/// </summary>
|
||||
D1 = 49,
|
||||
|
||||
/// <summary>
|
||||
/// The 2 key.
|
||||
/// </summary>
|
||||
D2 = 50,
|
||||
|
||||
/// <summary>
|
||||
/// The 3 key.
|
||||
/// </summary>
|
||||
D3 = 51,
|
||||
|
||||
/// <summary>
|
||||
/// The 4 key.
|
||||
/// </summary>
|
||||
D4 = 52,
|
||||
|
||||
/// <summary>
|
||||
/// The 5 key.
|
||||
/// </summary>
|
||||
D5 = 53,
|
||||
|
||||
/// <summary>
|
||||
/// The 6 key.
|
||||
/// </summary>
|
||||
D6 = 54,
|
||||
|
||||
/// <summary>
|
||||
/// The 7 key.
|
||||
/// </summary>
|
||||
D7 = 55,
|
||||
|
||||
/// <summary>
|
||||
/// The 8 key.
|
||||
/// </summary>
|
||||
D8 = 56,
|
||||
|
||||
/// <summary>
|
||||
/// The 9 key.
|
||||
/// </summary>
|
||||
D9 = 57,
|
||||
|
||||
/// <summary>
|
||||
/// The semicolon key.
|
||||
/// </summary>
|
||||
Semicolon = 59 /* ; */,
|
||||
|
||||
/// <summary>
|
||||
/// The equal key.
|
||||
/// </summary>
|
||||
Equal = 61 /* = */,
|
||||
|
||||
/// <summary>
|
||||
/// The A key.
|
||||
/// </summary>
|
||||
A = 65,
|
||||
|
||||
/// <summary>
|
||||
/// The B key.
|
||||
/// </summary>
|
||||
B = 66,
|
||||
|
||||
/// <summary>
|
||||
/// The C key.
|
||||
/// </summary>
|
||||
C = 67,
|
||||
|
||||
/// <summary>
|
||||
/// The D key.
|
||||
/// </summary>
|
||||
D = 68,
|
||||
|
||||
/// <summary>
|
||||
/// The E key.
|
||||
/// </summary>
|
||||
E = 69,
|
||||
|
||||
/// <summary>
|
||||
/// The F key.
|
||||
/// </summary>
|
||||
F = 70,
|
||||
|
||||
/// <summary>
|
||||
/// The G key.
|
||||
/// </summary>
|
||||
G = 71,
|
||||
|
||||
/// <summary>
|
||||
/// The H key.
|
||||
/// </summary>
|
||||
H = 72,
|
||||
|
||||
/// <summary>
|
||||
/// The I key.
|
||||
/// </summary>
|
||||
I = 73,
|
||||
|
||||
/// <summary>
|
||||
/// The J key.
|
||||
/// </summary>
|
||||
J = 74,
|
||||
|
||||
/// <summary>
|
||||
/// The K key.
|
||||
/// </summary>
|
||||
K = 75,
|
||||
|
||||
/// <summary>
|
||||
/// The L key.
|
||||
/// </summary>
|
||||
L = 76,
|
||||
|
||||
/// <summary>
|
||||
/// The M key.
|
||||
/// </summary>
|
||||
M = 77,
|
||||
|
||||
/// <summary>
|
||||
/// The N key.
|
||||
/// </summary>
|
||||
N = 78,
|
||||
|
||||
/// <summary>
|
||||
/// The O key.
|
||||
/// </summary>
|
||||
O = 79,
|
||||
|
||||
/// <summary>
|
||||
/// The P key.
|
||||
/// </summary>
|
||||
P = 80,
|
||||
|
||||
/// <summary>
|
||||
/// The Q key.
|
||||
/// </summary>
|
||||
Q = 81,
|
||||
|
||||
/// <summary>
|
||||
/// The R key.
|
||||
/// </summary>
|
||||
R = 82,
|
||||
|
||||
/// <summary>
|
||||
/// The S key.
|
||||
/// </summary>
|
||||
S = 83,
|
||||
|
||||
/// <summary>
|
||||
/// The T key.
|
||||
/// </summary>
|
||||
T = 84,
|
||||
|
||||
/// <summary>
|
||||
/// The U key.
|
||||
/// </summary>
|
||||
U = 85,
|
||||
|
||||
/// <summary>
|
||||
/// The V key.
|
||||
/// </summary>
|
||||
V = 86,
|
||||
|
||||
/// <summary>
|
||||
/// The W key.
|
||||
/// </summary>
|
||||
W = 87,
|
||||
|
||||
/// <summary>
|
||||
/// The X key.
|
||||
/// </summary>
|
||||
X = 88,
|
||||
|
||||
/// <summary>
|
||||
/// The Y key.
|
||||
/// </summary>
|
||||
Y = 89,
|
||||
|
||||
/// <summary>
|
||||
/// The Z key.
|
||||
/// </summary>
|
||||
Z = 90,
|
||||
|
||||
/// <summary>
|
||||
/// The left bracket(opening bracket) key.
|
||||
/// </summary>
|
||||
LeftBracket = 91 /* [ */,
|
||||
|
||||
/// <summary>
|
||||
/// The backslash.
|
||||
/// </summary>
|
||||
Backslash = 92 /* \ */,
|
||||
|
||||
/// <summary>
|
||||
/// The right bracket(closing bracket) key.
|
||||
/// </summary>
|
||||
RightBracket = 93 /* ] */,
|
||||
|
||||
/// <summary>
|
||||
/// The grave accent key.
|
||||
/// </summary>
|
||||
GraveAccent = 96 /* ` */,
|
||||
|
||||
/// <summary>
|
||||
/// Non US keyboard layout key 1.
|
||||
/// </summary>
|
||||
World1 = 161 /* non-US #1 */,
|
||||
|
||||
/// <summary>
|
||||
/// Non US keyboard layout key 2.
|
||||
/// </summary>
|
||||
World2 = 162 /* non-US #2 */,
|
||||
|
||||
/// <summary>
|
||||
/// The escape key.
|
||||
/// </summary>
|
||||
Escape = 256,
|
||||
|
||||
/// <summary>
|
||||
/// The enter key.
|
||||
/// </summary>
|
||||
Enter = 257,
|
||||
|
||||
/// <summary>
|
||||
/// The tab key.
|
||||
/// </summary>
|
||||
Tab = 258,
|
||||
|
||||
/// <summary>
|
||||
/// The backspace key.
|
||||
/// </summary>
|
||||
Backspace = 259,
|
||||
|
||||
/// <summary>
|
||||
/// The insert key.
|
||||
/// </summary>
|
||||
Insert = 260,
|
||||
|
||||
/// <summary>
|
||||
/// The delete key.
|
||||
/// </summary>
|
||||
Delete = 261,
|
||||
|
||||
/// <summary>
|
||||
/// The right arrow key.
|
||||
/// </summary>
|
||||
Right = 262,
|
||||
|
||||
/// <summary>
|
||||
/// The left arrow key.
|
||||
/// </summary>
|
||||
Left = 263,
|
||||
|
||||
/// <summary>
|
||||
/// The down arrow key.
|
||||
/// </summary>
|
||||
Down = 264,
|
||||
|
||||
/// <summary>
|
||||
/// The up arrow key.
|
||||
/// </summary>
|
||||
Up = 265,
|
||||
|
||||
/// <summary>
|
||||
/// The page up key.
|
||||
/// </summary>
|
||||
PageUp = 266,
|
||||
|
||||
/// <summary>
|
||||
/// The page down key.
|
||||
/// </summary>
|
||||
PageDown = 267,
|
||||
|
||||
/// <summary>
|
||||
/// The home key.
|
||||
/// </summary>
|
||||
Home = 268,
|
||||
|
||||
/// <summary>
|
||||
/// The end key.
|
||||
/// </summary>
|
||||
End = 269,
|
||||
|
||||
/// <summary>
|
||||
/// The caps lock key.
|
||||
/// </summary>
|
||||
CapsLock = 280,
|
||||
|
||||
/// <summary>
|
||||
/// The scroll lock key.
|
||||
/// </summary>
|
||||
ScrollLock = 281,
|
||||
|
||||
/// <summary>
|
||||
/// The num lock key.
|
||||
/// </summary>
|
||||
NumLock = 282,
|
||||
|
||||
/// <summary>
|
||||
/// The print screen key.
|
||||
/// </summary>
|
||||
PrintScreen = 283,
|
||||
|
||||
/// <summary>
|
||||
/// The pause key.
|
||||
/// </summary>
|
||||
Pause = 284,
|
||||
|
||||
/// <summary>
|
||||
/// The F1 key.
|
||||
/// </summary>
|
||||
F1 = 290,
|
||||
|
||||
/// <summary>
|
||||
/// The F2 key.
|
||||
/// </summary>
|
||||
F2 = 291,
|
||||
|
||||
/// <summary>
|
||||
/// The F3 key.
|
||||
/// </summary>
|
||||
F3 = 292,
|
||||
|
||||
/// <summary>
|
||||
/// The F4 key.
|
||||
/// </summary>
|
||||
F4 = 293,
|
||||
|
||||
/// <summary>
|
||||
/// The F5 key.
|
||||
/// </summary>
|
||||
F5 = 294,
|
||||
|
||||
/// <summary>
|
||||
/// The F6 key.
|
||||
/// </summary>
|
||||
F6 = 295,
|
||||
|
||||
/// <summary>
|
||||
/// The F7 key.
|
||||
/// </summary>
|
||||
F7 = 296,
|
||||
|
||||
/// <summary>
|
||||
/// The F8 key.
|
||||
/// </summary>
|
||||
F8 = 297,
|
||||
|
||||
/// <summary>
|
||||
/// The F9 key.
|
||||
/// </summary>
|
||||
F9 = 298,
|
||||
|
||||
/// <summary>
|
||||
/// The F10 key.
|
||||
/// </summary>
|
||||
F10 = 299,
|
||||
|
||||
/// <summary>
|
||||
/// The F11 key.
|
||||
/// </summary>
|
||||
F11 = 300,
|
||||
|
||||
/// <summary>
|
||||
/// The F12 key.
|
||||
/// </summary>
|
||||
F12 = 301,
|
||||
|
||||
/// <summary>
|
||||
/// The F13 key.
|
||||
/// </summary>
|
||||
F13 = 302,
|
||||
|
||||
/// <summary>
|
||||
/// The F14 key.
|
||||
/// </summary>
|
||||
F14 = 303,
|
||||
|
||||
/// <summary>
|
||||
/// The F15 key.
|
||||
/// </summary>
|
||||
F15 = 304,
|
||||
|
||||
/// <summary>
|
||||
/// The F16 key.
|
||||
/// </summary>
|
||||
F16 = 305,
|
||||
|
||||
/// <summary>
|
||||
/// The F17 key.
|
||||
/// </summary>
|
||||
F17 = 306,
|
||||
|
||||
/// <summary>
|
||||
/// The F18 key.
|
||||
/// </summary>
|
||||
F18 = 307,
|
||||
|
||||
/// <summary>
|
||||
/// The F19 key.
|
||||
/// </summary>
|
||||
F19 = 308,
|
||||
|
||||
/// <summary>
|
||||
/// The F20 key.
|
||||
/// </summary>
|
||||
F20 = 309,
|
||||
|
||||
/// <summary>
|
||||
/// The F21 key.
|
||||
/// </summary>
|
||||
F21 = 310,
|
||||
|
||||
/// <summary>
|
||||
/// The F22 key.
|
||||
/// </summary>
|
||||
F22 = 311,
|
||||
|
||||
/// <summary>
|
||||
/// The F23 key.
|
||||
/// </summary>
|
||||
F23 = 312,
|
||||
|
||||
/// <summary>
|
||||
/// The F24 key.
|
||||
/// </summary>
|
||||
F24 = 313,
|
||||
|
||||
/// <summary>
|
||||
/// The F25 key.
|
||||
/// </summary>
|
||||
F25 = 314,
|
||||
|
||||
/// <summary>
|
||||
/// The 0 key on the key pad.
|
||||
/// </summary>
|
||||
KeyPad0 = 320,
|
||||
|
||||
/// <summary>
|
||||
/// The 1 key on the key pad.
|
||||
/// </summary>
|
||||
KeyPad1 = 321,
|
||||
|
||||
/// <summary>
|
||||
/// The 2 key on the key pad.
|
||||
/// </summary>
|
||||
KeyPad2 = 322,
|
||||
|
||||
/// <summary>
|
||||
/// The 3 key on the key pad.
|
||||
/// </summary>
|
||||
KeyPad3 = 323,
|
||||
|
||||
/// <summary>
|
||||
/// The 4 key on the key pad.
|
||||
/// </summary>
|
||||
KeyPad4 = 324,
|
||||
|
||||
/// <summary>
|
||||
/// The 5 key on the key pad.
|
||||
/// </summary>
|
||||
KeyPad5 = 325,
|
||||
|
||||
/// <summary>
|
||||
/// The 6 key on the key pad.
|
||||
/// </summary>
|
||||
KeyPad6 = 326,
|
||||
|
||||
/// <summary>
|
||||
/// The 7 key on the key pad.
|
||||
/// </summary>
|
||||
KeyPad7 = 327,
|
||||
|
||||
/// <summary>
|
||||
/// The 8 key on the key pad.
|
||||
/// </summary>
|
||||
KeyPad8 = 328,
|
||||
|
||||
/// <summary>
|
||||
/// The 9 key on the key pad.
|
||||
/// </summary>
|
||||
KeyPad9 = 329,
|
||||
|
||||
/// <summary>
|
||||
/// The decimal key on the key pad.
|
||||
/// </summary>
|
||||
KeyPadDecimal = 330,
|
||||
|
||||
/// <summary>
|
||||
/// The divide key on the key pad.
|
||||
/// </summary>
|
||||
KeyPadDivide = 331,
|
||||
|
||||
/// <summary>
|
||||
/// The multiply key on the key pad.
|
||||
/// </summary>
|
||||
KeyPadMultiply = 332,
|
||||
|
||||
/// <summary>
|
||||
/// The subtract key on the key pad.
|
||||
/// </summary>
|
||||
KeyPadSubtract = 333,
|
||||
|
||||
/// <summary>
|
||||
/// The add key on the key pad.
|
||||
/// </summary>
|
||||
KeyPadAdd = 334,
|
||||
|
||||
/// <summary>
|
||||
/// The enter key on the key pad.
|
||||
/// </summary>
|
||||
KeyPadEnter = 335,
|
||||
|
||||
/// <summary>
|
||||
/// The equal key on the key pad.
|
||||
/// </summary>
|
||||
KeyPadEqual = 336,
|
||||
|
||||
/// <summary>
|
||||
/// The left shift key.
|
||||
/// </summary>
|
||||
LeftShift = 340,
|
||||
|
||||
/// <summary>
|
||||
/// The left control key.
|
||||
/// </summary>
|
||||
LeftControl = 341,
|
||||
|
||||
/// <summary>
|
||||
/// The left alt key.
|
||||
/// </summary>
|
||||
LeftAlt = 342,
|
||||
|
||||
/// <summary>
|
||||
/// The left super key.
|
||||
/// </summary>
|
||||
LeftSuper = 343,
|
||||
|
||||
/// <summary>
|
||||
/// The right shift key.
|
||||
/// </summary>
|
||||
RightShift = 344,
|
||||
|
||||
/// <summary>
|
||||
/// The right control key.
|
||||
/// </summary>
|
||||
RightControl = 345,
|
||||
|
||||
/// <summary>
|
||||
/// The right alt key.
|
||||
/// </summary>
|
||||
RightAlt = 346,
|
||||
|
||||
/// <summary>
|
||||
/// The right super key.
|
||||
/// </summary>
|
||||
RightSuper = 347,
|
||||
|
||||
/// <summary>
|
||||
/// The menu key.
|
||||
/// </summary>
|
||||
Menu = 348,
|
||||
|
||||
/// <summary>
|
||||
/// The last valid key in this enum.
|
||||
/// </summary>
|
||||
LastKey = Menu
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies the buttons of a mouse.
|
||||
/// </summary>
|
||||
public enum MouseButton : byte
|
||||
{
|
||||
/// <summary>
|
||||
/// The first button.
|
||||
/// </summary>
|
||||
Button1 = 0,
|
||||
|
||||
/// <summary>
|
||||
/// The second button.
|
||||
/// </summary>
|
||||
Button2 = 1,
|
||||
|
||||
/// <summary>
|
||||
/// The third button.
|
||||
/// </summary>
|
||||
Button3 = 2,
|
||||
|
||||
/// <summary>
|
||||
/// The fourth button.
|
||||
/// </summary>
|
||||
Button4 = 3,
|
||||
|
||||
/// <summary>
|
||||
/// The fifth button.
|
||||
/// </summary>
|
||||
Button5 = 4,
|
||||
|
||||
/// <summary>
|
||||
/// The sixth button.
|
||||
/// </summary>
|
||||
Button6 = 5,
|
||||
|
||||
/// <summary>
|
||||
/// The seventh button.
|
||||
/// </summary>
|
||||
Button7 = 6,
|
||||
|
||||
/// <summary>
|
||||
/// The eighth button.
|
||||
/// </summary>
|
||||
Button8 = 7,
|
||||
|
||||
/// <summary>
|
||||
/// The left mouse button. This corresponds to <see cref="Button1"/>.
|
||||
/// </summary>
|
||||
Left = Button1,
|
||||
|
||||
/// <summary>
|
||||
/// The right mouse button. This corresponds to <see cref="Button2"/>.
|
||||
/// </summary>
|
||||
Right = Button2,
|
||||
|
||||
/// <summary>
|
||||
/// The middle mouse button. This corresponds to <see cref="Button3"/>.
|
||||
/// </summary>
|
||||
Middle = Button3,
|
||||
|
||||
/// <summary>
|
||||
/// The highest mouse button available.
|
||||
/// </summary>
|
||||
Last = Button8,
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
//
|
||||
// OpenGlProfile.cs
|
||||
//
|
||||
// Copyright (C) 2019 OpenTK
|
||||
//
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the MIT license. See the LICENSE file for details.
|
||||
//
|
||||
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// The OpenGL context profiles.
|
||||
/// </summary>
|
||||
public enum OpenGlProfile
|
||||
{
|
||||
/// <summary>
|
||||
/// Used for unknown OpenGL profile or OpenGL ES.
|
||||
/// </summary>
|
||||
Any = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Known OpenGL Core profile.
|
||||
/// </summary>
|
||||
Core = 0x00032001,
|
||||
|
||||
/// <summary>
|
||||
/// Known OpenGL compatibility profile.
|
||||
/// </summary>
|
||||
Compat = 0x00032002
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
//
|
||||
// ReleaseBehavior.cs
|
||||
//
|
||||
// Copyright (C) 2019 OpenTK
|
||||
//
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the MIT license. See the LICENSE file for details.
|
||||
//
|
||||
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// The context release behaviors.
|
||||
/// </summary>
|
||||
/// <seealso cref="GLFW.WindowHint(WindowHintReleaseBehavior,ReleaseBehavior)"/>
|
||||
public enum ReleaseBehavior
|
||||
{
|
||||
/// <summary>
|
||||
/// Use the default release behavior of the platform.
|
||||
/// </summary>
|
||||
Any = 0,
|
||||
|
||||
/// <summary>
|
||||
/// The pipeline will be flushed whenever the context is released from being the current one.
|
||||
/// </summary>
|
||||
Flush = 0x00035001,
|
||||
|
||||
/// <summary>
|
||||
/// The pipeline will not be flushed on release.
|
||||
/// </summary>
|
||||
None = 0x00035002
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
//
|
||||
// Robustness.cs
|
||||
//
|
||||
// Copyright (C) 2019 OpenTK
|
||||
//
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the MIT license. See the LICENSE file for details.
|
||||
//
|
||||
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// OpenGL context robustness strategy.
|
||||
/// </summary>
|
||||
public enum Robustness
|
||||
{
|
||||
/// <summary>
|
||||
/// No context robustness strategy.
|
||||
/// </summary>
|
||||
NoRobustness = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Robust context without a reset notification.
|
||||
/// </summary>
|
||||
NoResetNotification = 0x00031001,
|
||||
|
||||
/// <summary>
|
||||
/// Lose context on reset.
|
||||
/// </summary>
|
||||
LoseContextOnReset = 0x00031002
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
//
|
||||
// StickyAttributes.cs
|
||||
//
|
||||
// Copyright (C) 2019 OpenTK
|
||||
//
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the MIT license. See the LICENSE file for details.
|
||||
//
|
||||
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// Attributes related to sticky keys and buttons.
|
||||
/// </summary>
|
||||
/// <seealso cref="GLFW.SetInputMode(Window*,StickyAttributes,bool)"/>
|
||||
/// <seealso cref="GLFW.GetInputMode(Window*,StickyAttributes)"/>
|
||||
public enum StickyAttributes
|
||||
{
|
||||
/// <summary>
|
||||
/// Specify whether keyboard input should be sticky or not.
|
||||
/// </summary>
|
||||
StickyKeys = 0x00033002,
|
||||
|
||||
/// <summary>
|
||||
/// Specify whether mouse button input should be sticky or not.
|
||||
/// </summary>
|
||||
StickyMouseButtons = 0x00033003
|
||||
}
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
//
|
||||
// WindowAttributeSetter.cs
|
||||
//
|
||||
// Copyright (C) 2019 OpenTK
|
||||
//
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the MIT license. See the LICENSE file for details.
|
||||
//
|
||||
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to get window related attributes.
|
||||
/// </summary>
|
||||
/// <seealso cref="GLFW.GetWindowAttrib"/>
|
||||
public enum WindowAttributeGetter
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates whether the specified window has input focus.
|
||||
/// Initial input focus is controlled by the window hint with the same name
|
||||
/// </summary>
|
||||
Focused = WindowHintBool.Focused,
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the specified window is iconified,
|
||||
/// whether by the user or with <see cref="GLFW.IconifyWindow"/>.
|
||||
/// </summary>
|
||||
Iconified = WindowHintBool.Iconified,
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the specified window is resizable by the user.
|
||||
/// This is set on creation with the window hint with the same name.
|
||||
/// </summary>
|
||||
Resizable = WindowHintBool.Resizable,
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the specified window is visible.
|
||||
/// Window visibility can be controlled with <see cref="GLFW.ShowWindow"/> and <see cref="GLFW.HideWindow"/>
|
||||
/// and initial visibility is controlled by the window hint with the same name.
|
||||
/// </summary>
|
||||
Visible = WindowHintBool.Visible,
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the specified window has decorations such as a border,a close widget, etc.
|
||||
/// This is set on creation with the window hint with the same name.
|
||||
/// </summary>
|
||||
Decorated = WindowHintBool.Decorated,
|
||||
|
||||
/// <summary>
|
||||
/// Specifies whether the full screen window will automatically iconify and restore
|
||||
/// the previous video mode on input focus loss.
|
||||
/// Possible values are <c>true</c> and <c>false</c>. This hint is ignored for windowed mode windows.
|
||||
/// </summary>
|
||||
AutoIconify = WindowHintBool.AutoIconify,
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the specified window is floating, also called topmost or always-on-top.
|
||||
/// This is controlled by the window hint with the same name.
|
||||
/// </summary>
|
||||
Floating = WindowHintBool.Floating,
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the specified window is maximized,
|
||||
/// whether by the user or with <see cref="GLFW.MaximizeWindow"/>.
|
||||
/// </summary>
|
||||
Maximized = WindowHintBool.Maximized,
|
||||
|
||||
/// <summary>
|
||||
/// Specifies whether the cursor should be centered over newly created full screen windows.
|
||||
/// Possible values are <c>true</c> and <c>false</c>. This hint is ignored for windowed mode windows.
|
||||
/// </summary>
|
||||
CenterCursor = WindowHintBool.CenterCursor,
|
||||
|
||||
/// <summary>
|
||||
/// Specifies whether the window framebuffer will be transparent.
|
||||
/// If enabled and supported by the system, the window framebuffer alpha channel will be used
|
||||
/// to combine the framebuffer with the background.
|
||||
/// This does not affect window decorations. Possible values are <c>true</c> and <c>false</c>.
|
||||
/// </summary>
|
||||
TransparentFramebuffer = WindowHintBool.TransparentFramebuffer,
|
||||
|
||||
/// <summary>
|
||||
/// indicates whether the cursor is currently directly over the client area of the window,
|
||||
/// with no other windows between.
|
||||
/// See <a href="https://www.glfw.org/docs/3.3/input_guide.html#cursor_enter">Cursor enter/leave events</a>
|
||||
/// for details.
|
||||
/// </summary>
|
||||
Hovered = WindowHintBool.Hovered,
|
||||
|
||||
/// <summary>
|
||||
/// Specifies whether the window will be given input focus when <see cref="GLFW.ShowWindow"/> is called.
|
||||
/// Possible values are <c>true</c> and <c>false</c>.
|
||||
/// </summary>
|
||||
FocusOnShow = WindowHintBool.FocusOnShow,
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
//
|
||||
// WindowAttributeSetter.cs
|
||||
//
|
||||
// Copyright (C) 2019 OpenTK
|
||||
//
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the MIT license. See the LICENSE file for details.
|
||||
//
|
||||
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to set window related attributes.
|
||||
/// </summary>
|
||||
/// <seealso cref="GLFW.SetWindowAttrib"/>
|
||||
public enum WindowAttributeSetter
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates whether the specified window is resizable by the user.
|
||||
/// This is set on creation with the window hint with the same name.
|
||||
/// </summary>
|
||||
Resizable = WindowHintBool.Resizable,
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the specified window has decorations such as a border,a close widget, etc.
|
||||
/// This is set on creation with the window hint with the same name.
|
||||
/// </summary>
|
||||
Decorated = WindowHintBool.Decorated,
|
||||
|
||||
/// <summary>
|
||||
/// Specifies whether the full screen window will automatically iconify and restore
|
||||
/// the previous video mode on input focus loss.
|
||||
/// Possible values are <c>true</c> and <c>false</c>. This hint is ignored for windowed mode windows.
|
||||
/// </summary>
|
||||
AutoIconify = WindowHintBool.AutoIconify,
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the specified window is floating, also called topmost or always-on-top.
|
||||
/// This is controlled by the window hint with the same name.
|
||||
/// </summary>
|
||||
Floating = WindowHintBool.Floating,
|
||||
|
||||
/// <summary>
|
||||
/// Specifies whether the window will be given input focus when <see cref="GLFW.ShowWindow"/> is called.
|
||||
/// Possible values are <c>true</c> and <c>false</c>.
|
||||
/// </summary>
|
||||
FocusOnShow = WindowHintBool.FocusOnShow
|
||||
}
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
//
|
||||
// WindowHintBool.cs
|
||||
//
|
||||
// Copyright (C) 2019 OpenTK
|
||||
//
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the MIT license. See the LICENSE file for details.
|
||||
//
|
||||
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// Context related boolean attributes.
|
||||
/// </summary>
|
||||
/// <seealso cref="GLFW.WindowHint(WindowHintBool,bool)"/>
|
||||
public enum WindowHintBool
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates whether the specified window has input focus.
|
||||
/// Initial input focus is controlled by the window hint with the same name
|
||||
/// </summary>
|
||||
Focused = 0x00020001,
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the specified window is iconified,
|
||||
/// whether by the user or with <see cref="GLFW.IconifyWindow"/>.
|
||||
/// </summary>
|
||||
Iconified = 0x00020002,
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the specified window is resizable by the user.
|
||||
/// This is set on creation with the window hint with the same name.
|
||||
/// </summary>
|
||||
Resizable = 0x00020003,
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the specified window is visible.
|
||||
/// Window visibility can be controlled with <see cref="GLFW.ShowWindow"/> and <see cref="GLFW.HideWindow"/>
|
||||
/// and initial visibility is controlled by the window hint with the same name.
|
||||
/// </summary>
|
||||
Visible = 0x00020004,
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the specified window has decorations such as a border,a close widget, etc.
|
||||
/// This is set on creation with the window hint with the same name.
|
||||
/// </summary>
|
||||
Decorated = 0x00020005,
|
||||
|
||||
/// <summary>
|
||||
/// Specifies whether the full screen window will automatically iconify and restore
|
||||
/// the previous video mode on input focus loss.
|
||||
/// Possible values are <c>true</c> and <c>false</c>. This hint is ignored for windowed mode windows.
|
||||
/// </summary>
|
||||
AutoIconify = 0x00020006,
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the specified window is floating, also called topmost or always-on-top.
|
||||
/// This is controlled by the window hint with the same name.
|
||||
/// </summary>
|
||||
Floating = 0x00020007,
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the specified window is maximized,
|
||||
/// whether by the user or with <see cref="GLFW.MaximizeWindow"/>.
|
||||
/// </summary>
|
||||
Maximized = 0x00020008,
|
||||
|
||||
/// <summary>
|
||||
/// Specifies whether the cursor should be centered over newly created full screen windows.
|
||||
/// Possible values are <c>true</c> and <c>false</c>. This hint is ignored for windowed mode windows.
|
||||
/// </summary>
|
||||
CenterCursor = 0x00020009,
|
||||
|
||||
/// <summary>
|
||||
/// Specifies whether the window framebuffer will be transparent.
|
||||
/// If enabled and supported by the system, the window framebuffer alpha channel will be used
|
||||
/// to combine the framebuffer with the background.
|
||||
/// This does not affect window decorations. Possible values are <c>true</c> and <c>false</c>.
|
||||
/// </summary>
|
||||
TransparentFramebuffer = 0x0002000A,
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the cursor is currently directly over the client area of the window,
|
||||
/// with no other windows between.
|
||||
/// See <a href="https://www.glfw.org/docs/3.3/input_guide.html#cursor_enter">Cursor enter/leave events</a>
|
||||
/// for details.
|
||||
/// </summary>
|
||||
Hovered = 0x0002000B,
|
||||
|
||||
/// <summary>
|
||||
/// Specifies whether the window will be given input focus when <see cref="GLFW.ShowWindow"/> is called.
|
||||
/// Possible values are <c>true</c> and <c>false</c>.
|
||||
/// </summary>
|
||||
FocusOnShow = 0x0002000C,
|
||||
|
||||
/// <summary>
|
||||
/// Specifies whether the window's context is an OpenGL forward-compatible one.
|
||||
/// Possible values are <c>true</c> and <c>false</c>.
|
||||
/// </summary>
|
||||
OpenGLForwardCompat = 0x00022006,
|
||||
|
||||
/// <summary>
|
||||
/// Specifies whether the window's context is an OpenGL debug context.
|
||||
/// Possible values are <c>true</c> and <c>false</c>.
|
||||
/// </summary>
|
||||
OpenGLDebugContext = 0x00022007,
|
||||
|
||||
/// <summary>
|
||||
/// Specifies whether errors should be generated by the context.
|
||||
/// If enabled, situations that would have generated errors instead cause undefined behavior.
|
||||
/// </summary>
|
||||
ContextNoError = 0x0002200A,
|
||||
|
||||
/// <summary>
|
||||
/// Specifies whether to use stereoscopic rendering. This is a hard constraint.
|
||||
/// </summary>
|
||||
Stereo = 0x0002100C,
|
||||
|
||||
/// <summary>
|
||||
/// Specifies whether the framebuffer should be double buffered.
|
||||
/// You nearly always want to use double buffering. This is a hard constraint.
|
||||
/// </summary>
|
||||
DoubleBuffer = 0x00021010,
|
||||
|
||||
/// <summary>
|
||||
/// Specifies whether the framebuffer should be sRGB capable.
|
||||
/// If supported, a created OpenGL context will support the
|
||||
/// <c>GL_FRAMEBUFFER_SRGB</c> enable( also called <c>GL_FRAMEBUFFER_SRGB_EXT</c>)
|
||||
/// for controlling sRGB rendering and a created OpenGL ES context will always have sRGB rendering enabled.
|
||||
/// </summary>
|
||||
SrgbCapable = 0x0002100E,
|
||||
|
||||
ScaleToMonitor = 0x0002200C,
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
//
|
||||
// WindowHintClientApi.cs
|
||||
//
|
||||
// Copyright (C) 2019 OpenTK
|
||||
//
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the MIT license. See the LICENSE file for details.
|
||||
//
|
||||
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// Context related client API attribute.
|
||||
/// </summary>
|
||||
/// <seealso cref="GLFW.WindowHint(WindowHintClientApi,ClientApi)"/>
|
||||
public enum WindowHintClientApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates the client API provided by the window's context;
|
||||
/// either <see cref="GraphicsLibraryFramework.ClientApi.OpenGlApi"/>,
|
||||
/// <see cref="GraphicsLibraryFramework.ClientApi.OpenGlEsApi"/> or
|
||||
/// <see cref="GraphicsLibraryFramework.ClientApi.NoApi"/>.
|
||||
/// </summary>
|
||||
ClientApi = 0x00022001,
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
//
|
||||
// WindowHintContextApi.cs
|
||||
//
|
||||
// Copyright (C) 2019 OpenTK
|
||||
//
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the MIT license. See the LICENSE file for details.
|
||||
//
|
||||
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to specify the context creation API.
|
||||
/// </summary>
|
||||
/// <seealso cref="GLFW.WindowHint(WindowHintContextApi,ContextApi)"/>
|
||||
public enum WindowHintContextApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates the context creation API used to create the window's context;
|
||||
/// either <see cref="ContextApi.NativeContextApi"/> or <see cref="ContextApi.EglContextApi"/>.
|
||||
/// </summary>
|
||||
ContextCreationApi = 0x0002200B,
|
||||
}
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
//
|
||||
// WindowHintInt.cs
|
||||
//
|
||||
// Copyright (C) 2018 OpenTK
|
||||
//
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the MIT license. See the LICENSE file for details.
|
||||
//
|
||||
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// Context related attributes.
|
||||
/// </summary>
|
||||
/// <seealso cref="GLFW.WindowHint(WindowHintInt,int)"/>
|
||||
public enum WindowHintInt
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicate the client API version(major part) of the window's context.
|
||||
/// </summary>
|
||||
ContextVersionMajor = 0x00022002,
|
||||
|
||||
/// <summary>
|
||||
/// Indicate the client API version(minor part) of the window's context.
|
||||
/// </summary>
|
||||
ContextVersionMinor = 0x00022003,
|
||||
|
||||
/// <summary>
|
||||
/// Indicate the client API version(revision part) of the window's context.
|
||||
/// </summary>
|
||||
ContextRevision = 0x00022004,
|
||||
|
||||
/// <summary>
|
||||
/// Specify the desired bit depths of the red component of the default framebuffer.
|
||||
/// <see cref="GLFW.DontCare"/> means the application has no preference.
|
||||
/// </summary>
|
||||
RedBits = 0x00021001,
|
||||
|
||||
/// <summary>
|
||||
/// Specify the desired bit depths of the green component of the default framebuffer.
|
||||
/// <see cref="GLFW.DontCare"/> means the application has no preference.
|
||||
/// </summary>
|
||||
GreenBits = 0x00021002,
|
||||
|
||||
/// <summary>
|
||||
/// Specify the desired bit depths of the blue component of the default framebuffer.
|
||||
/// <see cref="GLFW.DontCare"/> means the application has no preference.
|
||||
/// </summary>
|
||||
BlueBits = 0x00021003,
|
||||
|
||||
/// <summary>
|
||||
/// Specify the desired bit depths of the alpha component of the default framebuffer.
|
||||
/// <see cref="GLFW.DontCare"/> means the application has no preference.
|
||||
/// </summary>
|
||||
AlphaBits = 0x00021004,
|
||||
|
||||
/// <summary>
|
||||
/// Specify the desired bit depths of the depth component of the default framebuffer.
|
||||
/// <see cref="GLFW.DontCare"/> means the application has no preference.
|
||||
/// </summary>
|
||||
DepthBits = 0x00021005,
|
||||
|
||||
/// <summary>
|
||||
/// Specify the desired bit depths of the stencil component of the default framebuffer.
|
||||
/// <see cref="GLFW.DontCare"/> means the application has no preference.
|
||||
/// </summary>
|
||||
StencilBits = 0x00021006,
|
||||
|
||||
/// <summary>
|
||||
/// Specify the desired bit depths of the red component of the accumulation buffer.
|
||||
/// <see cref="GLFW.DontCare"/> means the application has no preference.
|
||||
/// </summary>
|
||||
/// <remarks>Accumulation buffers are a legacy OpenGL feature and should not be used in new code.</remarks>
|
||||
AccumRedBits = 0x00021007,
|
||||
|
||||
/// <summary>
|
||||
/// Specify the desired bit depths of the green component of the accumulation buffer.
|
||||
/// <see cref="GLFW.DontCare"/> means the application has no preference.
|
||||
/// </summary>
|
||||
/// <remarks>Accumulation buffers are a legacy OpenGL feature and should not be used in new code.</remarks>
|
||||
AccumGreenBits = 0x00021008,
|
||||
|
||||
/// <summary>
|
||||
/// Specify the desired bit depths of the blue component of the accumulation buffer.
|
||||
/// <see cref="GLFW.DontCare"/> means the application has no preference.
|
||||
/// </summary>
|
||||
/// <remarks>Accumulation buffers are a legacy OpenGL feature and should not be used in new code.</remarks>
|
||||
AccumBlueBits = 0x00021009,
|
||||
|
||||
/// <summary>
|
||||
/// Specify the desired bit depths of the alpha component of the accumulation buffer.
|
||||
/// <see cref="GLFW.DontCare"/> means the application has no preference.
|
||||
/// </summary>
|
||||
/// <remarks>Accumulation buffers are a legacy OpenGL feature and should not be used in new code.</remarks>
|
||||
AccumAlphaBits = 0x0002100A,
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the desired number of auxiliary buffers.
|
||||
/// <see cref="GLFW.DontCare"/> means the application has no preference.
|
||||
/// </summary>
|
||||
/// <remarks>Auxiliary buffers are a legacy OpenGL feature and should not be used in new code.</remarks>
|
||||
AuxBuffers = 0x0002100B,
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the desired number of samples to use for multisampling. Zero disables multisampling.
|
||||
/// <see cref="GLFW.DontCare"/> means the application has no preference.
|
||||
/// </summary>
|
||||
Samples = 0x0002100D,
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the desired refresh rate for full screen windows.
|
||||
/// If set to <see cref="GLFW.DontCare"/>,
|
||||
/// the highest available refresh rate will be used. This hint is ignored for windowed mode windows.
|
||||
/// </summary>
|
||||
RefreshRate = 0x0002100F,
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
//
|
||||
// WindowHintOpenGlProfile.cs
|
||||
//
|
||||
// Copyright (C) 2019 OpenTK
|
||||
//
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the MIT license. See the LICENSE file for details.
|
||||
//
|
||||
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to set the OpenGlProfile attribute.
|
||||
/// </summary>
|
||||
/// <seealso cref="GLFW.WindowHint(WindowHintOpenGlProfile,OpenGlProfile)"/>
|
||||
public enum WindowHintOpenGlProfile
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates the OpenGL profile used by the context.
|
||||
/// This is <see cref="GraphicsLibraryFramework.OpenGlProfile.Core"/>
|
||||
/// or <see cref="GraphicsLibraryFramework.OpenGlProfile.Compat"/>
|
||||
/// if the context uses a known profile, or <see cref="GraphicsLibraryFramework.OpenGlProfile.Any"/>
|
||||
/// if the OpenGL profile is unknown or the context is an OpenGL ES context.
|
||||
/// Note that the returned profile may not match the profile bits of the context flags,
|
||||
/// as GLFW will try other means of detecting the profile when no bits are set. TODO: enum for missing crefs
|
||||
/// </summary>
|
||||
OpenGlProfile = 0x00022008,
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
//
|
||||
// WindowHintReleaseBehavior.cs
|
||||
//
|
||||
// Copyright (C) 2019 OpenTK
|
||||
//
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the MIT license. See the LICENSE file for details.
|
||||
//
|
||||
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to specify the release behavior used by the local context.
|
||||
/// </summary>
|
||||
/// <seealso cref="GLFW.WindowHint(WindowHintReleaseBehavior,ReleaseBehavior)"/>
|
||||
public enum WindowHintReleaseBehavior
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies the release behavior to be used by the context.
|
||||
/// Possible values are one of <see cref="ReleaseBehavior.Any"/>,
|
||||
/// <see cref="ReleaseBehavior.Flush"/> or <see cref="ReleaseBehavior.None"/>.
|
||||
/// If the behavior is <see cref="ReleaseBehavior"/>, the default behavior
|
||||
/// of the context creation API will be used.
|
||||
/// If the behavior is <see cref="ReleaseBehavior.Flush"/>, the pipeline will be flushed
|
||||
/// whenever the context is released from being the current one.
|
||||
/// If the behavior is <see cref="ReleaseBehavior.None"/>, the pipeline will not be flushed on release.
|
||||
/// </summary>
|
||||
ContextReleaseBehavior = 0x00022009,
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
//
|
||||
// WindowHintRobustness.cs
|
||||
//
|
||||
// Copyright (C) 2019 OpenTK
|
||||
//
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the MIT license. See the LICENSE file for details.
|
||||
//
|
||||
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to set context robustness attribute.
|
||||
/// </summary>
|
||||
/// <seealso cref="GLFW.WindowHint(WindowHintRobustness,Robustness)"/>
|
||||
public enum WindowHintRobustness
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates the robustness strategy used by the context.
|
||||
/// This is <see cref="Robustness.LoseContextOnReset"/> or <see cref="Robustness.NoResetNotification"/>
|
||||
/// if the window's context supports robustness, or <see cref="Robustness.NoRobustness"/> otherwise.
|
||||
/// </summary>
|
||||
ContextRobustness = 0x00022005,
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// Window hints for the WindowHintString function.
|
||||
/// </summary>
|
||||
public enum WindowHintString
|
||||
{
|
||||
/// <summary>
|
||||
/// Sets the frame name on Cocoa. On any other platform, this does nothing.
|
||||
/// </summary>
|
||||
CocoaFrameName = 0x00023002,
|
||||
|
||||
/// <summary>
|
||||
/// Sets the class name on X11. On any other platform, this does nothing.
|
||||
/// </summary>
|
||||
X11ClassName = 0x00024001,
|
||||
|
||||
/// <summary>
|
||||
/// Sets the instance name on X11. on any other platform, this does nothing.
|
||||
/// </summary>
|
||||
X11InstanceName = 0x00024002,
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,180 +0,0 @@
|
||||
//
|
||||
// GLFWCallbacks.cs
|
||||
//
|
||||
// Copyright (C) 2019 OpenTK
|
||||
//
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the MIT license. See the LICENSE file for details.
|
||||
//
|
||||
|
||||
using System;
|
||||
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// Class containing GLFW related callbacks.
|
||||
/// </summary>
|
||||
public static unsafe class GLFWCallbacks
|
||||
{
|
||||
/// <summary>
|
||||
/// The function signature for Unicode character callback functions.
|
||||
/// </summary>
|
||||
/// <param name="window">The window that received the event.</param>
|
||||
/// <param name="codepoint">The Unicode code point of the character.</param>
|
||||
/// <seealso cref="GLFW.SetCharCallback"/>
|
||||
public delegate void CharCallback(Window* window, uint codepoint);
|
||||
|
||||
/// <summary>
|
||||
/// The function signature for Unicode character with modifiers callback functions.
|
||||
/// It is called for each input character, regardless of what modifier keys are held down.
|
||||
/// </summary>
|
||||
/// <param name="window">The window that received the event.</param>
|
||||
/// <param name="codepoint">The Unicode code point of the character.</param>
|
||||
/// <param name="modifiers">Bit field describing which modifier keys were held down.</param>
|
||||
/// <seealso cref="GLFW.SetCharModsCallback"/>
|
||||
public delegate void CharModsCallback(Window* window, uint codepoint, KeyModifiers modifiers);
|
||||
|
||||
/// <summary>
|
||||
/// The function signature for cursor enter/leave callback functions.
|
||||
/// </summary>
|
||||
/// <param name="window">The window that received the event.</param>
|
||||
/// <param name="entered"><c>true</c> if the cursor entered the window's client area, or <c>false</c> if it left it.</param>
|
||||
/// <seealso cref="GLFW.SetCursorEnterCallback"/>
|
||||
public delegate void CursorEnterCallback(Window* window, bool entered);
|
||||
|
||||
/// <summary>
|
||||
/// The function signature for cursor position callback functions.
|
||||
/// </summary>
|
||||
/// <param name="window">The window that received the event.</param>
|
||||
/// <param name="x">The new cursor x-coordinate, relative to the left edge of the client area.</param>
|
||||
/// <param name="y">The new cursor y-coordinate, relative to the top edge of the client area.</param>
|
||||
/// <seealso cref="GLFW.SetCursorPosCallback"/>
|
||||
public delegate void CursorPosCallback(Window* window, double x, double y);
|
||||
|
||||
/// <summary>
|
||||
/// The function signature for file drop callbacks.
|
||||
/// </summary>
|
||||
/// <param name="window">The window that received the event.</param>
|
||||
/// <param name="count">The number of dropped files.</param>
|
||||
/// <param name="paths">The UTF-8 encoded file and/or directory path names.</param>
|
||||
/// <seealso cref="GLFW.SetDropCallback"/>
|
||||
public delegate void DropCallback(Window* window, int count, byte** paths);
|
||||
|
||||
/// <summary>
|
||||
/// The function signature for joystick configuration callback functions.
|
||||
/// </summary>
|
||||
/// <param name="joystick">The joystick that was connected or disconnected.</param>
|
||||
/// <param name="state">
|
||||
/// One of <see cref="ConnectedState.Connected"/> or <see cref="ConnectedState.Disconnected"/>.
|
||||
/// </param>
|
||||
/// <seealso cref="GLFW.SetJoystickCallback"/>
|
||||
public delegate void JoystickCallback(int joystick, ConnectedState state);
|
||||
|
||||
/// <summary>
|
||||
/// The function signature for keyboard key callback functions.
|
||||
/// </summary>
|
||||
/// <param name="window">The window that received the event.</param>
|
||||
/// <param name="key">The keyboard key that was pressed or released.</param>
|
||||
/// <param name="scanCode">The system-specific scancode of the key.</param>
|
||||
/// <param name="action">The <see cref="InputAction"/> for that <paramref name="key"/>.</param>
|
||||
/// <param name="mods">Bit field describing which modifier keys were held down.</param>
|
||||
/// <seealso cref="GLFW.SetKeyCallback"/>
|
||||
public delegate void KeyCallback(Window* window, Keys key, int scanCode, InputAction action, KeyModifiers mods);
|
||||
|
||||
/// <summary>
|
||||
/// The function signature for mouse button callback functions.
|
||||
/// </summary>
|
||||
/// <param name="window">The window that received the event.</param>
|
||||
/// <param name="button">The mouse button that was pressed or released.</param>
|
||||
/// <param name="action">One of <see cref="InputAction.Press"/> or <see cref="InputAction.Release"/>.</param>
|
||||
/// <param name="mods">Bit field describing which modifier keys were held down.</param>
|
||||
/// <seealso cref="GLFW.SetMouseButtonCallback"/>
|
||||
public delegate void MouseButtonCallback(Window* window, MouseButton button, InputAction action, KeyModifiers mods); // TODO: Make enums for int params in callback
|
||||
|
||||
/// <summary>
|
||||
/// The function signature for scroll callback functions.
|
||||
/// </summary>
|
||||
/// <param name="window">The window that received the event.</param>
|
||||
/// <param name="offsetX">The scroll offset along the x-axis.</param>
|
||||
/// <param name="offsetY">The scroll offset along the y-axis.</param>
|
||||
/// <seealso cref="GLFW.SetScrollCallback"/>
|
||||
public delegate void ScrollCallback(Window* window, double offsetX, double offsetY);
|
||||
|
||||
/// <summary>
|
||||
/// The function signature for monitor configuration callback functions.
|
||||
/// </summary>
|
||||
/// <param name="monitor">The monitor that was connected or disconnected.</param>
|
||||
/// <param name="state">
|
||||
/// One <see cref="ConnectedState.Connected"/> of or <see cref="ConnectedState.Disconnected"/>.
|
||||
/// </param>
|
||||
/// <seealso cref="GLFW.SetMonitorCallback"/>
|
||||
public delegate void MonitorCallback(Monitor* monitor, ConnectedState state);
|
||||
|
||||
/// <summary>
|
||||
/// The function signature for window close callback functions.
|
||||
/// </summary>
|
||||
/// <param name="window">The window that the user attempted to close.</param>
|
||||
/// <seealso cref="GLFW.SetWindowCloseCallback"/>
|
||||
public delegate void WindowCloseCallback(Window* window);
|
||||
|
||||
/// <summary>
|
||||
/// The function signature for window focus callback functions.
|
||||
/// </summary>
|
||||
/// <param name="window">The window that gained or lost input focus.</param>
|
||||
/// <param name="focused"><c>true</c> if the window was given input focus, or <c>false</c> if it lost it.</param>
|
||||
/// <seealso cref="GLFW.SetWindowFocusCallback"/>
|
||||
public delegate void WindowFocusCallback(Window* window, bool focused);
|
||||
|
||||
/// <summary>
|
||||
/// The function signature for window iconify/restore callback functions.
|
||||
/// </summary>
|
||||
/// <param name="window">The window that was iconified or restored.</param>
|
||||
/// <param name="iconified"><c>true</c> if the window was iconified(minimized), or <c>false</c> if it was restored.</param>
|
||||
/// <seealso cref="GLFW.SetWindowIconifyCallback"/>
|
||||
public delegate void WindowIconifyCallback(Window* window, bool iconified);
|
||||
|
||||
/// <summary>
|
||||
/// The function signature for window position callback functions.
|
||||
/// </summary>
|
||||
/// <param name="window">The window that was moved.</param>
|
||||
/// <param name="x">
|
||||
/// The new x-coordinate, in screen coordinates, of the upper-left corner of the client area of the window.
|
||||
/// </param>
|
||||
/// <param name="y">
|
||||
/// The new y-coordinate, in screen coordinates, of the upper-left corner of the client area of the window.
|
||||
/// </param>
|
||||
/// <seealso cref="GLFW.SetWindowPosCallback"/>
|
||||
public delegate void WindowPosCallback(Window* window, int x, int y);
|
||||
|
||||
/// <summary>
|
||||
/// The function signature for window size callback functions.
|
||||
/// </summary>
|
||||
/// <param name="window">The window that was resized.</param>
|
||||
/// <param name="width">The new width, in screen coordinates, of the window.</param>
|
||||
/// <param name="height">The new height, in screen coordinates, of the window.</param>
|
||||
/// <seealso cref="GLFW.SetWindowSizeCallback"/>
|
||||
public delegate void WindowSizeCallback(Window* window, int width, int height);
|
||||
|
||||
/// <summary>
|
||||
/// The function signature for error callback functions.
|
||||
/// </summary>
|
||||
/// <param name="error">An error code.</param>
|
||||
/// <param name="description">A UTF-8 encoded string describing the error.</param>
|
||||
public delegate void ErrorCallback(ErrorCode error, string description);
|
||||
|
||||
/// <summary>
|
||||
/// The function signature for window refresh functions.
|
||||
/// </summary>
|
||||
/// <param name="window">The window that needs to be refreshed.</param>
|
||||
public delegate void WindowRefreshCallback(Window* window);
|
||||
|
||||
/// <summary>
|
||||
/// This is the function pointer type for window content scale callbacks.
|
||||
/// </summary>
|
||||
/// <param name="window">The window whose content scale changed. </param>
|
||||
/// <param name="xscale">The new x-axis content scale of the window. </param>
|
||||
/// <param name="yscale">The new y-axis content scale of the window.</param>
|
||||
/// <seealso cref="GLFW.SetWindowContentScaleCallback"/>
|
||||
public delegate void WindowContentScaleCallback(Window* window, float xscale, float yscale);
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
//
|
||||
// GLFWException.cs
|
||||
//
|
||||
// Copyright (C) 2018 OpenTK
|
||||
//
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the MIT license. See the LICENSE file for details.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents errors that occur within GLFW.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class GLFWException : Exception
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the underlying GLFW-error code.
|
||||
/// </summary>
|
||||
public ErrorCode ErrorCode { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GLFWException"/> class.
|
||||
/// </summary>
|
||||
public GLFWException()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GLFWException"/> class with the specified detailed description.
|
||||
/// </summary>
|
||||
/// <param name="message">A detailed description of the error.</param>
|
||||
public GLFWException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GLFWException"/> class
|
||||
/// with the specified detailed description and GLFW error code.
|
||||
/// </summary>
|
||||
/// <param name="message">A detailed description of the error.</param>
|
||||
/// <param name="errorCode">The GLFW error code causing the exception.</param>
|
||||
public GLFWException(string message, ErrorCode errorCode)
|
||||
: base(message)
|
||||
{
|
||||
ErrorCode = errorCode;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GLFWException"/> class with the specified detailed description
|
||||
/// and the specified exception.
|
||||
/// </summary>
|
||||
/// <param name="message">A detailed description of the error.</param>
|
||||
/// <param name="innerException">A reference to the inner exception that is the cause of this exception.</param>
|
||||
public GLFWException(string message, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,414 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
internal static unsafe class GLFWNative
|
||||
{
|
||||
private const string LibraryName = "glfw3.dll";
|
||||
|
||||
public const int GLFW_TRUE = 1;
|
||||
public const int GLFW_FALSE = 0;
|
||||
|
||||
#if NETCOREAPP
|
||||
static GLFWNative()
|
||||
{
|
||||
// Register DllImport resolver so that the correct dynamic library is loaded on all platforms.
|
||||
// On net472, we rely on Mono's DllMap for this. See the .dll.config file.
|
||||
NativeLibrary.SetDllImportResolver(typeof(GLFWNative).Assembly, (name, assembly, path) =>
|
||||
{
|
||||
// Please keep in sync with what Robust.Shared/DllMapHelper.cs does.
|
||||
|
||||
if (name != "glfw3.dll")
|
||||
{
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
|
||||
string rName = null;
|
||||
if (OperatingSystem.IsLinux() || OperatingSystem.IsFreeBSD()) rName = "libglfw.so.3";
|
||||
else if (OperatingSystem.IsMacOS()) rName = "libglfw.3.dylib";
|
||||
|
||||
if ((rName != null) && NativeLibrary.TryLoad(rName, assembly, path, out var handle))
|
||||
return handle;
|
||||
|
||||
return IntPtr.Zero;
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern int glfwInit();
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwTerminate();
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwInitHint(int hint, int value);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwGetVersion(int* major, int* minor, int* revision);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern byte* glfwGetVersionString();
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern ErrorCode glfwGetError(byte** description);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern Monitor** glfwGetMonitors(int* count);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwGetMonitorPos(Monitor* monitor, int* x, int* y);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwGetMonitorPhysicalSize(Monitor* monitor, int* width, int* height);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwGetMonitorContentScale(Monitor* monitor, float* xscale, float* yscale);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern byte* glfwGetMonitorName(Monitor* monitor);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwSetMonitorUserPointer(Monitor* monitor, void* pointer);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void* glfwGetMonitorUserPointer(Monitor* monitor);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern VideoMode* glfwGetVideoModes(Monitor* monitor, int* count);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwSetGamma(Monitor* monitor, float gamma);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern GammaRamp* glfwGetGammaRamp(Monitor* monitor);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwSetGammaRamp(Monitor* monitor, GammaRamp* ramp);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwDefaultWindowHints();
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwWindowHintString(int hint, byte* value);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwSetWindowSizeLimits(Window* window, int minwidth, int minheight, int maxwidth, int maxheight);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwSetWindowAspectRatio(Window* window, int numer, int denom);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwGetWindowFrameSize(Window* window, int* left, int* top, int* right, int* bottom);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwGetWindowContentScale(Window* window, float* xscale, float* yscale);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern float glfwGetWindowOpacity(Window* window);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwSetWindowOpacity(Window* window, float opacity);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwRequestWindowAttention(Window* window);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwSetWindowAttrib(Window* window, WindowAttributeSetter attrib, int value);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern int glfwRawMouseMotionSupported();
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern byte* glfwGetKeyName(Keys key, int scancode);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern int glfwGetKeyScancode(Keys key);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern InputAction glfwGetKey(Window* window, Keys key);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern InputAction glfwGetMouseButton(Window* window, MouseButton button);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwGetCursorPos(Window* window, double* xpos, double* ypos);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwSetCursorPos(Window* window, double xpos, double ypos);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern Cursor* glfwCreateCursor(Image* image, int xhot, int yhot);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern Cursor* glfwCreateStandardCursor(CursorShape shape);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwDestroyCursor(Cursor* cursor);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwSetCursor(Window* window, Cursor* cursor);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern int glfwJoystickPresent(int jid);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern float* glfwGetJoystickAxes(int jid, int* count);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern InputAction* glfwGetJoystickButtons(int jid, int* count);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern JoystickHats* glfwGetJoystickHats(int jid, int* count);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern byte* glfwGetJoystickName(int jid);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern byte* glfwGetJoystickGUID(int jid);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwSetJoystickUserPointer(int jid, void* ptr);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void* glfwGetJoystickUserPointer(int jid);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern int glfwJoystickIsGamepad(int jid);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern int glfwUpdateGamepadMappings(byte* newMapping);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern byte* glfwGetGamepadName(int jid);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern int glfwGetGamepadState(int jid, GamepadState* state);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern double glfwGetTime();
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwSetTime(double time);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern long glfwGetTimerValue();
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern long glfwGetTimerFrequency();
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern Window* glfwGetCurrentContext();
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwSwapBuffers(Window* window);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern int glfwExtensionSupported(byte* extensionName);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern IntPtr glfwGetProcAddress(byte* procame);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern Window* glfwCreateWindow(int width, int height, byte* title, Monitor* monitor, Window* share);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern Monitor* glfwGetPrimaryMonitor();
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwDestroyWindow(Window* window);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwFocusWindow(Window* window);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwGetFramebufferSize(Window* window, int* width, int* height);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern CursorModeValue glfwGetInputMode(Window* window, CursorStateAttribute mode);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern int glfwGetInputMode(Window* window, StickyAttributes mode);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwRestoreWindow(Window* window);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern VideoMode* glfwGetVideoMode(Monitor* monitor);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern int glfwGetWindowAttrib(Window* window, WindowAttributeGetter attribute);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwGetWindowSize(Window* window, int* width, int* height);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwGetWindowPos(Window* window, int* x, int* y);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern Monitor* glfwGetWindowMonitor(Window* window);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwHideWindow(Window* window);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwIconifyWindow(Window* window);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwMakeContextCurrent(Window* window);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwMaximizeWindow(Window* window);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwPollEvents();
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwPostEmptyEvent();
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwWindowHint(WindowHintInt hint, int value);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwWindowHint(WindowHintBool hint, int value);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwWindowHint(WindowHintClientApi hint, ClientApi value);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwWindowHint(WindowHintReleaseBehavior hint, ReleaseBehavior value);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwWindowHint(WindowHintContextApi hint, ContextApi value);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwWindowHint(WindowHintRobustness hint, Robustness value);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwWindowHint(WindowHintOpenGlProfile hint, OpenGlProfile value);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern int glfwWindowShouldClose(Window* window);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern IntPtr glfwSetCharCallback(Window* window, IntPtr callback);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern IntPtr glfwSetCharModsCallback(Window* window, IntPtr callback);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern IntPtr glfwSetCursorEnterCallback(Window* window, IntPtr callback);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern IntPtr glfwSetCursorPosCallback(Window* window, IntPtr callback);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern IntPtr glfwSetDropCallback(Window* window, IntPtr callback);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern IntPtr glfwSetErrorCallback(IntPtr callback);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwSetInputMode(Window* window, CursorStateAttribute mode, CursorModeValue value);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwSetInputMode(Window* window, StickyAttributes mode, int value);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern IntPtr glfwSetJoystickCallback(IntPtr callback);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern IntPtr glfwSetKeyCallback(Window* window, IntPtr callback);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern IntPtr glfwSetScrollCallback(Window* window, IntPtr callback);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern IntPtr glfwSetMonitorCallback(IntPtr callback);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern IntPtr glfwSetMouseButtonCallback(Window* window, IntPtr callback);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern IntPtr glfwSetWindowCloseCallback(Window* window, IntPtr callback);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern IntPtr glfwSetWindowFocusCallback(Window* window, IntPtr callback);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwSetWindowIcon(Window* window, int count, Image* images);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern IntPtr glfwSetWindowIconifyCallback(Window* window, IntPtr callback);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern IntPtr glfwSetWindowContentScaleCallback(Window* window, IntPtr callback);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwSetWindowTitle(Window* window, byte* title);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwShowWindow(Window* window);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwSetWindowSize(Window* window, int width, int height);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern IntPtr glfwSetWindowSizeCallback(Window* window, IntPtr callback);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwSetWindowShouldClose(Window* window, int value);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwSetWindowMonitor(Window* window, Monitor* monitor, int x, int y, int width, int height, int refreshRate);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwSetWindowPos(Window* window, int x, int y);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern IntPtr glfwSetWindowPosCallback(Window* window, IntPtr callback);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern IntPtr glfwSetWindowRefreshCallback(Window* window, IntPtr callback);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwSwapInterval(int interval);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwWaitEvents();
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwWaitEventsTimeout(double timeout);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern byte* glfwGetClipboardString(Window* window);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern void glfwSetClipboardString(Window* window, byte* data);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern int glfwVulkanSupported();
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern byte** glfwGetRequiredInstanceExtensions(uint* count);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern IntPtr glfwGetInstanceProcAddress(VkHandle instance, byte* procName);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern int glfwGetPhysicalDevicePresentationSupport(VkHandle instance, VkHandle device, int queueFamily);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern int glfwCreateWindowSurface(VkHandle instance, Window* window, void* allocator, VkHandle surface);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern uint glfwGetX11Window(Window* window);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern IntPtr glfwGetX11Display(Window* window);
|
||||
|
||||
[DllImport(LibraryName)]
|
||||
public static extern IntPtr glfwGetWin32Window(Window* window);
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
//
|
||||
// GamepadState.cs
|
||||
//
|
||||
// Copyright (C) 2019 OpenTK
|
||||
//
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the MIT license. See the LICENSE file for details.
|
||||
//
|
||||
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// This describes the input state of a gamepad.
|
||||
/// </summary>
|
||||
public struct GamepadState
|
||||
{
|
||||
/// <summary>
|
||||
/// State of each of the 15 gamepad buttons, equal to <see cref="InputAction.Press"/> or <see cref="InputAction.Release"/>.
|
||||
/// </summary>
|
||||
public unsafe fixed byte Buttons[15];
|
||||
|
||||
/// <summary>
|
||||
/// State of each of the 6 gamepad axes, ranging from -1.0 to 1.0.
|
||||
/// </summary>
|
||||
public unsafe fixed float Axes[6];
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
//
|
||||
// GammaRamp.cs
|
||||
//
|
||||
// Copyright (C) 2019 OpenTK
|
||||
//
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the MIT license. See the LICENSE file for details.
|
||||
//
|
||||
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// Gamma ramp for a <see cref="Monitor"/>.
|
||||
/// </summary>
|
||||
public unsafe struct GammaRamp
|
||||
{
|
||||
/// <summary>
|
||||
/// Red components of the gamma ramp.
|
||||
/// </summary>
|
||||
public ushort* Red;
|
||||
|
||||
/// <summary>
|
||||
/// Green components of the gamma ramp.
|
||||
/// </summary>
|
||||
public ushort* Green;
|
||||
|
||||
/// <summary>
|
||||
/// Blue components of the gamma ramp.
|
||||
/// </summary>
|
||||
public ushort* Blue;
|
||||
|
||||
/// <summary>
|
||||
/// Length of the arrays.
|
||||
/// </summary>
|
||||
public uint Size;
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
//
|
||||
// Image.cs
|
||||
//
|
||||
// Copyright (C) 2018 OpenTK
|
||||
//
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the MIT license. See the LICENSE file for details.
|
||||
//
|
||||
|
||||
using System;
|
||||
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains GLFW Image data.
|
||||
/// </summary>
|
||||
public unsafe struct Image
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Image"/> struct.
|
||||
/// </summary>
|
||||
/// <param name="width">The width of the image in pixels.</param>
|
||||
/// <param name="height">The height of the image in pixels.</param>
|
||||
/// <param name="pixels"><see cref="IntPtr"/> pointing to the RGBA pixel data of the image.</param>
|
||||
public Image(int width, int height, byte* pixels)
|
||||
{
|
||||
Width = width;
|
||||
Height = height;
|
||||
Pixels = pixels;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The width, in pixels, of this <see cref="Image"/>.
|
||||
/// </summary>
|
||||
public int Width;
|
||||
|
||||
/// <summary>
|
||||
/// The height, in pixels, of this <see cref="Image"/>.
|
||||
/// </summary>
|
||||
public int Height;
|
||||
|
||||
/// <summary>
|
||||
/// A <see cref="byte"/> pointer pointing to the RGBA pixel data.
|
||||
/// </summary>
|
||||
public byte* Pixels;
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
# MIT License
|
||||
|
||||
Copyright (c) 2006-2019 Stefanos Apostolopoulos for the Open Toolkit project.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
- The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
#### Third party licenses may be applicable. These have been disclosed in [THIRD_PARTIES.md](THIRD_PARTIES.md)
|
||||
@@ -1,18 +0,0 @@
|
||||
//
|
||||
// Monitor.cs
|
||||
//
|
||||
// Copyright (C) 2018 OpenTK
|
||||
//
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the MIT license. See the LICENSE file for details.
|
||||
//
|
||||
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// Opaque handle to a GLFW monitor.
|
||||
/// </summary>
|
||||
public struct Monitor
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>9.0</LangVersion>
|
||||
<SkipRobustAnalyzer>true</SkipRobustAnalyzer>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="..\MSBuild\Robust.Properties.targets" />
|
||||
</Project>
|
||||
@@ -1,20 +0,0 @@
|
||||
# Third parties
|
||||
|
||||
## AdvancedDLSupport
|
||||
> OpenTK uses AdvancedDLSupport for native interoperability. To enable compatibility with the LGPLv3 License, Firwood has given us a licensing exception.
|
||||
|
||||
* Read the [license grant](AdvancedDLSupport-LICENSE.pdf).
|
||||
* Read the [license summary](Short-LICENSE.md) for an easy-to-understand version.
|
||||
|
||||
## OpenEXR
|
||||
|
||||
> OpenTK.Half offers Half-to-Single and Single-to-Half conversions based on OpenEXR source code, which is covered by the following license:
|
||||
|
||||
Copyright (c) 2002, Industrial Light & Magic, a division of Lucas Digital Ltd. LLC. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Industrial Light & Magic nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -1,50 +0,0 @@
|
||||
//
|
||||
// VideoMode.cs
|
||||
//
|
||||
// Copyright (C) 2018 OpenTK
|
||||
//
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the MIT license. See the LICENSE file for details.
|
||||
//
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// Replicated handle to a GLFW VideoMode.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct VideoMode
|
||||
{
|
||||
/// <summary>
|
||||
/// The width, in screen coordinates, of the <see cref="VideoMode"/>.
|
||||
/// </summary>
|
||||
public int Width;
|
||||
|
||||
/// <summary>
|
||||
/// The height, in screen coordinates, of the <see cref="VideoMode"/>.
|
||||
/// </summary>
|
||||
public int Height;
|
||||
|
||||
/// <summary>
|
||||
/// The bit depth of the red channel of the <see cref="VideoMode"/>.
|
||||
/// </summary>
|
||||
public int RedBits;
|
||||
|
||||
/// <summary>
|
||||
/// The bit depth of the green channel of the <see cref="VideoMode"/>.
|
||||
/// </summary>
|
||||
public int GreenBits;
|
||||
|
||||
/// <summary>
|
||||
/// The bit depth of the blue channel of the <see cref="VideoMode"/>.
|
||||
/// </summary>
|
||||
public int BlueBits;
|
||||
|
||||
/// <summary>
|
||||
/// The refresh rate, in Hz, of the <see cref="VideoMode"/>.
|
||||
/// </summary>
|
||||
public int RefreshRate;
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// A handle to a Vulkan object.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct VkHandle
|
||||
{
|
||||
/// <summary>
|
||||
/// The actual value of the Vulkan handle.
|
||||
/// </summary>
|
||||
public IntPtr Handle;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="VkHandle"/> struct.
|
||||
/// </summary>
|
||||
/// <param name="handle">
|
||||
/// The native Vulkan handle.
|
||||
/// This is NOT a pointer to a field containing the handle, this is the actual handle itself.
|
||||
/// </param>
|
||||
public VkHandle(IntPtr handle)
|
||||
{
|
||||
Handle = handle;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
//
|
||||
// Window.cs
|
||||
//
|
||||
// Copyright (C) 2018 OpenTK
|
||||
//
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the MIT license. See the LICENSE file for details.
|
||||
//
|
||||
|
||||
namespace OpenToolkit.GraphicsLibraryFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// Opaque handle to a GLFW window.
|
||||
/// </summary>
|
||||
public struct Window
|
||||
{
|
||||
}
|
||||
}
|
||||
171
RELEASE-NOTES.md
171
RELEASE-NOTES.md
@@ -1,4 +1,4 @@
|
||||
# Release notes for RobustToolbox.
|
||||
# Release notes for RobustToolbox.
|
||||
|
||||
<!--
|
||||
NOTE: automatically updated sometimes by version.py.
|
||||
@@ -54,6 +54,175 @@ END TEMPLATE-->
|
||||
*None yet*
|
||||
|
||||
|
||||
## 270.0.0
|
||||
|
||||
### Breaking changes
|
||||
|
||||
* Fixed `IClydeWindowInternal` erroneously being public.
|
||||
* Added a new `[NotContentImplementable]` attribute and made many interfaces in the engine have it. This attribute marks that we may add members to these interfaces in the future, so content should not implement them.
|
||||
* Removed unused `IRenderableComponent`, `IRand`, and `IPlayerInput` interfaces.
|
||||
|
||||
### New features
|
||||
|
||||
* Added `IsUiOpen` and `IsAnyUiOpen` to `SharedUserInterfaceSystem`. (was in previous engine release, missed in changelog)
|
||||
* Added `game.time_scale` CVar.
|
||||
|
||||
### Bugfixes
|
||||
|
||||
* Fix a fake error being logged every time when setting the clipboard.
|
||||
* Fixed audio loading by reverting dependency update to `VorbisPizza`.
|
||||
|
||||
### Other
|
||||
|
||||
* The size of the serializer string map is now logged.
|
||||
|
||||
|
||||
## 269.0.1
|
||||
|
||||
### Bugfixes
|
||||
|
||||
* Fixed transitive project dependencies in content triggering "no direct project reference" detection.
|
||||
|
||||
|
||||
## 269.0.0
|
||||
|
||||
### Breaking changes
|
||||
|
||||
* The project now targets .NET 10. You will have to install the new runtime on game servers when updating.
|
||||
* We have adopted a new "solution management" system for games.
|
||||
* This enables us to add new projects to RT (e.g. split stuff up) without causing breaking changes.
|
||||
* Games must move to `.slnx` solutions and run `dotnet run --project ./RobustToolbox/Tools/Robust.SolutionGen/ -- update` after updating RT. This should be done after *every* RT feature update.
|
||||
* Games may no longer directly reference RT projects. To depend on these, import the various `.props` files in the `Imports/` folder.
|
||||
* We've tidied up all the transitive dependencies RT projects used to expose, meaning packages used by *Robust* aren't automatically visible to content projects anymore. You will likely have both accidental usages that are now erroring, or valid usages that you will need to add a `<PackageReference>` for.
|
||||
* `OutputPanel` and `RichTextLabel` now set a default set of "safe" markup tags when using overloads that don't take in a `Type[]? allowedTags`. These tags are formatting only, so dangerous stuff like `[cmdlink]` is blocked by default.
|
||||
* The constructor of `EntityQuery<TComp1>` has been made internal.
|
||||
|
||||
### New features
|
||||
|
||||
* Added `ExtensionMarkerAttribute`, used by the new C# 14 extension members, for the sandbox.
|
||||
* Added `CommandWhenUIFocused` property to `Command` keybinds, to make them not fire when a UI control is focused.
|
||||
* Startup logging now lists total memory and AVX10 intrinsics.
|
||||
* Added new `FormattedString` type that represents a plain `string` that has markup formatting.
|
||||
* Added an analyzer to detect redundant `[Prototype("foobar")]` strings.
|
||||
* Added an analyzer to detect `DirtyField()` calls with incorrect field names.
|
||||
|
||||
### Bugfixes
|
||||
|
||||
* Fixed `FormattedMessage` not escaping plain text content properly with `.ToMarkup()`.
|
||||
* Fixed wrapping on inline rich text controls like links.
|
||||
* Fixed some native libs getting packaged for Linux clients when they shouldn't.
|
||||
* Fixed `TilesEnumerator` being able to stack overflow due to the recursive implementation.
|
||||
* Fixed some typos in `EntityDeserializer` log messages.
|
||||
* Fixed WebView control resizing being fucky.
|
||||
* Fixed `DataDefinitionAnalyzer` to recognize `[MeansDataDefinition]` attributes.
|
||||
|
||||
### Other
|
||||
|
||||
* Updated NuGet package dependencies.
|
||||
* Prototype loading now tries to do some basic interning to avoid duplicate string objects being stored. This saves some memory.
|
||||
* Avoid redundant texture uploads on WebView controls.
|
||||
* Updated and added a lot of documentation to various parts of the engine.
|
||||
* Moved to `.slnx`, and changed the default marker filename for hot reload to `.slnx` too.
|
||||
* Removed GLFW windowing implementation.
|
||||
* `EntityQuery.Resolve` now logs more info on error.
|
||||
* Disabled some unnecessary .NET SDK source generators that slowed down build.
|
||||
* Removed kdialog/nfd file dialog implementation.
|
||||
|
||||
### Internal
|
||||
|
||||
* Added a prototype `AspectRatioPanel` control. Not stabilized yet.
|
||||
* Added gay colors to uitest.
|
||||
* "Test content master" RT workflow now replaces `global.json` in SS14.
|
||||
* Updated `Robust.LoaderApi` and `NetSerializer` to .NET 10.
|
||||
* Fixed all the configurations in `RobustToolbox.sln`.
|
||||
* Split up `Robust.UnitTesting` into many more projects.
|
||||
* Internal warning fixes.
|
||||
|
||||
|
||||
## 268.1.0
|
||||
|
||||
### New features
|
||||
|
||||
* Added `IReplayFileWriter.WriteYaml()`, for writing yaml documents to a replay zip file.
|
||||
* Added Caps Lock as a proper bindable key.
|
||||
* Added `IParallelBulkRobustJob` as an alternative to `IParallelRobustJob`, taking ranges instead of indices.
|
||||
* Allow content to override `ProcessStream` and `GetOcclusion` in `AudioSystem`
|
||||
|
||||
### Bugfixes
|
||||
|
||||
* `ActorComponent` now has the `UnsavedComponentAttribute`
|
||||
* Previously it was unintentionally get serialized to yaml, which could result in NREs when deserializing.
|
||||
* Don't spam error messages on startup trying to draw splash logos for projects that don't have one.
|
||||
* Fix `SpriteSystem.LayerExists` saying that layer 0 is invalid.
|
||||
* Fix `ButtonGroup`s unpressing buttons in an edge case with UI rebuilding.
|
||||
* Added `CreatedTime` to `NetUserData`.
|
||||
* Fix loading of `WebView`.
|
||||
|
||||
### Other
|
||||
|
||||
* Reverted undocumented change from 268.0.0 which obsoleted many `IoCManager` methods.
|
||||
* Fix .NET 10 serializer compatibility of `BitArray`. (backported to older engines).
|
||||
* Revert performance change to physics due to issues (double-buffered contact events).
|
||||
* Audio entities are marked as `HideSpawnMenu` now.
|
||||
* Make `SharedAudioSystem.Stop` not do nothing when the current tick has already been predicted.
|
||||
* Warning cleanup.
|
||||
|
||||
### Internal
|
||||
|
||||
* Consolidated and updated physics benchmarks.
|
||||
|
||||
|
||||
## 268.0.0
|
||||
|
||||
### Breaking changes
|
||||
|
||||
* Events that are raised via `IEventBus.RaiseComponentEvent()` now **must** be annotated with the `ComponentEventAttribute`.
|
||||
* By default, events annotated with this attribute can **only** be raised via `IEventBus.RaiseComponentEvent()`. This can be configured via `ComponentEventAttribute.Exclusive`
|
||||
* StartCollide and EndCollide events are now buffered until the end of physics substeps instead of being raised during the CollideContacts step. EndCollide events are double-buffered and any new ones raised while the events are being dispatched will now go out on the next tick / substep.
|
||||
|
||||
### New features
|
||||
|
||||
* Added `IUserInterfaceManager.ControlSawmill` and `Control.Log` properties so that controls can easily use logging without using static methods.
|
||||
|
||||
|
||||
## 267.4.0
|
||||
|
||||
### New features
|
||||
|
||||
* Added two new custom yaml serializers `CustomListSerializer` and `CustomArraySerializer`.
|
||||
* CVars defined in `[CVarDefs]` can now be private or internal.
|
||||
* Added config rollback system to `IConfigurationManager`. This enables CVars to be snapshot and rolled back, even in the event of client crash.
|
||||
* `OptionButton` now has a `Filterable` property that gives it a text box to filter options.
|
||||
* Added `FontTagHijackHolder` to replace fonts resolved by `FontTag`.
|
||||
* Sandbox:
|
||||
* Exposed `System.Reflection.Metadata.MetadataUpdateHandlerAttribute`.
|
||||
* Exposed more overloads on `StringBuilder`.
|
||||
* The engine can now load system fonts.
|
||||
* At the moment only available on Windows.
|
||||
* See `ISystemFontManager` for API.
|
||||
* The client now display a loading screen during startup.
|
||||
|
||||
### Bugfixes
|
||||
|
||||
* Fix `Menu` and `NumpadDecimal` key codes on SDL3.
|
||||
* client-side predicted entity deletion ( `EntityManager.PredictedQueueDeleteEntity`) now behaves more like it does on the server. In particular, entities will be deleted on the same tick after all system have been updated. Previously, it would process deletions at the beginning of the next tick.
|
||||
* Fix modifying `Label.FontOverride` not causing a layout update.
|
||||
* Controls created by rich-text tags now get arranged to a proper size.
|
||||
* Fix `OutputPanel` scrollbar breaking if a style update changes the font size.
|
||||
|
||||
### Other
|
||||
|
||||
* ComponentNameSerializer will now ignore any components that have been ignored via `IComponentFactory.RegisterIgnore`.
|
||||
* Add pure to some SharedTransformSystem methods.
|
||||
* Significantly optimised collision detection in SharedBroadphaseSystem.
|
||||
* `Control.Stylesheet` does not do any work if assigning the value it already has.
|
||||
* XAML hot reload now JITs UIs when first opened rather than doing every single one at client startup. This reduces dev startup overhead significantly and probably helps with memory usage too.
|
||||
|
||||
### Internal
|
||||
|
||||
* The `dmetamem` command now sorts its output, and doesn't output to log anymore to avoid output interleaving.
|
||||
|
||||
|
||||
## 267.3.0
|
||||
|
||||
### New features
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
id: Audio
|
||||
name: Audio
|
||||
description: Audio entity used by engine
|
||||
save: false
|
||||
save: false # TODO PERSISTENCE what about looping or long sounds?
|
||||
categories: [ HideSpawnMenu ]
|
||||
components:
|
||||
- type: Transform
|
||||
gridTraversal: false
|
||||
|
||||
@@ -8,3 +8,5 @@ color-selector-sliders-alpha = A
|
||||
|
||||
color-selector-sliders-rgb = RGB
|
||||
color-selector-sliders-hsv = HSV
|
||||
|
||||
option-button-filter = Filter
|
||||
|
||||
@@ -68,6 +68,7 @@ input-key-MouseButton6 = Mouse 6
|
||||
input-key-MouseButton7 = Mouse 7
|
||||
input-key-MouseButton8 = Mouse 8
|
||||
input-key-MouseButton9 = Mouse 9
|
||||
input-key-CapsLock = Caps Lock
|
||||
|
||||
input-key-LSystem-win = Left Win
|
||||
input-key-RSystem-win = Right Win
|
||||
|
||||
@@ -43,6 +43,7 @@ input-key-MouseButton6 = Mouse 6
|
||||
input-key-MouseButton7 = Mouse 7
|
||||
input-key-MouseButton8 = Mouse 8
|
||||
input-key-MouseButton9 = Mouse 9
|
||||
input-key-CapsLock = Caps Lock
|
||||
|
||||
input-key-LSystem-win = Left Win
|
||||
input-key-RSystem-win = Right Win
|
||||
|
||||
177
Robust.Analyzers.Tests/PrototypeAnalyzerTest.cs
Normal file
177
Robust.Analyzers.Tests/PrototypeAnalyzerTest.cs
Normal file
@@ -0,0 +1,177 @@
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.CodeAnalysis.Testing;
|
||||
using NUnit.Framework;
|
||||
using VerifyCS =
|
||||
Microsoft.CodeAnalysis.CSharp.Testing.CSharpAnalyzerVerifier<Robust.Analyzers.PrototypeAnalyzer, Microsoft.CodeAnalysis.Testing.DefaultVerifier>;
|
||||
|
||||
namespace Robust.Analyzers.Tests;
|
||||
|
||||
[Parallelizable(ParallelScope.All | ParallelScope.Fixtures)]
|
||||
[TestFixture]
|
||||
[TestOf(typeof(PrototypeAnalyzer))]
|
||||
public sealed class PrototypeAnalyzerTest
|
||||
{
|
||||
private static Task Verifier(string code, params DiagnosticResult[] expected)
|
||||
{
|
||||
var test = new RTAnalyzerTest<PrototypeAnalyzer>()
|
||||
{
|
||||
TestState =
|
||||
{
|
||||
Sources = { code }
|
||||
},
|
||||
};
|
||||
|
||||
TestHelper.AddEmbeddedSources(
|
||||
test.TestState,
|
||||
"Robust.Shared.Prototypes.Attributes.cs",
|
||||
"Robust.Shared.Prototypes.IPrototype.cs",
|
||||
"Robust.Shared.Serialization.Manager.Attributes.DataFieldAttribute.cs"
|
||||
);
|
||||
|
||||
// ExpectedDiagnostics cannot be set, so we need to AddRange here...
|
||||
test.TestState.ExpectedDiagnostics.AddRange(expected);
|
||||
|
||||
return test.RunAsync();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task RedundantTypeTest()
|
||||
{
|
||||
const string code = """
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
[Prototype]
|
||||
public sealed partial class GoodAutoPrototype : IPrototype
|
||||
{
|
||||
[IdDataField]
|
||||
public string ID { get; private set; } = default!;
|
||||
}
|
||||
|
||||
[Prototype("someOtherName")]
|
||||
public sealed partial class GoodUnmatchedPrototype : IPrototype
|
||||
{
|
||||
[IdDataField]
|
||||
public string ID { get; private set; } = default!;
|
||||
}
|
||||
|
||||
[Prototype("badMatched")]
|
||||
public sealed partial class BadMatchedPrototype : IPrototype
|
||||
{
|
||||
[IdDataField]
|
||||
public string ID { get; private set; } = default!;
|
||||
}
|
||||
|
||||
[Prototype(ProtoName)]
|
||||
public sealed partial class GoodNonLiteralMatchedPrototype : IPrototype
|
||||
{
|
||||
public const string ProtoName = "goodNonLiteralMatched";
|
||||
|
||||
[IdDataField]
|
||||
public string ID { get; private set; } = default!;
|
||||
}
|
||||
|
||||
[Prototype(ProtoName)]
|
||||
public sealed partial class GoodNonLiteralUnmatchedPrototype : IPrototype
|
||||
{
|
||||
public const string ProtoName = "someOtherNameEntirely";
|
||||
|
||||
[IdDataField]
|
||||
public string ID { get; private set; } = default!;
|
||||
}
|
||||
|
||||
[Prototype("goodDoesNotEndWithPrototypeWord")]
|
||||
public sealed partial class GoodDoesNotEndWithPrototypeWord : IPrototype
|
||||
{
|
||||
[IdDataField]
|
||||
public string ID { get; private set; } = default!;
|
||||
}
|
||||
""";
|
||||
|
||||
await Verifier(code,
|
||||
// /0/Test0.cs(9,2): warning RA0033: Prototype BadMatchedPrototype has explicitly set type "badMatched" that matches autogenerated value
|
||||
VerifyCS.Diagnostic(PrototypeAnalyzer.PrototypeRedundantTypeRule).WithSpan(17, 12, 17, 24).WithArguments("BadMatchedPrototype", "badMatched")
|
||||
);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task AliasTest()
|
||||
{
|
||||
const string code = """
|
||||
using Robust.Shared.Prototypes;
|
||||
using PPrototypeAttribute = Robust.Shared.Prototypes.PrototypeAttribute;
|
||||
|
||||
[PPrototype("badMatched")]
|
||||
public sealed partial class BadMatchedPrototype : IPrototype
|
||||
{
|
||||
[IdDataField]
|
||||
public string ID { get; private set; } = default!;
|
||||
}
|
||||
""";
|
||||
|
||||
await Verifier(code,
|
||||
// /0/Test0.cs(4,2): warning RA0042: Prototype BadMatchedPrototype has explicitly set type "badMatched" that matches autogenerated value
|
||||
VerifyCS.Diagnostic(PrototypeAnalyzer.PrototypeRedundantTypeRule).WithSpan(4, 13, 4, 25).WithArguments("BadMatchedPrototype", "badMatched")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public async Task MoreAttributesTest()
|
||||
{
|
||||
const string code = """
|
||||
using System;
|
||||
using Robust.Shared.Prototypes;
|
||||
using PPrototypeAttribute = Robust.Shared.Prototypes.PrototypeAttribute;
|
||||
|
||||
[FooBarAttribute]
|
||||
[PPrototype("badMatched")]
|
||||
public sealed partial class BadMatchedPrototype : IPrototype
|
||||
{
|
||||
[IdDataField]
|
||||
public string ID { get; private set; } = default!;
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
|
||||
public sealed class FooBarAttribute : Attribute;
|
||||
""";
|
||||
|
||||
await Verifier(code,
|
||||
// /0/Test0.cs(4,2): warning RA0042: Prototype BadMatchedPrototype has explicitly set type "badMatched" that matches autogenerated value
|
||||
VerifyCS.Diagnostic(PrototypeAnalyzer.PrototypeRedundantTypeRule).WithSpan(6, 13, 6, 25).WithArguments("BadMatchedPrototype", "badMatched")
|
||||
);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task NameEndsWithPrototypeTest()
|
||||
{
|
||||
const string code = """
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
[Prototype]
|
||||
public sealed partial class GoodAutoPrototype : IPrototype
|
||||
{
|
||||
[IdDataField]
|
||||
public string ID { get; private set; } = default!;
|
||||
}
|
||||
|
||||
[Prototype("ThisIsFine")]
|
||||
public sealed partial class GoodManual : IPrototype
|
||||
{
|
||||
[IdDataField]
|
||||
public string ID { get; private set; } = default!;
|
||||
}
|
||||
|
||||
[Prototype]
|
||||
public sealed partial class BadAuto : IPrototype
|
||||
{
|
||||
[IdDataField]
|
||||
public string ID { get; private set; } = default!;
|
||||
}
|
||||
""";
|
||||
|
||||
await Verifier(code,
|
||||
// /0/Test0.cs(18,29): error RA0043: Prototype BadAuto does not end with the word Prototype
|
||||
VerifyCS.Diagnostic(PrototypeAnalyzer.PrototypeEndsWithPrototypeRule).WithSpan(18, 29, 18, 36).WithArguments("BadAuto")
|
||||
);
|
||||
}
|
||||
}
|
||||
95
Robust.Analyzers.Tests/PrototypeFixerTest.cs
Normal file
95
Robust.Analyzers.Tests/PrototypeFixerTest.cs
Normal file
@@ -0,0 +1,95 @@
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.CodeAnalysis.CSharp.Testing;
|
||||
using Microsoft.CodeAnalysis.Testing;
|
||||
using NUnit.Framework;
|
||||
using VerifyCS =
|
||||
Microsoft.CodeAnalysis.CSharp.Testing.CSharpAnalyzerVerifier<Robust.Analyzers.PrototypeAnalyzer, Microsoft.CodeAnalysis.Testing.DefaultVerifier>;
|
||||
|
||||
|
||||
namespace Robust.Analyzers.Tests;
|
||||
|
||||
public sealed class PrototypeFixerTest
|
||||
{
|
||||
private static Task Verifier(string code, string fixedCode, params DiagnosticResult[] expected)
|
||||
{
|
||||
var test = new CSharpCodeFixTest<PrototypeAnalyzer, PrototypeFixer, DefaultVerifier>()
|
||||
{
|
||||
TestState =
|
||||
{
|
||||
Sources = { code },
|
||||
},
|
||||
FixedState =
|
||||
{
|
||||
Sources = { fixedCode },
|
||||
}
|
||||
};
|
||||
|
||||
test.TestState.Sources.Add(("PrototypeAttribute.cs", PrototypeAttributeDef));
|
||||
test.FixedState.Sources.Add(("PrototypeAttribute.cs", PrototypeAttributeDef));
|
||||
|
||||
test.TestState.ExpectedDiagnostics.AddRange(expected);
|
||||
|
||||
return test.RunAsync();
|
||||
}
|
||||
|
||||
private const string PrototypeAttributeDef = """
|
||||
using System;
|
||||
|
||||
namespace Robust.Shared.Prototypes
|
||||
{
|
||||
public class PrototypeAttribute : Attribute
|
||||
{
|
||||
public string? Type { get; internal set; }
|
||||
public readonly int LoadPriority = 1;
|
||||
|
||||
public PrototypeAttribute(string? type = null, int loadPriority = 1)
|
||||
{
|
||||
Type = type;
|
||||
LoadPriority = loadPriority;
|
||||
}
|
||||
|
||||
public PrototypeAttribute(int loadPriority)
|
||||
{
|
||||
Type = null;
|
||||
LoadPriority = loadPriority;
|
||||
}
|
||||
}
|
||||
public interface IPrototype;
|
||||
}
|
||||
""";
|
||||
|
||||
[Test]
|
||||
public async Task Test()
|
||||
{
|
||||
const string code = """
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
[Prototype]
|
||||
public sealed partial class GoodAutoPrototype : IPrototype;
|
||||
|
||||
[Prototype("someOtherName")]
|
||||
public sealed partial class GoodUnmatchedPrototype : IPrototype;
|
||||
|
||||
[Prototype("badMatched")]
|
||||
public sealed partial class BadMatchedPrototype : IPrototype;
|
||||
""";
|
||||
|
||||
const string fixedCode = """
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
[Prototype]
|
||||
public sealed partial class GoodAutoPrototype : IPrototype;
|
||||
|
||||
[Prototype("someOtherName")]
|
||||
public sealed partial class GoodUnmatchedPrototype : IPrototype;
|
||||
|
||||
[Prototype]
|
||||
public sealed partial class BadMatchedPrototype : IPrototype;
|
||||
""";
|
||||
|
||||
await Verifier(code, fixedCode,
|
||||
// /0/Test0.cs(9,2): warning RA0033: Prototype BadMatchedPrototype has explicitly set type "badMatched" that matches autogenerated value
|
||||
VerifyCS.Diagnostic(PrototypeAnalyzer.PrototypeRedundantTypeRule).WithSpan(9, 12, 9, 24).WithArguments("BadMatchedPrototype", "badMatched")
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@
|
||||
<EmbeddedResource Include="..\Robust.Shared\Analyzers\PreferOtherTypeAttribute.cs" LogicalName="Robust.Shared.Analyzers.PreferOtherTypeAttribute.cs" LinkBase="Implementations" />
|
||||
<EmbeddedResource Include="..\Robust.Shared\Analyzers\ForbidLiteralAttribute.cs" LogicalName="Robust.Shared.Analyzers.ForbidLiteralAttribute.cs" LinkBase="Implementations" />
|
||||
<EmbeddedResource Include="..\Robust.Shared\Analyzers\ObsoleteInheritanceAttribute.cs" LogicalName="Robust.Shared.Analyzers.ObsoleteInheritanceAttribute.cs" LinkBase="Implementations" />
|
||||
<EmbeddedResource Include="..\Robust.Shared\Analyzers\ValidateMemberAttribute.cs" LogicalName="Robust.Shared.Analyzers.ValidateMemberAttribute.cs" LinkBase="Implementations" />
|
||||
<EmbeddedResource Include="..\Robust.Shared\IoC\DependencyAttribute.cs" LogicalName="Robust.Shared.IoC.DependencyAttribute.cs" LinkBase="Implementations" />
|
||||
<EmbeddedResource Include="..\Robust.Shared\GameObjects\EventBusAttributes.cs" LogicalName="Robust.Shared.GameObjects.EventBusAttributes.cs" LinkBase="Implementations" />
|
||||
<EmbeddedResource Include="..\Robust.Shared\Serialization\NetSerializableAttribute.cs" LogicalName="Robust.Shared.Serialization.NetSerializableAttribute.cs" LinkBase="Implementations" />
|
||||
|
||||
96
Robust.Analyzers.Tests/ValidateMemberAnalyzerTest.cs
Normal file
96
Robust.Analyzers.Tests/ValidateMemberAnalyzerTest.cs
Normal file
@@ -0,0 +1,96 @@
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.CodeAnalysis.CSharp.Testing;
|
||||
using Microsoft.CodeAnalysis.Testing;
|
||||
using NUnit.Framework;
|
||||
using VerifyCS =
|
||||
Microsoft.CodeAnalysis.CSharp.Testing.CSharpAnalyzerVerifier<Robust.Analyzers.ValidateMemberAnalyzer, Microsoft.CodeAnalysis.Testing.DefaultVerifier>;
|
||||
|
||||
|
||||
namespace Robust.Analyzers.Tests;
|
||||
|
||||
public sealed class ValidateMemberAnalyzerTest
|
||||
{
|
||||
private static Task Verifier(string code, params DiagnosticResult[] expected)
|
||||
{
|
||||
var test = new CSharpAnalyzerTest<ValidateMemberAnalyzer, DefaultVerifier>()
|
||||
{
|
||||
TestState =
|
||||
{
|
||||
Sources = { code },
|
||||
},
|
||||
};
|
||||
|
||||
TestHelper.AddEmbeddedSources(
|
||||
test.TestState,
|
||||
"Robust.Shared.Analyzers.ValidateMemberAttribute.cs"
|
||||
);
|
||||
|
||||
// ExpectedDiagnostics cannot be set, so we need to AddRange here...
|
||||
test.TestState.ExpectedDiagnostics.AddRange(expected);
|
||||
|
||||
return test.RunAsync();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task Test()
|
||||
{
|
||||
const string code = """
|
||||
using System;
|
||||
using Robust.Shared.Analyzers;
|
||||
|
||||
public sealed class TestComponent
|
||||
{
|
||||
public int IntField;
|
||||
public bool BoolField;
|
||||
}
|
||||
|
||||
public sealed class OtherComponent
|
||||
{
|
||||
public float FloatField;
|
||||
public double DoubleField;
|
||||
}
|
||||
|
||||
public sealed class TestManager
|
||||
{
|
||||
public static void DirtyField<T>(T comp, [ValidateMember]string fieldName) { }
|
||||
public static void DirtyTwoFields<T>(T comp, [ValidateMember]string first, [ValidateMember]string second) { }
|
||||
}
|
||||
|
||||
public sealed class TestCaller
|
||||
{
|
||||
public void Test()
|
||||
{
|
||||
var testComp = new TestComponent();
|
||||
var otherComp = new OtherComponent();
|
||||
|
||||
TestManager.DirtyField(testComp, nameof(TestComponent.IntField));
|
||||
|
||||
TestManager.DirtyField(testComp, nameof(OtherComponent.FloatField));
|
||||
|
||||
TestManager.DirtyField(otherComp, nameof(TestComponent.IntField));
|
||||
|
||||
TestManager.DirtyField(otherComp, nameof(OtherComponent.FloatField));
|
||||
|
||||
TestManager.DirtyTwoFields(testComp, nameof(TestComponent.IntField), nameof(TestComponent.BoolField));
|
||||
|
||||
TestManager.DirtyTwoFields(testComp, nameof(TestComponent.IntField), nameof(OtherComponent.FloatField));
|
||||
|
||||
TestManager.DirtyTwoFields(testComp, nameof(OtherComponent.FloatField), nameof(OtherComponent.DoubleField));
|
||||
}
|
||||
}
|
||||
""";
|
||||
|
||||
await Verifier(code,
|
||||
// /0/Test0.cs(31,42): error RA0033: FloatField is not a member of TestComponent
|
||||
VerifyCS.Diagnostic().WithSpan(31, 42, 31, 75).WithArguments("FloatField", "TestComponent"),
|
||||
// /0/Test0.cs(33,43): error RA0033: IntField is not a member of OtherComponent
|
||||
VerifyCS.Diagnostic().WithSpan(33, 43, 33, 73).WithArguments("IntField", "OtherComponent"),
|
||||
// /0/Test0.cs(39,78): error RA0033: FloatField is not a member of TestComponent
|
||||
VerifyCS.Diagnostic().WithSpan(39, 78, 39, 111).WithArguments("FloatField", "TestComponent"),
|
||||
// /0/Test0.cs(41,46): error RA0033: FloatField is not a member of TestComponent
|
||||
VerifyCS.Diagnostic().WithSpan(41, 46, 41, 79).WithArguments("FloatField", "TestComponent"),
|
||||
// /0/Test0.cs(41,81): error RA0033: DoubleField is not a member of TestComponent
|
||||
VerifyCS.Diagnostic().WithSpan(41, 81, 41, 115).WithArguments("DoubleField", "TestComponent")
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ public sealed class DataDefinitionAnalyzer : DiagnosticAnalyzer
|
||||
{
|
||||
private const string DataDefinitionNamespace = "Robust.Shared.Serialization.Manager.Attributes.DataDefinitionAttribute";
|
||||
private const string ImplicitDataDefinitionNamespace = "Robust.Shared.Serialization.Manager.Attributes.ImplicitDataDefinitionForInheritorsAttribute";
|
||||
private const string MeansDataDefinitionNamespace = "Robust.Shared.Serialization.Manager.Attributes.MeansDataDefinitionAttribute";
|
||||
private const string DataFieldBaseNamespace = "Robust.Shared.Serialization.Manager.Attributes.DataFieldBaseAttribute";
|
||||
private const string ViewVariablesNamespace = "Robust.Shared.ViewVariables.ViewVariablesAttribute";
|
||||
private const string NotYamlSerializableName = "Robust.Shared.Serialization.Manager.Attributes.NotYamlSerializableAttribute";
|
||||
@@ -270,6 +271,7 @@ public sealed class DataDefinitionAnalyzer : DiagnosticAnalyzer
|
||||
return false;
|
||||
|
||||
return HasAttribute(type, DataDefinitionNamespace) ||
|
||||
MeansDataDefinition(type) ||
|
||||
IsImplicitDataDefinition(type);
|
||||
}
|
||||
|
||||
@@ -425,6 +427,19 @@ public sealed class DataDefinitionAnalyzer : DiagnosticAnalyzer
|
||||
return (VVAccess)accessByte == VVAccess.ReadWrite;
|
||||
}
|
||||
|
||||
private static bool MeansDataDefinition(ITypeSymbol type)
|
||||
{
|
||||
foreach (var attribute in type.GetAttributes())
|
||||
{
|
||||
if (attribute.AttributeClass is null)
|
||||
continue;
|
||||
|
||||
if (HasAttribute(attribute.AttributeClass, MeansDataDefinitionNamespace))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool IsNotYamlSerializable(ISymbol field, ITypeSymbol type)
|
||||
{
|
||||
return HasAttribute(type, NotYamlSerializableName);
|
||||
|
||||
16
Robust.Analyzers/ITypeSymbolExtensions.cs
Normal file
16
Robust.Analyzers/ITypeSymbolExtensions.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using Microsoft.CodeAnalysis;
|
||||
|
||||
namespace Robust.Analyzers;
|
||||
|
||||
public static class ITypeSymbolExtensions
|
||||
{
|
||||
public static IEnumerable<ITypeSymbol> GetBaseTypesAndThis(this ITypeSymbol type)
|
||||
{
|
||||
var current = type;
|
||||
while (current != null)
|
||||
{
|
||||
yield return current;
|
||||
current = current.BaseType;
|
||||
}
|
||||
}
|
||||
}
|
||||
139
Robust.Analyzers/PrototypeAnalyzer.cs
Normal file
139
Robust.Analyzers/PrototypeAnalyzer.cs
Normal file
@@ -0,0 +1,139 @@
|
||||
#nullable enable
|
||||
using System.Collections.Immutable;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.CodeAnalysis.CSharp;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
using Microsoft.CodeAnalysis.Diagnostics;
|
||||
using Robust.Roslyn.Shared;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Robust.Analyzers;
|
||||
|
||||
[DiagnosticAnalyzer(LanguageNames.CSharp)]
|
||||
public sealed class PrototypeAnalyzer : DiagnosticAnalyzer
|
||||
{
|
||||
public static readonly DiagnosticDescriptor PrototypeRedundantTypeRule = new(
|
||||
Diagnostics.IdPrototypeRedundantType,
|
||||
"Redundant Prototype Type specification",
|
||||
"Prototype {0} has explicitly set type \"{1}\" that matches autogenerated value",
|
||||
"Usage",
|
||||
DiagnosticSeverity.Warning,
|
||||
true,
|
||||
"Remove the redundant type specification."
|
||||
);
|
||||
|
||||
public static readonly DiagnosticDescriptor PrototypeEndsWithPrototypeRule = new(
|
||||
Diagnostics.IdPrototypeEndsWithPrototype,
|
||||
"Prototype name must end with the word Prototype",
|
||||
"Prototype {0} does not end with the word Prototype",
|
||||
"Usage",
|
||||
DiagnosticSeverity.Error,
|
||||
true,
|
||||
"Add the word Prototype to the end of the class name or manually specify a name in the Prototype attribute."
|
||||
);
|
||||
|
||||
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics =>
|
||||
[PrototypeRedundantTypeRule, PrototypeEndsWithPrototypeRule];
|
||||
|
||||
public override void Initialize(AnalysisContext context)
|
||||
{
|
||||
context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.Analyze |
|
||||
GeneratedCodeAnalysisFlags.ReportDiagnostics);
|
||||
context.EnableConcurrentExecution();
|
||||
|
||||
context.RegisterCompilationStartAction(static ctx =>
|
||||
{
|
||||
var prototypeAttribute =
|
||||
ctx.Compilation.GetTypeByMetadataName("Robust.Shared.Prototypes.PrototypeAttribute");
|
||||
|
||||
// No attribute, no analyzer.
|
||||
if (prototypeAttribute is null)
|
||||
return;
|
||||
|
||||
ctx.RegisterSyntaxNodeAction(
|
||||
symCtx => AnalyzePrototype(symCtx, prototypeAttribute),
|
||||
SyntaxKind.ClassDeclaration);
|
||||
});
|
||||
}
|
||||
|
||||
private static void AnalyzePrototype(SyntaxNodeAnalysisContext context, INamedTypeSymbol prototypeAttributeSymbol)
|
||||
{
|
||||
if (context.Node is not ClassDeclarationSyntax classDeclarationSyntax)
|
||||
return;
|
||||
|
||||
var classSymbol = context.SemanticModel.GetDeclaredSymbol(classDeclarationSyntax);
|
||||
if (classSymbol is null)
|
||||
return;
|
||||
|
||||
var className = classSymbol.Name;
|
||||
|
||||
if (!AttributeHelper.HasAttribute(classSymbol, prototypeAttributeSymbol, out var attributeData))
|
||||
return;
|
||||
|
||||
var prototypeAttribute = GetAttributeSyntax(attributeData, classDeclarationSyntax);
|
||||
if (prototypeAttribute == null)
|
||||
return;
|
||||
|
||||
// Check for autogenerated type
|
||||
if (prototypeAttribute.ArgumentList?.Arguments[0] is not { } argumentSyntax)
|
||||
{
|
||||
if (!className.EndsWith(PrototypeUtility.PrototypeNameEnding))
|
||||
{
|
||||
context.ReportDiagnostic(Diagnostic.Create(PrototypeEndsWithPrototypeRule,
|
||||
classDeclarationSyntax.Identifier.GetLocation(),
|
||||
className));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// We only care about redundancy if the argument is a string literal.
|
||||
// Passing in a value that resolves to a redundant string is fine.
|
||||
if (argumentSyntax.Expression is not LiteralExpressionSyntax literalSyntax)
|
||||
return;
|
||||
|
||||
var literalValue = context.SemanticModel.GetConstantValue(literalSyntax);
|
||||
if (literalValue.Value is not string specifiedName)
|
||||
return;
|
||||
|
||||
var autoName = PrototypeUtility.CalculatePrototypeName(className);
|
||||
|
||||
// Check for name redundancy
|
||||
if (autoName == specifiedName)
|
||||
{
|
||||
// If the class name does not end with "Prototype", allow the redundancy
|
||||
if (!className.EndsWith(PrototypeUtility.PrototypeNameEnding))
|
||||
return;
|
||||
|
||||
var location = argumentSyntax.GetLocation();
|
||||
context.ReportDiagnostic(Diagnostic.Create(PrototypeRedundantTypeRule,
|
||||
location,
|
||||
className,
|
||||
specifiedName));
|
||||
}
|
||||
}
|
||||
|
||||
private static AttributeSyntax? GetAttributeSyntax(
|
||||
AttributeData attributeData,
|
||||
ClassDeclarationSyntax classSyntax)
|
||||
{
|
||||
if (attributeData.ApplicationSyntaxReference is not { } syntaxReference)
|
||||
return null;
|
||||
|
||||
foreach (var attributeList in classSyntax.AttributeLists)
|
||||
{
|
||||
foreach (var attribute in attributeList.Attributes)
|
||||
{
|
||||
if (syntaxReference.SyntaxTree != attribute.SyntaxTree)
|
||||
continue;
|
||||
|
||||
if (!syntaxReference.Span.OverlapsWith(attribute.Span))
|
||||
continue;
|
||||
|
||||
return attribute;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
77
Robust.Analyzers/PrototypeFixer.cs
Normal file
77
Robust.Analyzers/PrototypeFixer.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
#nullable enable
|
||||
using System.Collections.Immutable;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.CodeAnalysis.CodeActions;
|
||||
using Microsoft.CodeAnalysis.CodeFixes;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
using static Robust.Roslyn.Shared.Diagnostics;
|
||||
|
||||
namespace Robust.Analyzers;
|
||||
|
||||
[ExportCodeFixProvider(LanguageNames.CSharp)]
|
||||
public sealed class PrototypeFixer : CodeFixProvider
|
||||
{
|
||||
public override ImmutableArray<string> FixableDiagnosticIds => [IdPrototypeRedundantType];
|
||||
|
||||
public override FixAllProvider GetFixAllProvider()
|
||||
{
|
||||
return WellKnownFixAllProviders.BatchFixer;
|
||||
}
|
||||
|
||||
public override Task RegisterCodeFixesAsync(CodeFixContext context)
|
||||
{
|
||||
foreach (var diagnostic in context.Diagnostics)
|
||||
{
|
||||
switch (diagnostic.Id)
|
||||
{
|
||||
case IdPrototypeRedundantType:
|
||||
return RegisterRemoveType(context, diagnostic);
|
||||
}
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private static async Task RegisterRemoveType(CodeFixContext context, Diagnostic diagnostic)
|
||||
{
|
||||
var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken);
|
||||
var span = diagnostic.Location.SourceSpan;
|
||||
var token = root?.FindToken(span.Start).Parent?.AncestorsAndSelf().OfType<AttributeArgumentSyntax>().First();
|
||||
|
||||
if (token == null)
|
||||
return;
|
||||
|
||||
context.RegisterCodeFix(CodeAction.Create(
|
||||
"Remove explicitly set type",
|
||||
c => RemoveType(context.Document, token, c),
|
||||
"Remove explicitly set type"
|
||||
), diagnostic);
|
||||
}
|
||||
|
||||
private static async Task<Document> RemoveType(Document document, AttributeArgumentSyntax syntax, CancellationToken cancellation)
|
||||
{
|
||||
var root = (CompilationUnitSyntax?) await document.GetSyntaxRootAsync(cancellation);
|
||||
|
||||
if (syntax.Parent is not AttributeArgumentListSyntax argListSyntax)
|
||||
return document;
|
||||
|
||||
if (argListSyntax.Arguments.Count == 1)
|
||||
{
|
||||
// If this is the only argument, remove the whole argument list so we don't leave empty parentheses
|
||||
if (argListSyntax.Parent is not AttributeSyntax attributeSyntax)
|
||||
return document;
|
||||
|
||||
var newAttributeSyntax = attributeSyntax.RemoveNode(argListSyntax, SyntaxRemoveOptions.KeepNoTrivia);
|
||||
root = root!.ReplaceNode(attributeSyntax, newAttributeSyntax!);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Otherwise just remove the argument
|
||||
var newArgListSyntax = argListSyntax.WithArguments(argListSyntax.Arguments.Remove(syntax));
|
||||
root = root!.ReplaceNode(argListSyntax, newArgListSyntax);
|
||||
}
|
||||
|
||||
|
||||
return document.WithSyntaxRoot(root);
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,11 @@
|
||||
<Compile Include="..\Robust.Shared\Serialization\NetSerializableAttribute.cs" LinkBase="Implementations" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- Needed for PrototypeAnalyzer. -->
|
||||
<Compile Include="..\Robust.Shared\Prototypes\PrototypeUtility.cs" LinkBase="Implementations" />
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project="../Robust.Roslyn.Shared/Robust.Roslyn.Shared.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
|
||||
95
Robust.Analyzers/ValidateMemberAnalyzer.cs
Normal file
95
Robust.Analyzers/ValidateMemberAnalyzer.cs
Normal file
@@ -0,0 +1,95 @@
|
||||
#nullable enable
|
||||
using System.Collections.Immutable;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.CodeAnalysis.CSharp;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
using Microsoft.CodeAnalysis.Diagnostics;
|
||||
using Microsoft.CodeAnalysis.Operations;
|
||||
using Robust.Roslyn.Shared;
|
||||
|
||||
namespace Robust.Analyzers;
|
||||
|
||||
[DiagnosticAnalyzer(LanguageNames.CSharp)]
|
||||
public sealed class ValidateMemberAnalyzer : DiagnosticAnalyzer
|
||||
{
|
||||
private const string ValidateMemberType = "Robust.Shared.Analyzers.ValidateMemberAttribute";
|
||||
|
||||
private static readonly DiagnosticDescriptor ValidateMemberDescriptor = new(
|
||||
Diagnostics.IdValidateMember,
|
||||
"Invalid member name",
|
||||
"{0} is not a member of {1}",
|
||||
"Usage",
|
||||
DiagnosticSeverity.Error,
|
||||
true,
|
||||
"Be sure the type and member name are correct.");
|
||||
|
||||
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => [ValidateMemberDescriptor];
|
||||
|
||||
public override void Initialize(AnalysisContext context)
|
||||
{
|
||||
context.EnableConcurrentExecution();
|
||||
context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.Analyze | GeneratedCodeAnalysisFlags.ReportDiagnostics);
|
||||
context.RegisterSyntaxNodeAction(AnalyzeExpression, SyntaxKind.InvocationExpression);
|
||||
}
|
||||
|
||||
private void AnalyzeExpression(SyntaxNodeAnalysisContext context)
|
||||
{
|
||||
if (context.Node is not InvocationExpressionSyntax node)
|
||||
return;
|
||||
|
||||
if (context.SemanticModel.GetSymbolInfo(node.Expression).Symbol is not IMethodSymbol methodSymbol)
|
||||
return;
|
||||
|
||||
// We need at least one type argument for context
|
||||
if (methodSymbol.TypeArguments.Length < 1)
|
||||
return;
|
||||
|
||||
// We'll be checking members of the first type argument
|
||||
if (methodSymbol.TypeArguments[0] is not INamedTypeSymbol targetType)
|
||||
return;
|
||||
|
||||
// We defer building this set until we need it later, so we don't have to build it for every single method invocation!
|
||||
ImmutableHashSet<ISymbol>? members = null;
|
||||
|
||||
// Check each parameter of the method
|
||||
foreach (var parameterContext in node.ArgumentList.Arguments)
|
||||
{
|
||||
|
||||
// Get the symbol for this parameter
|
||||
if (context.SemanticModel.GetOperation(parameterContext) is not IArgumentOperation op || op.Parameter is null)
|
||||
continue;
|
||||
var parameterSymbol = op.Parameter.OriginalDefinition;
|
||||
|
||||
// Make sure the parameter has the ValidateMember attribute
|
||||
if (!AttributeHelper.HasAttribute(parameterSymbol, ValidateMemberType, out _))
|
||||
continue;
|
||||
|
||||
// Find the value passed for this parameter.
|
||||
// We use GetConstantValue to resolve compile-time values - i.e. the result of nameof()
|
||||
if (context.SemanticModel.GetConstantValue(parameterContext.Expression).Value is not string fieldName)
|
||||
continue;
|
||||
|
||||
// Get a set containing all the members of the target type and its ancestors
|
||||
members ??= targetType.GetBaseTypesAndThis().SelectMany(n => n.GetMembers()).ToImmutableHashSet(SymbolEqualityComparer.Default);
|
||||
|
||||
// Check each member of the target type to see if it matches our passed in value
|
||||
var found = false;
|
||||
foreach (var member in members)
|
||||
{
|
||||
if (member.Name == fieldName)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// If we didn't find it, report the violation
|
||||
if (!found)
|
||||
context.ReportDiagnostic(Diagnostic.Create(
|
||||
ValidateMemberDescriptor,
|
||||
parameterContext.GetLocation(),
|
||||
fieldName,
|
||||
targetType.Name
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,5 +59,6 @@ public sealed class DefaultSQLConfig : IConfig
|
||||
public CultureInfo CultureInfo => DefaultConfig.Instance.CultureInfo!;
|
||||
public ConfigOptions Options => DefaultConfig.Instance.Options;
|
||||
public TimeSpan BuildTimeout => DefaultConfig.Instance.BuildTimeout;
|
||||
public WakeLockType WakeLock => DefaultConfig.Instance.WakeLock;
|
||||
public IReadOnlyList<Conclusion> ConfigAnalysisConclusion => DefaultConfig.Instance.ConfigAnalysisConclusion;
|
||||
}
|
||||
|
||||
19
Robust.Benchmarks/NumericsHelpers/Box2Benchmark.cs
Normal file
19
Robust.Benchmarks/NumericsHelpers/Box2Benchmark.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System.Numerics;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using Robust.Shared.Analyzers;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
namespace Robust.Benchmarks.NumericsHelpers;
|
||||
|
||||
[Virtual, DisassemblyDiagnoser]
|
||||
public class Box2Benchmark
|
||||
{
|
||||
public Box2 Box = new();
|
||||
public Matrix3x2 Matrix = new();
|
||||
|
||||
[Benchmark]
|
||||
public Box2 Transform()
|
||||
{
|
||||
return Matrix.TransformBox(Box);
|
||||
}
|
||||
}
|
||||
18
Robust.Benchmarks/NumericsHelpers/Box2RotatedBenchmark.cs
Normal file
18
Robust.Benchmarks/NumericsHelpers/Box2RotatedBenchmark.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.Numerics;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using Robust.Shared.Analyzers;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
namespace Robust.Benchmarks.NumericsHelpers;
|
||||
|
||||
[Virtual, DisassemblyDiagnoser]
|
||||
public class Box2RotatedBenchmark
|
||||
{
|
||||
public Box2Rotated Box = new();
|
||||
|
||||
[Benchmark]
|
||||
public Matrix3x2 GetTransform()
|
||||
{
|
||||
return Box.Transform;
|
||||
}
|
||||
}
|
||||
25
Robust.Benchmarks/NumericsHelpers/GetAABBBenchmark.cs
Normal file
25
Robust.Benchmarks/NumericsHelpers/GetAABBBenchmark.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System.Runtime.Intrinsics;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using Robust.Shared.Analyzers;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
namespace Robust.Benchmarks.NumericsHelpers;
|
||||
|
||||
[Virtual, DisassemblyDiagnoser]
|
||||
public class GetAABBBenchmark
|
||||
{
|
||||
public Vector128<float> X;
|
||||
public Vector128<float> Y;
|
||||
|
||||
[Benchmark(Baseline = true)]
|
||||
public Vector128<float> GetAABB_NoAvx()
|
||||
{
|
||||
return SimdHelpers.GetAABBSlow(X, Y);
|
||||
}
|
||||
|
||||
[Benchmark]
|
||||
public Vector128<float> GetAABB_Avx()
|
||||
{
|
||||
return SimdHelpers.GetAABBAvx(X, Y);
|
||||
}
|
||||
}
|
||||
21
Robust.Benchmarks/NumericsHelpers/SlimPolygonBenchmark.cs
Normal file
21
Robust.Benchmarks/NumericsHelpers/SlimPolygonBenchmark.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using Robust.Shared.Analyzers;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Physics.Shapes;
|
||||
|
||||
namespace Robust.Benchmarks.NumericsHelpers;
|
||||
|
||||
// SlimPolyon is internal, so this won't compile without changes.
|
||||
/*
|
||||
[Virtual, DisassemblyDiagnoser]
|
||||
public class SlimPolygonBenchmark
|
||||
{
|
||||
public Box2Rotated RotBox = new();
|
||||
|
||||
[Benchmark]
|
||||
public SlimPolygon RotatedBox()
|
||||
{
|
||||
return new SlimPolygon(in RotBox);
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1,96 +0,0 @@
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Robust.Shared.Analyzers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Collision.Shapes;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Physics.Dynamics;
|
||||
using Robust.Shared.Physics.Systems;
|
||||
using Robust.UnitTesting.Server;
|
||||
|
||||
namespace Robust.Benchmarks.Physics;
|
||||
|
||||
[Virtual]
|
||||
[MediumRunJob]
|
||||
public class PhysicsBoxStackBenchmark
|
||||
{
|
||||
private ISimulation _sim = default!;
|
||||
|
||||
[GlobalSetup]
|
||||
public void Setup()
|
||||
{
|
||||
_sim = RobustServerSimulation.NewSimulation().InitializeInstance();
|
||||
|
||||
var entManager = _sim.Resolve<IEntityManager>();
|
||||
entManager.System<SharedMapSystem>().CreateMap(out var mapId);
|
||||
SetupTumbler(entManager, mapId);
|
||||
|
||||
for (var i = 0; i < 30; i++)
|
||||
{
|
||||
entManager.TickUpdate(0.016f, false);
|
||||
}
|
||||
}
|
||||
|
||||
[Benchmark]
|
||||
public void BoxStack()
|
||||
{
|
||||
var entManager = _sim.Resolve<IEntityManager>();
|
||||
|
||||
for (var i = 0; i < 10000; i++)
|
||||
{
|
||||
entManager.TickUpdate(0.016f, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetupTumbler(IEntityManager entManager, MapId mapId)
|
||||
{
|
||||
var physics = entManager.System<SharedPhysicsSystem>();
|
||||
var fixtures = entManager.System<FixtureSystem>();
|
||||
|
||||
var groundUid = entManager.SpawnEntity(null, new MapCoordinates(0, 0, mapId));
|
||||
var ground = entManager.AddComponent<PhysicsComponent>(groundUid);
|
||||
|
||||
var horizontal = new EdgeShape(new Vector2(-40, 0), new Vector2(40, 0));
|
||||
fixtures.CreateFixture(groundUid, "fix1", new Fixture(horizontal, 2, 2, true), body: ground);
|
||||
|
||||
var vertical = new EdgeShape(new Vector2(10, 0), new Vector2(10, 10));
|
||||
fixtures.CreateFixture(groundUid, "fix2", new Fixture(vertical, 2, 2, true), body: ground);
|
||||
|
||||
var xs = new[]
|
||||
{
|
||||
0.0f, -10.0f, -5.0f, 5.0f, 10.0f
|
||||
};
|
||||
|
||||
var columnCount = 1;
|
||||
var rowCount = 15;
|
||||
PolygonShape shape;
|
||||
|
||||
for (var j = 0; j < columnCount; j++)
|
||||
{
|
||||
for (var i = 0; i < rowCount; i++)
|
||||
{
|
||||
var x = 0.0f;
|
||||
|
||||
var boxUid = entManager.SpawnEntity(null,
|
||||
new MapCoordinates(new Vector2(xs[j] + x, 0.55f + 1.1f * i), mapId));
|
||||
var box = entManager.AddComponent<PhysicsComponent>(boxUid);
|
||||
|
||||
physics.SetBodyType(boxUid, BodyType.Dynamic, body: box);
|
||||
|
||||
shape = new PolygonShape();
|
||||
shape.SetAsBox(0.5f, 0.5f);
|
||||
physics.SetFixedRotation(boxUid, false, body: box);
|
||||
fixtures.CreateFixture(boxUid, "fix1", new Fixture(shape, 2, 2, true), body: box);
|
||||
|
||||
physics.WakeBody(boxUid, body: box);
|
||||
physics.SetSleepingAllowed(boxUid, box, false);
|
||||
}
|
||||
}
|
||||
|
||||
physics.WakeBody(groundUid, body: ground);
|
||||
}
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
using System.Numerics;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using Robust.Shared.Analyzers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Collision.Shapes;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Physics.Dynamics;
|
||||
using Robust.Shared.Physics.Systems;
|
||||
using Robust.UnitTesting.Server;
|
||||
|
||||
namespace Robust.Benchmarks.Physics;
|
||||
|
||||
[Virtual]
|
||||
public class PhysicsCircleStackBenchmark
|
||||
{
|
||||
private ISimulation _sim = default!;
|
||||
|
||||
[GlobalSetup]
|
||||
public void Setup()
|
||||
{
|
||||
_sim = RobustServerSimulation.NewSimulation().InitializeInstance();
|
||||
|
||||
var entManager = _sim.Resolve<IEntityManager>();
|
||||
entManager.System<SharedMapSystem>().CreateMap(out var mapId);
|
||||
SetupTumbler(entManager, mapId);
|
||||
|
||||
for (var i = 0; i < 30; i++)
|
||||
{
|
||||
entManager.TickUpdate(0.016f, false);
|
||||
}
|
||||
}
|
||||
|
||||
[Benchmark]
|
||||
public void CircleStack()
|
||||
{
|
||||
var entManager = _sim.Resolve<IEntityManager>();
|
||||
|
||||
for (var i = 0; i < 10000; i++)
|
||||
{
|
||||
entManager.TickUpdate(0.016f, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetupTumbler(IEntityManager entManager, MapId mapId)
|
||||
{
|
||||
var physics = entManager.System<SharedPhysicsSystem>();
|
||||
var fixtures = entManager.System<FixtureSystem>();
|
||||
|
||||
var groundUid = entManager.SpawnEntity(null, new MapCoordinates(0, 0, mapId));
|
||||
var ground = entManager.AddComponent<PhysicsComponent>(groundUid);
|
||||
|
||||
var horizontal = new EdgeShape(new Vector2(-40, 0), new Vector2(40, 0));
|
||||
fixtures.CreateFixture(groundUid, "fix1", new Fixture(horizontal, 2, 2, true), body: ground);
|
||||
|
||||
var vertical = new EdgeShape(new Vector2(20, 0), new Vector2(20, 20));
|
||||
fixtures.CreateFixture(groundUid, "fix2", new Fixture(vertical, 2, 2, true), body: ground);
|
||||
|
||||
var xs = new[]
|
||||
{
|
||||
0.0f, -10.0f, -5.0f, 5.0f, 10.0f
|
||||
};
|
||||
|
||||
var columnCount = 1;
|
||||
var rowCount = 15;
|
||||
PhysShapeCircle shape;
|
||||
|
||||
for (var j = 0; j < columnCount; j++)
|
||||
{
|
||||
for (var i = 0; i < rowCount; i++)
|
||||
{
|
||||
var x = 0.0f;
|
||||
|
||||
var boxUid = entManager.SpawnEntity(null,
|
||||
new MapCoordinates(new Vector2(xs[j] + x, 0.55f + 2.1f * i), mapId));
|
||||
var box = entManager.AddComponent<PhysicsComponent>(boxUid);
|
||||
|
||||
physics.SetBodyType(boxUid, BodyType.Dynamic, body: box);
|
||||
shape = new PhysShapeCircle(0.5f);
|
||||
physics.SetFixedRotation(boxUid, false, body: box);
|
||||
// TODO: Need to detect shape and work out if we need to use fixedrotation
|
||||
|
||||
fixtures.CreateFixture(boxUid, "fix1", new Fixture(shape, 2, 2, true, 5f));
|
||||
physics.WakeBody(boxUid, body: box);
|
||||
physics.SetSleepingAllowed(boxUid, box, false);
|
||||
}
|
||||
}
|
||||
|
||||
physics.WakeBody(groundUid, body: ground);
|
||||
}
|
||||
}
|
||||
312
Robust.Benchmarks/Physics/PhysicsBenchmark.cs
Normal file
312
Robust.Benchmarks/Physics/PhysicsBenchmark.cs
Normal file
@@ -0,0 +1,312 @@
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using Robust.Shared.Analyzers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Collision.Shapes;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Physics.Dynamics;
|
||||
using Robust.Shared.Physics.Systems;
|
||||
using Robust.UnitTesting.Server;
|
||||
|
||||
namespace Robust.Benchmarks.Physics;
|
||||
|
||||
[Virtual, MediumRunJob]
|
||||
public class PhysicsBenchmark
|
||||
{
|
||||
// TODO: Rain
|
||||
// Large pyramid
|
||||
// Joint Grid
|
||||
// Spinner
|
||||
// Washer
|
||||
|
||||
const float frameTime = 0.016f;
|
||||
|
||||
#region Many Pyramids
|
||||
|
||||
private ISimulation _manyPyramidSim = default!;
|
||||
|
||||
[GlobalSetup(Target = nameof(ManyPyramids))]
|
||||
public void PyramidSetup()
|
||||
{
|
||||
_manyPyramidSim = RobustServerSimulation.NewSimulation().InitializeInstance();
|
||||
|
||||
var entManager = _manyPyramidSim.Resolve<IEntityManager>();
|
||||
entManager.System<SharedMapSystem>().CreateMap(out var mapId);
|
||||
SetupManyPyramids(entManager, mapId);
|
||||
}
|
||||
|
||||
[Benchmark]
|
||||
public void ManyPyramids()
|
||||
{
|
||||
var entManager = _manyPyramidSim.Resolve<IEntityManager>();
|
||||
|
||||
for (var i = 0; i < (1f / frameTime) * 10; i++)
|
||||
{
|
||||
entManager.TickUpdate(frameTime, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetupManyPyramids(IEntityManager entManager, MapId mapId)
|
||||
{
|
||||
int baseCount = 10;
|
||||
float extent = 0.5f;
|
||||
int rowCount = 20; // 5
|
||||
int columnCount = 5;
|
||||
|
||||
// Setup ground
|
||||
var physics = entManager.System<SharedPhysicsSystem>();
|
||||
var fixtures = entManager.System<FixtureSystem>();
|
||||
physics.SetGravity(new Vector2(0f, -9.8f));
|
||||
|
||||
// Setup boxes
|
||||
float a = 0.5f;
|
||||
PolygonShape shape = new();
|
||||
shape.SetAsBox(a, a);
|
||||
|
||||
float groundDeltaY = 2.0f * extent * ( baseCount + 1.0f );
|
||||
float groundWidth = 2.0f * extent * columnCount * ( baseCount + 1.0f );
|
||||
|
||||
float groundY = 0.0f;
|
||||
|
||||
for ( int i = 0; i < rowCount; ++i )
|
||||
{
|
||||
var groundUid = entManager.SpawnEntity(null, new MapCoordinates(0, 0, mapId));
|
||||
var ground = entManager.AddComponent<PhysicsComponent>(groundUid);
|
||||
|
||||
var horizontal = new EdgeShape(new Vector2(-0.5f * 2.0f * groundWidth, groundY), new Vector2(0.5f * 2.0f * groundWidth, groundY));
|
||||
fixtures.CreateFixture(groundUid, "fix1", new Fixture(horizontal, 2, 2, true), body: ground);
|
||||
physics.WakeBody(groundUid, body: ground);
|
||||
groundY += groundDeltaY;
|
||||
}
|
||||
|
||||
float baseWidth = 2.0f * extent * baseCount;
|
||||
float baseY = 0.0f;
|
||||
|
||||
for ( int i = 0; i < rowCount; ++i )
|
||||
{
|
||||
for ( int j = 0; j < columnCount; ++j )
|
||||
{
|
||||
float centerX = -0.5f * groundWidth + j * ( baseWidth + 2.0f * extent ) + extent;
|
||||
CreateSmallPyramid(entManager, mapId, baseCount, extent, centerX, baseY);
|
||||
}
|
||||
|
||||
baseY += groundDeltaY;
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateSmallPyramid(IEntityManager entManager, MapId mapId, int baseCount, float extent, float centerX, float baseY)
|
||||
{
|
||||
var physics = entManager.System<SharedPhysicsSystem>();
|
||||
var fixtures = entManager.System<FixtureSystem>();
|
||||
var shape = new PolygonShape();
|
||||
shape.SetAsBox(extent, extent);
|
||||
|
||||
for ( int i = 0; i < baseCount; ++i )
|
||||
{
|
||||
float y = ( 2.0f * i + 1.0f ) * extent + baseY;
|
||||
|
||||
for ( int j = i; j < baseCount; ++j )
|
||||
{
|
||||
float x = ( i + 1.0f ) * extent + 2.0f * ( j - i ) * extent + centerX - 0.5f;
|
||||
|
||||
var boxUid = entManager.SpawnEntity(null, new MapCoordinates(new Vector2(x, y), mapId));
|
||||
var box = entManager.AddComponent<PhysicsComponent>(boxUid);
|
||||
physics.SetBodyType(boxUid, BodyType.Dynamic, body: box);
|
||||
|
||||
fixtures.CreateFixture(boxUid, "fix1", new Fixture(shape, 2, 2, true, 5f), body: box);
|
||||
physics.WakeBody(boxUid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Smash
|
||||
|
||||
private ISimulation _smashSim = default!;
|
||||
|
||||
[GlobalSetup(Target = nameof(Smash))]
|
||||
public void SmashSetup()
|
||||
{
|
||||
_smashSim = RobustServerSimulation.NewSimulation().InitializeInstance();
|
||||
|
||||
var entManager = _smashSim.Resolve<IEntityManager>();
|
||||
|
||||
entManager.System<SharedMapSystem>().CreateMap(out var mapId);
|
||||
|
||||
var physics = entManager.System<SharedPhysicsSystem>();
|
||||
var fixtures = entManager.System<FixtureSystem>();
|
||||
var joints = entManager.System<SharedJointSystem>();
|
||||
var xformSystem = entManager.System<SharedTransformSystem>();
|
||||
physics.SetGravity(new Vector2(0f, -9.8f));
|
||||
|
||||
{
|
||||
var smashBox = new PolygonShape();
|
||||
smashBox.SetAsBox(4f, 4f);
|
||||
|
||||
var bodyUid = entManager.SpawnEntity(null, new MapCoordinates(0f, 10f, mapId));
|
||||
var body = entManager.AddComponent<PhysicsComponent>(bodyUid);
|
||||
|
||||
physics.SetBodyType(bodyUid, BodyType.Dynamic, body: body);
|
||||
physics.SetSleepingAllowed(bodyUid, body, false);
|
||||
physics.SetFixedRotation(bodyUid, false, body: body);
|
||||
xformSystem.SetLocalPosition(bodyUid, new Vector2(-20f, 0f));
|
||||
physics.SetLinearVelocity(bodyUid, new Vector2(40f, 0f));
|
||||
|
||||
fixtures.TryCreateFixture(bodyUid, smashBox, "fix1", density: 8f, hard: true);
|
||||
}
|
||||
|
||||
float d = 0.4f;
|
||||
var box = new PolygonShape();
|
||||
box.SetAsBox(0.5f * d, 0.5f * d);
|
||||
|
||||
int columns = 120; // 20
|
||||
int rows = 80; // 10
|
||||
|
||||
for ( int i = 0; i < columns; ++i )
|
||||
{
|
||||
for ( int j = 0; j < rows; ++j )
|
||||
{
|
||||
var bodyUid = entManager.SpawnEntity(null, new MapCoordinates(i * d + 30f, ( j - rows / 2.0f ) * d, mapId));
|
||||
var body = entManager.AddComponent<PhysicsComponent>(bodyUid);
|
||||
|
||||
physics.SetBodyType(bodyUid, BodyType.Dynamic, body: body);
|
||||
physics.SetSleepingAllowed(bodyUid, body, false);
|
||||
physics.SetFixedRotation(bodyUid, false, body: body);
|
||||
xformSystem.SetLocalPosition(bodyUid, new Vector2(-20f, 0f));
|
||||
physics.SetLinearVelocity(bodyUid, new Vector2(40f, 0f));
|
||||
|
||||
fixtures.TryCreateFixture(bodyUid, box, "fix1", hard: true);
|
||||
physics.WakeBody(bodyUid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Benchmark]
|
||||
public void Smash()
|
||||
{
|
||||
var entManager = _smashSim.Resolve<IEntityManager>();
|
||||
|
||||
for (var i = 0; i < (1f / frameTime) * 10; i++)
|
||||
{
|
||||
entManager.TickUpdate(frameTime, false);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Tumbler
|
||||
|
||||
private ISimulation _tumblerSim = default!;
|
||||
|
||||
[GlobalSetup(Target = nameof(Tumbler))]
|
||||
public void TumblerSetup()
|
||||
{
|
||||
_tumblerSim = RobustServerSimulation.NewSimulation().InitializeInstance();
|
||||
|
||||
var entManager = _tumblerSim.Resolve<IEntityManager>();
|
||||
|
||||
entManager.System<SharedMapSystem>().CreateMap(out var mapId);
|
||||
SetupTumbler(entManager, mapId);
|
||||
}
|
||||
|
||||
[Benchmark]
|
||||
public void Tumbler()
|
||||
{
|
||||
var entManager = _tumblerSim.Resolve<IEntityManager>();
|
||||
|
||||
for (var i = 0; i < 1 / frameTime * 10; i++)
|
||||
{
|
||||
entManager.TickUpdate(frameTime, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetupTumbler(IEntityManager entManager, MapId mapId)
|
||||
{
|
||||
var physics = entManager.System<SharedPhysicsSystem>();
|
||||
var fixtures = entManager.System<FixtureSystem>();
|
||||
var joints = entManager.System<SharedJointSystem>();
|
||||
physics.SetGravity(new Vector2(0f, -9.8f));
|
||||
|
||||
{
|
||||
var groundUid = entManager.SpawnEntity(null, new MapCoordinates(0f, 0f, mapId));
|
||||
var ground = entManager.AddComponent<PhysicsComponent>(groundUid);
|
||||
// Due to lookup changes fixtureless bodies are invalid, so
|
||||
var cShape = new PhysShapeCircle(1f);
|
||||
fixtures.CreateFixture(groundUid, "fix1", new Fixture(cShape, 0, 0, false));
|
||||
|
||||
var bodyUid = entManager.SpawnEntity(null, new MapCoordinates(0f, 10f, mapId));
|
||||
var body = entManager.AddComponent<PhysicsComponent>(bodyUid);
|
||||
|
||||
physics.SetBodyType(bodyUid, BodyType.Dynamic, body: body);
|
||||
physics.SetSleepingAllowed(bodyUid, body, false);
|
||||
physics.SetFixedRotation(bodyUid, false, body: body);
|
||||
|
||||
|
||||
// TODO: Box2D just deref, bleh shape structs someday
|
||||
var shape1 = new PolygonShape();
|
||||
shape1.SetAsBox(0.5f, 10.0f, new Vector2(10.0f, 0.0f), 0.0f);
|
||||
fixtures.CreateFixture(bodyUid, "fix1", new Fixture(shape1, 2, 0, true, 50f));
|
||||
|
||||
var shape2 = new PolygonShape();
|
||||
shape2.SetAsBox(0.5f, 10.0f, new Vector2(-10.0f, 0.0f), 0f);
|
||||
fixtures.CreateFixture(bodyUid, "fix2", new Fixture(shape2, 2, 0, true, 50f));
|
||||
|
||||
var shape3 = new PolygonShape();
|
||||
shape3.SetAsBox(10.0f, 0.5f, new Vector2(0.0f, 10.0f), 0f);
|
||||
fixtures.CreateFixture(bodyUid, "fix3", new Fixture(shape3, 2, 0, true, 50f));
|
||||
|
||||
var shape4 = new PolygonShape();
|
||||
shape4.SetAsBox(10.0f, 0.5f, new Vector2(0.0f, -10.0f), 0f);
|
||||
fixtures.CreateFixture(bodyUid, "fix4", new Fixture(shape4, 2, 0, true, 50f));
|
||||
|
||||
physics.WakeBody(groundUid, body: ground);
|
||||
physics.WakeBody(bodyUid, body: body);
|
||||
var revolute = joints.CreateRevoluteJoint(groundUid, bodyUid);
|
||||
|
||||
var motorSpeed = 25f;
|
||||
|
||||
revolute.LocalAnchorA = new Vector2(0f, 10f);
|
||||
revolute.LocalAnchorB = new Vector2(0f, 0f);
|
||||
revolute.ReferenceAngle = 0f;
|
||||
revolute.MotorSpeed = MathF.PI / 180f * motorSpeed;
|
||||
revolute.MaxMotorTorque = 100000000f;
|
||||
revolute.EnableMotor = true;
|
||||
}
|
||||
|
||||
// Make boxes
|
||||
{
|
||||
var gridCount = 20; // 45
|
||||
var y = -0.2f * gridCount + 10f;
|
||||
|
||||
var a = 0.125f;
|
||||
PolygonShape shape = new();
|
||||
shape.SetAsBox(a, a);
|
||||
|
||||
for (var i = 0; i < gridCount; i++)
|
||||
{
|
||||
var x = -0.2f * gridCount;
|
||||
|
||||
for (var j = 0; j < gridCount; j++)
|
||||
{
|
||||
var boxUid = entManager.SpawnEntity(null, new MapCoordinates(new Vector2(x, y), mapId));
|
||||
var body = entManager.AddComponent<PhysicsComponent>(boxUid);
|
||||
physics.SetBodyType(boxUid, BodyType.Dynamic, body: body);
|
||||
|
||||
fixtures.CreateFixture(boxUid, "fix1", new Fixture(shape, 2, 2, true, 5f), body: body);
|
||||
x += 0.4f;
|
||||
|
||||
physics.WakeBody(boxUid, body: body);
|
||||
physics.SetSleepingAllowed(boxUid, body, false);
|
||||
}
|
||||
|
||||
y += 0.4f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using Robust.Shared.Analyzers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Collision.Shapes;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Physics.Dynamics;
|
||||
using Robust.Shared.Physics.Systems;
|
||||
using Robust.UnitTesting.Server;
|
||||
|
||||
namespace Robust.Benchmarks.Physics;
|
||||
|
||||
[Virtual]
|
||||
public class PhysicsPyramidBenchmark
|
||||
{
|
||||
private ISimulation _sim = default!;
|
||||
|
||||
[GlobalSetup]
|
||||
public void Setup()
|
||||
{
|
||||
_sim = RobustServerSimulation.NewSimulation().InitializeInstance();
|
||||
|
||||
var entManager = _sim.Resolve<IEntityManager>();
|
||||
entManager.System<SharedMapSystem>().CreateMap(out var mapId);
|
||||
SetupTumbler(entManager, mapId);
|
||||
|
||||
for (var i = 0; i < 300; i++)
|
||||
{
|
||||
entManager.TickUpdate(0.016f, false);
|
||||
}
|
||||
}
|
||||
|
||||
[Benchmark]
|
||||
public void Pyramid()
|
||||
{
|
||||
var entManager = _sim.Resolve<IEntityManager>();
|
||||
|
||||
for (var i = 0; i < 5000; i++)
|
||||
{
|
||||
entManager.TickUpdate(0.016f, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetupTumbler(IEntityManager entManager, MapId mapId)
|
||||
{
|
||||
const byte count = 20;
|
||||
|
||||
// Setup ground
|
||||
var physics = entManager.System<SharedPhysicsSystem>();
|
||||
var fixtures = entManager.System<FixtureSystem>();
|
||||
var groundUid = entManager.SpawnEntity(null, new MapCoordinates(0, 0, mapId));
|
||||
var ground = entManager.AddComponent<PhysicsComponent>(groundUid);
|
||||
|
||||
var horizontal = new EdgeShape(new Vector2(40, 0), new Vector2(-40, 0));
|
||||
fixtures.CreateFixture(groundUid, "fix1", new Fixture(horizontal, 2, 2, true), body: ground);
|
||||
physics.WakeBody(groundUid, body: ground);
|
||||
|
||||
// Setup boxes
|
||||
float a = 0.5f;
|
||||
PolygonShape shape = new();
|
||||
shape.SetAsBox(a, a);
|
||||
|
||||
var x = new Vector2(-7.0f, 0.75f);
|
||||
Vector2 y;
|
||||
Vector2 deltaX = new Vector2(0.5625f, 1.25f);
|
||||
Vector2 deltaY = new Vector2(1.125f, 0.0f);
|
||||
|
||||
for (var i = 0; i < count; ++i)
|
||||
{
|
||||
y = x;
|
||||
|
||||
for (var j = i; j < count; ++j)
|
||||
{
|
||||
var boxUid = entManager.SpawnEntity(null, new MapCoordinates(y, mapId));
|
||||
var box = entManager.AddComponent<PhysicsComponent>(boxUid);
|
||||
physics.SetBodyType(boxUid, BodyType.Dynamic, body: box);
|
||||
|
||||
fixtures.CreateFixture(boxUid, "fix1", new Fixture(shape, 2, 2, true, 5f), body: box);
|
||||
y += deltaY;
|
||||
|
||||
physics.WakeBody(boxUid, body: box);
|
||||
physics.SetSleepingAllowed(boxUid, box, false);
|
||||
}
|
||||
|
||||
x += deltaX;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using Robust.Shared.Analyzers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Collision.Shapes;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Physics.Dynamics;
|
||||
using Robust.Shared.Physics.Systems;
|
||||
using Robust.UnitTesting.Server;
|
||||
|
||||
namespace Robust.Benchmarks.Physics;
|
||||
|
||||
[Virtual]
|
||||
public class PhysicsTumblerBenchmark
|
||||
{
|
||||
private ISimulation _sim = default!;
|
||||
|
||||
[GlobalSetup]
|
||||
public void Setup()
|
||||
{
|
||||
_sim = RobustServerSimulation.NewSimulation().InitializeInstance();
|
||||
|
||||
var entManager = _sim.Resolve<IEntityManager>();
|
||||
var physics = entManager.System<SharedPhysicsSystem>();
|
||||
var fixtures = entManager.System<FixtureSystem>();
|
||||
var mapUid = entManager.System<SharedMapSystem>().CreateMap(out var mapId);
|
||||
SetupTumbler(entManager, mapId);
|
||||
|
||||
for (var i = 0; i < 300; i++)
|
||||
{
|
||||
entManager.TickUpdate(0.016f, false);
|
||||
var boxUid = entManager.SpawnEntity(null, new MapCoordinates(0f, 10f, mapId));
|
||||
var box = entManager.AddComponent<PhysicsComponent>(boxUid);
|
||||
physics.SetBodyType(boxUid, BodyType.Dynamic, body: box);
|
||||
physics.SetFixedRotation(boxUid, false, body: box);
|
||||
var shape = new PolygonShape();
|
||||
shape.SetAsBox(0.125f, 0.125f);
|
||||
fixtures.CreateFixture(boxUid, "fix1", new Fixture(shape, 2, 2, true, 0.0625f), body: box);
|
||||
physics.WakeBody(boxUid, body: box);
|
||||
physics.SetSleepingAllowed(boxUid, box, false);
|
||||
}
|
||||
|
||||
if (entManager.TryGetComponent(mapUid, out BroadphaseComponent? mapBroadphase))
|
||||
entManager.System<SharedBroadphaseSystem>().RebuildBottomUp(mapBroadphase);
|
||||
}
|
||||
|
||||
[Benchmark]
|
||||
public void Tumbler()
|
||||
{
|
||||
var entManager = _sim.Resolve<IEntityManager>();
|
||||
|
||||
for (var i = 0; i < 1000; i++)
|
||||
{
|
||||
entManager.TickUpdate(0.016f, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetupTumbler(IEntityManager entManager, MapId mapId)
|
||||
{
|
||||
var physics = entManager.System<SharedPhysicsSystem>();
|
||||
var fixtures = entManager.System<FixtureSystem>();
|
||||
var joints = entManager.System<SharedJointSystem>();
|
||||
|
||||
var groundUid = entManager.SpawnEntity(null, new MapCoordinates(0f, 0f, mapId));
|
||||
var ground = entManager.AddComponent<PhysicsComponent>(groundUid);
|
||||
// Due to lookup changes fixtureless bodies are invalid, so
|
||||
var cShape = new PhysShapeCircle(1f);
|
||||
fixtures.CreateFixture(groundUid, "fix1", new Fixture(cShape, 0, 0, false));
|
||||
|
||||
var bodyUid = entManager.SpawnEntity(null, new MapCoordinates(0f, 10f, mapId));
|
||||
var body = entManager.AddComponent<PhysicsComponent>(bodyUid);
|
||||
|
||||
physics.SetBodyType(bodyUid, BodyType.Dynamic, body: body);
|
||||
physics.SetSleepingAllowed(bodyUid, body, false);
|
||||
physics.SetFixedRotation(bodyUid, false, body: body);
|
||||
|
||||
|
||||
// TODO: Box2D just deref, bleh shape structs someday
|
||||
var shape1 = new PolygonShape();
|
||||
shape1.SetAsBox(0.5f, 10.0f, new Vector2(10.0f, 0.0f), 0.0f);
|
||||
fixtures.CreateFixture(bodyUid, "fix1", new Fixture(shape1, 2, 0, true, 20f));
|
||||
|
||||
var shape2 = new PolygonShape();
|
||||
shape2.SetAsBox(0.5f, 10.0f, new Vector2(-10.0f, 0.0f), 0f);
|
||||
fixtures.CreateFixture(bodyUid, "fix2", new Fixture(shape2, 2, 0, true, 20f));
|
||||
|
||||
var shape3 = new PolygonShape();
|
||||
shape3.SetAsBox(10.0f, 0.5f, new Vector2(0.0f, 10.0f), 0f);
|
||||
fixtures.CreateFixture(bodyUid, "fix3", new Fixture(shape3, 2, 0, true, 20f));
|
||||
|
||||
var shape4 = new PolygonShape();
|
||||
shape4.SetAsBox(10.0f, 0.5f, new Vector2(0.0f, -10.0f), 0f);
|
||||
fixtures.CreateFixture(bodyUid, "fix4", new Fixture(shape4, 2, 0, true, 20f));
|
||||
|
||||
physics.WakeBody(groundUid, body: ground);
|
||||
physics.WakeBody(bodyUid, body: body);
|
||||
var revolute = joints.CreateRevoluteJoint(groundUid, bodyUid);
|
||||
revolute.LocalAnchorA = new Vector2(0f, 10f);
|
||||
revolute.LocalAnchorB = new Vector2(0f, 0f);
|
||||
revolute.ReferenceAngle = 0f;
|
||||
revolute.MotorSpeed = 0.05f * MathF.PI;
|
||||
revolute.MaxMotorTorque = 100000000f;
|
||||
revolute.EnableMotor = true;
|
||||
}
|
||||
}
|
||||
@@ -6,14 +6,20 @@
|
||||
<OutputPath>../bin/Benchmarks</OutputPath>
|
||||
<OutputType>Exe</OutputType>
|
||||
<NoWarn>RA0003</NoWarn>
|
||||
<IsTestingPlatformApplication>false</IsTestingPlatformApplication>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Robust.Server.Testing\Robust.Server.Testing.csproj" />
|
||||
<ProjectReference Include="..\Robust.Server\Robust.Server.csproj" />
|
||||
<ProjectReference Include="..\Robust.Shared.Maths\Robust.Shared.Maths.csproj" />
|
||||
<ProjectReference Include="..\Robust.Shared\Robust.Shared.csproj" />
|
||||
<ProjectReference Include="..\Robust.UnitTesting\Robust.UnitTesting.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BenchmarkDotNet" />
|
||||
<PackageReference Include="JetBrains.Annotations" />
|
||||
<PackageReference Include="YamlDotNet" />
|
||||
<PackageReference Include="prometheus-net" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Build.Framework" Version="17.8.3" />
|
||||
<PackageReference Include="Mono.Cecil" Version="0.11.5" />
|
||||
<PackageReference Include="Microsoft.Build.Framework" Version="18.0.2" />
|
||||
<PackageReference Include="Mono.Cecil" Version="0.11.6" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\MSBuild\Robust.Engine.props"/>
|
||||
|
||||
<PropertyGroup>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<OutputPath>../bin/Client.IntegrationTests</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="JetBrains.Annotations"/>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk"/>
|
||||
<PackageReference Include="Moq" />
|
||||
<PackageReference Include="NUnit"/>
|
||||
<PackageReference Include="NUnit3TestAdapter"/>
|
||||
<PackageReference Include="NUnit.Analyzers"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\NetSerializer\NetSerializer\NetSerializer.csproj" />
|
||||
<ProjectReference Include="..\Robust.Client\Robust.Client.csproj" />
|
||||
<ProjectReference Include="..\Robust.Server.Testing\Robust.Server.Testing.csproj" />
|
||||
<ProjectReference Include="..\Robust.Server\Robust.Server.csproj" />
|
||||
<ProjectReference Include="..\Robust.Shared.Maths\Robust.Shared.Maths.csproj"/>
|
||||
<ProjectReference Include="..\Robust.Shared.Maths.Testing\Robust.Shared.Maths.Testing.csproj"/>
|
||||
<ProjectReference Include="..\Robust.Shared\Robust.Shared.csproj"/>
|
||||
<ProjectReference Include="..\Robust.UnitTesting\Robust.UnitTesting.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project="..\MSBuild\Robust.Properties.targets"/>
|
||||
</Project>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user