From 5c847ee852c999625ab2d7e4c7bf3633ec31ab6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C5=81awreszuk?= <31008367+Jklawreszuk@users.noreply.github.com> Date: Fri, 15 Mar 2024 14:33:34 +0100 Subject: [PATCH] feat: Update samples/template to top-level statements (#2187) --- .../SimpleAudio.Windows/SimpleAudioApp.cs | 16 +++------------- .../JumpyJet/JumpyJet.Windows/JumpyJetApp.cs | 16 +++------------- .../SpaceEscape.Windows/SpaceEscapeApp.cs | 16 +++------------- .../AnimatedModel.Windows/AnimatedModelApp.cs | 16 +++------------- .../CustomEffect.Windows/CustomEffectApp.cs | 16 +++------------- .../MaterialShaderApp.cs | 16 +++------------- .../SpriteFonts.Windows/SpriteFontsApp.cs | 16 +++------------- .../SpriteStudioDemoApp.cs | 16 +++------------- .../GravitySensor.Windows/GravitySensorApp.cs | 16 +++------------- .../TouchInputs.Windows/TouchInputsApp.cs | 16 +++------------- .../ParticlesSampleApp.cs | 16 +++------------- .../PhysicsSample.Windows/PhysicsSampleApp.cs | 16 +++------------- samples/StrideSamples.userprefs | 8 -------- .../FirstPersonShooterApp.cs | 16 +++------------- .../ThirdPersonPlatformerApp.cs | 16 +++------------- .../TopDownRPG.Windows/TopDownRPGApp.cs | 16 +++------------- .../VRSandbox.Windows/VRSandboxApp.cs | 16 +++------------- .../CSharpBeginnerApp.cs | 18 +++++------------- .../CSharpIntermediateApp.cs | 18 +++++------------- .../GameMenu/GameMenu.Windows/GameMenuApp.cs | 16 +++------------- .../UIElementLink.Windows/UIElementLinkApp.cs | 16 +++------------- .../UIParticles.Windows/UIParticlesApp.cs | 16 +++------------- .../$PackageGameNameShort$App.cs.t4 | 16 +++------------- .../$PackageGameNameShort$App.cs.t4 | 16 +++------------- .../$PackageGameNameShort$App.cs.t4 | 16 +++------------- .../Stride.Input.Tests/AdvancedInputTest.cs | 4 ++-- .../Stride.Input.Tests/TestInputEvents.cs | 4 ++-- 27 files changed, 80 insertions(+), 324 deletions(-) delete mode 100644 samples/StrideSamples.userprefs diff --git a/samples/Audio/SimpleAudio/SimpleAudio.Windows/SimpleAudioApp.cs b/samples/Audio/SimpleAudio/SimpleAudio.Windows/SimpleAudioApp.cs index 1ebf838adc..89957d38c3 100644 --- a/samples/Audio/SimpleAudio/SimpleAudio.Windows/SimpleAudioApp.cs +++ b/samples/Audio/SimpleAudio/SimpleAudio.Windows/SimpleAudioApp.cs @@ -1,15 +1,5 @@ using Stride.Engine; -namespace SimpleAudio -{ - class SimpleAudioApp - { - static void Main(string[] args) - { - using (var game = new Game()) - { - game.Run(); - } - } - } -} +using var game = new Game(); +game.Run(); + diff --git a/samples/Games/JumpyJet/JumpyJet.Windows/JumpyJetApp.cs b/samples/Games/JumpyJet/JumpyJet.Windows/JumpyJetApp.cs index 0983f1597a..89957d38c3 100644 --- a/samples/Games/JumpyJet/JumpyJet.Windows/JumpyJetApp.cs +++ b/samples/Games/JumpyJet/JumpyJet.Windows/JumpyJetApp.cs @@ -1,15 +1,5 @@ using Stride.Engine; -namespace JumpyJet -{ - class JumpyJetApp - { - static void Main(string[] args) - { - using (var game = new Game()) - { - game.Run(); - } - } - } -} +using var game = new Game(); +game.Run(); + diff --git a/samples/Games/SpaceEscape/SpaceEscape.Windows/SpaceEscapeApp.cs b/samples/Games/SpaceEscape/SpaceEscape.Windows/SpaceEscapeApp.cs index dea05ce69c..89957d38c3 100644 --- a/samples/Games/SpaceEscape/SpaceEscape.Windows/SpaceEscapeApp.cs +++ b/samples/Games/SpaceEscape/SpaceEscape.Windows/SpaceEscapeApp.cs @@ -1,15 +1,5 @@ using Stride.Engine; -namespace SpaceEscape -{ - class SpaceEscapeApp - { - static void Main(string[] args) - { - using (var game = new Game()) - { - game.Run(); - } - } - } -} +using var game = new Game(); +game.Run(); + diff --git a/samples/Graphics/AnimatedModel/AnimatedModel.Windows/AnimatedModelApp.cs b/samples/Graphics/AnimatedModel/AnimatedModel.Windows/AnimatedModelApp.cs index 7661294fad..89957d38c3 100644 --- a/samples/Graphics/AnimatedModel/AnimatedModel.Windows/AnimatedModelApp.cs +++ b/samples/Graphics/AnimatedModel/AnimatedModel.Windows/AnimatedModelApp.cs @@ -1,15 +1,5 @@ using Stride.Engine; -namespace AnimatedModel -{ - class AnimatedModelApp - { - static void Main(string[] args) - { - using (var game = new Game()) - { - game.Run(); - } - } - } -} +using var game = new Game(); +game.Run(); + diff --git a/samples/Graphics/CustomEffect/CustomEffect.Windows/CustomEffectApp.cs b/samples/Graphics/CustomEffect/CustomEffect.Windows/CustomEffectApp.cs index bcc2e29dd4..89957d38c3 100644 --- a/samples/Graphics/CustomEffect/CustomEffect.Windows/CustomEffectApp.cs +++ b/samples/Graphics/CustomEffect/CustomEffect.Windows/CustomEffectApp.cs @@ -1,15 +1,5 @@ using Stride.Engine; -namespace CustomEffect -{ - class CustomEffectApp - { - static void Main(string[] args) - { - using (var game = new Game()) - { - game.Run(); - } - } - } -} +using var game = new Game(); +game.Run(); + diff --git a/samples/Graphics/MaterialShader/MaterialShader.Windows/MaterialShaderApp.cs b/samples/Graphics/MaterialShader/MaterialShader.Windows/MaterialShaderApp.cs index e1e9a79eaa..89957d38c3 100644 --- a/samples/Graphics/MaterialShader/MaterialShader.Windows/MaterialShaderApp.cs +++ b/samples/Graphics/MaterialShader/MaterialShader.Windows/MaterialShaderApp.cs @@ -1,15 +1,5 @@ using Stride.Engine; -namespace MaterialShader -{ - class MaterialShaderApp - { - static void Main(string[] args) - { - using (var game = new Game()) - { - game.Run(); - } - } - } -} +using var game = new Game(); +game.Run(); + diff --git a/samples/Graphics/SpriteFonts/SpriteFonts.Windows/SpriteFontsApp.cs b/samples/Graphics/SpriteFonts/SpriteFonts.Windows/SpriteFontsApp.cs index bcfc4075ac..89957d38c3 100644 --- a/samples/Graphics/SpriteFonts/SpriteFonts.Windows/SpriteFontsApp.cs +++ b/samples/Graphics/SpriteFonts/SpriteFonts.Windows/SpriteFontsApp.cs @@ -1,15 +1,5 @@ using Stride.Engine; -namespace SpriteFonts -{ - class SpriteFontsApp - { - static void Main(string[] args) - { - using (var game = new Game()) - { - game.Run(); - } - } - } -} +using var game = new Game(); +game.Run(); + diff --git a/samples/Graphics/SpriteStudioDemo/SpriteStudioDemo.Windows/SpriteStudioDemoApp.cs b/samples/Graphics/SpriteStudioDemo/SpriteStudioDemo.Windows/SpriteStudioDemoApp.cs index 140344b401..89957d38c3 100644 --- a/samples/Graphics/SpriteStudioDemo/SpriteStudioDemo.Windows/SpriteStudioDemoApp.cs +++ b/samples/Graphics/SpriteStudioDemo/SpriteStudioDemo.Windows/SpriteStudioDemoApp.cs @@ -1,15 +1,5 @@ using Stride.Engine; -namespace SpriteStudioDemo -{ - class SpriteStudioDemoApp - { - static void Main(string[] args) - { - using (var game = new Game()) - { - game.Run(); - } - } - } -} +using var game = new Game(); +game.Run(); + diff --git a/samples/Input/GravitySensor/GravitySensor.Windows/GravitySensorApp.cs b/samples/Input/GravitySensor/GravitySensor.Windows/GravitySensorApp.cs index 3f01e0efa4..89957d38c3 100644 --- a/samples/Input/GravitySensor/GravitySensor.Windows/GravitySensorApp.cs +++ b/samples/Input/GravitySensor/GravitySensor.Windows/GravitySensorApp.cs @@ -1,15 +1,5 @@ using Stride.Engine; -namespace GravitySensor -{ - class GravitySensorApp - { - static void Main(string[] args) - { - using (var game = new Game()) - { - game.Run(); - } - } - } -} +using var game = new Game(); +game.Run(); + diff --git a/samples/Input/TouchInputs/TouchInputs.Windows/TouchInputsApp.cs b/samples/Input/TouchInputs/TouchInputs.Windows/TouchInputsApp.cs index 8cda946563..89957d38c3 100644 --- a/samples/Input/TouchInputs/TouchInputs.Windows/TouchInputsApp.cs +++ b/samples/Input/TouchInputs/TouchInputs.Windows/TouchInputsApp.cs @@ -1,15 +1,5 @@ using Stride.Engine; -namespace TouchInputs -{ - class TouchInputsApp - { - static void Main(string[] args) - { - using (var game = new Game()) - { - game.Run(); - } - } - } -} +using var game = new Game(); +game.Run(); + diff --git a/samples/Particles/ParticlesSample/ParticlesSample.Windows/ParticlesSampleApp.cs b/samples/Particles/ParticlesSample/ParticlesSample.Windows/ParticlesSampleApp.cs index c02dca0e73..89957d38c3 100644 --- a/samples/Particles/ParticlesSample/ParticlesSample.Windows/ParticlesSampleApp.cs +++ b/samples/Particles/ParticlesSample/ParticlesSample.Windows/ParticlesSampleApp.cs @@ -1,15 +1,5 @@ using Stride.Engine; -namespace ParticlesSample -{ - class ParticlesSampleApp - { - static void Main(string[] args) - { - using (var game = new Game()) - { - game.Run(); - } - } - } -} +using var game = new Game(); +game.Run(); + diff --git a/samples/Physics/PhysicsSample/PhysicsSample.Windows/PhysicsSampleApp.cs b/samples/Physics/PhysicsSample/PhysicsSample.Windows/PhysicsSampleApp.cs index edb7d6d03f..89957d38c3 100644 --- a/samples/Physics/PhysicsSample/PhysicsSample.Windows/PhysicsSampleApp.cs +++ b/samples/Physics/PhysicsSample/PhysicsSample.Windows/PhysicsSampleApp.cs @@ -1,15 +1,5 @@ using Stride.Engine; -namespace PhysicsSample -{ - class PhysicsSampleApp - { - static void Main(string[] args) - { - using (var game = new Game()) - { - game.Run(); - } - } - } -} +using var game = new Game(); +game.Run(); + diff --git a/samples/StrideSamples.userprefs b/samples/StrideSamples.userprefs deleted file mode 100644 index 45b6978e73..0000000000 --- a/samples/StrideSamples.userprefs +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/samples/Templates/FirstPersonShooter/FirstPersonShooter/FirstPersonShooter.Windows/FirstPersonShooterApp.cs b/samples/Templates/FirstPersonShooter/FirstPersonShooter/FirstPersonShooter.Windows/FirstPersonShooterApp.cs index 9c8b1ab095..89957d38c3 100644 --- a/samples/Templates/FirstPersonShooter/FirstPersonShooter/FirstPersonShooter.Windows/FirstPersonShooterApp.cs +++ b/samples/Templates/FirstPersonShooter/FirstPersonShooter/FirstPersonShooter.Windows/FirstPersonShooterApp.cs @@ -1,15 +1,5 @@ using Stride.Engine; -namespace FirstPersonShooter -{ - class FirstPersonShooterApp - { - static void Main(string[] args) - { - using (var game = new Game()) - { - game.Run(); - } - } - } -} +using var game = new Game(); +game.Run(); + diff --git a/samples/Templates/ThirdPersonPlatformer/ThirdPersonPlatformer/ThirdPersonPlatformer.Windows/ThirdPersonPlatformerApp.cs b/samples/Templates/ThirdPersonPlatformer/ThirdPersonPlatformer/ThirdPersonPlatformer.Windows/ThirdPersonPlatformerApp.cs index 9750cea2b1..89957d38c3 100644 --- a/samples/Templates/ThirdPersonPlatformer/ThirdPersonPlatformer/ThirdPersonPlatformer.Windows/ThirdPersonPlatformerApp.cs +++ b/samples/Templates/ThirdPersonPlatformer/ThirdPersonPlatformer/ThirdPersonPlatformer.Windows/ThirdPersonPlatformerApp.cs @@ -1,15 +1,5 @@ using Stride.Engine; -namespace ThirdPersonPlatformer -{ - class ThirdPersonPlatformerApp - { - static void Main(string[] args) - { - using (var game = new Game()) - { - game.Run(); - } - } - } -} +using var game = new Game(); +game.Run(); + diff --git a/samples/Templates/TopDownRPG/TopDownRPG/TopDownRPG.Windows/TopDownRPGApp.cs b/samples/Templates/TopDownRPG/TopDownRPG/TopDownRPG.Windows/TopDownRPGApp.cs index 91ecf293ef..89957d38c3 100644 --- a/samples/Templates/TopDownRPG/TopDownRPG/TopDownRPG.Windows/TopDownRPGApp.cs +++ b/samples/Templates/TopDownRPG/TopDownRPG/TopDownRPG.Windows/TopDownRPGApp.cs @@ -1,15 +1,5 @@ using Stride.Engine; -namespace TopDownRPG -{ - class TopDownRPGApp - { - static void Main(string[] args) - { - using (var game = new Game()) - { - game.Run(); - } - } - } -} +using var game = new Game(); +game.Run(); + diff --git a/samples/Templates/VRSandbox/VRSandbox/VRSandbox.Windows/VRSandboxApp.cs b/samples/Templates/VRSandbox/VRSandbox/VRSandbox.Windows/VRSandboxApp.cs index 6196822e2b..89957d38c3 100644 --- a/samples/Templates/VRSandbox/VRSandbox/VRSandbox.Windows/VRSandboxApp.cs +++ b/samples/Templates/VRSandbox/VRSandbox/VRSandbox.Windows/VRSandboxApp.cs @@ -1,15 +1,5 @@ using Stride.Engine; -namespace VRSandbox -{ - class VRSandboxApp - { - static void Main(string[] args) - { - using (var game = new VRGame()) - { - game.Run(); - } - } - } -} +using var game = new Game(); +game.Run(); + diff --git a/samples/Tutorials/CSharpBeginner/CSharpBeginner/CSharpBeginner.Windows/CSharpBeginnerApp.cs b/samples/Tutorials/CSharpBeginner/CSharpBeginner/CSharpBeginner.Windows/CSharpBeginnerApp.cs index c0fdd4620d..89957d38c3 100644 --- a/samples/Tutorials/CSharpBeginner/CSharpBeginner/CSharpBeginner.Windows/CSharpBeginnerApp.cs +++ b/samples/Tutorials/CSharpBeginner/CSharpBeginner/CSharpBeginner.Windows/CSharpBeginnerApp.cs @@ -1,13 +1,5 @@ -namespace CSharpBeginner -{ - class CSharpBeginnerApp - { - static void Main(string[] args) - { - using (var game = new Stride.Engine.Game()) - { - game.Run(); - } - } - } -} +using Stride.Engine; + +using var game = new Game(); +game.Run(); + diff --git a/samples/Tutorials/CSharpIntermediate/CSharpIntermediate/CSharpIntermediate.Windows/CSharpIntermediateApp.cs b/samples/Tutorials/CSharpIntermediate/CSharpIntermediate/CSharpIntermediate.Windows/CSharpIntermediateApp.cs index 326297cc7a..89957d38c3 100644 --- a/samples/Tutorials/CSharpIntermediate/CSharpIntermediate/CSharpIntermediate.Windows/CSharpIntermediateApp.cs +++ b/samples/Tutorials/CSharpIntermediate/CSharpIntermediate/CSharpIntermediate.Windows/CSharpIntermediateApp.cs @@ -1,13 +1,5 @@ -namespace CSharpIntermediate -{ - class CSharpIntermediateApp - { - static void Main(string[] args) - { - using (var game = new Stride.Engine.Game()) - { - game.Run(); - } - } - } -} +using Stride.Engine; + +using var game = new Game(); +game.Run(); + diff --git a/samples/UI/GameMenu/GameMenu.Windows/GameMenuApp.cs b/samples/UI/GameMenu/GameMenu.Windows/GameMenuApp.cs index bb1c0bdef6..89957d38c3 100644 --- a/samples/UI/GameMenu/GameMenu.Windows/GameMenuApp.cs +++ b/samples/UI/GameMenu/GameMenu.Windows/GameMenuApp.cs @@ -1,15 +1,5 @@ using Stride.Engine; -namespace GameMenu -{ - class GameMenuApp - { - static void Main(string[] args) - { - using (var game = new Game()) - { - game.Run(); - } - } - } -} +using var game = new Game(); +game.Run(); + diff --git a/samples/UI/UIElementLink/UIElementLink.Windows/UIElementLinkApp.cs b/samples/UI/UIElementLink/UIElementLink.Windows/UIElementLinkApp.cs index b96b5b3335..89957d38c3 100644 --- a/samples/UI/UIElementLink/UIElementLink.Windows/UIElementLinkApp.cs +++ b/samples/UI/UIElementLink/UIElementLink.Windows/UIElementLinkApp.cs @@ -1,15 +1,5 @@ using Stride.Engine; -namespace UIElementLink -{ - class UIElementLinkApp - { - static void Main(string[] args) - { - using (var game = new Game()) - { - game.Run(); - } - } - } -} +using var game = new Game(); +game.Run(); + diff --git a/samples/UI/UIParticles/UIParticles.Windows/UIParticlesApp.cs b/samples/UI/UIParticles/UIParticles.Windows/UIParticlesApp.cs index 9c109863cb..89957d38c3 100644 --- a/samples/UI/UIParticles/UIParticles.Windows/UIParticlesApp.cs +++ b/samples/UI/UIParticles/UIParticles.Windows/UIParticlesApp.cs @@ -1,15 +1,5 @@ using Stride.Engine; -namespace UIParticles -{ - class UIParticlesApp - { - static void Main(string[] args) - { - using (var game = new Game()) - { - game.Run(); - } - } - } -} +using var game = new Game(); +game.Run(); + diff --git a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.Linux/$PackageGameNameShort$App.cs.t4 b/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.Linux/$PackageGameNameShort$App.cs.t4 index a79988ec3f..ecca99dbeb 100644 --- a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.Linux/$PackageGameNameShort$App.cs.t4 +++ b/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.Linux/$PackageGameNameShort$App.cs.t4 @@ -1,16 +1,6 @@ <#@ template inherits="ProjectTemplateTransformation" language="C#" #> using Stride.Engine; -namespace <#= Properties.Namespace #> -{ - class <#= Properties.PackageGameNameShort #>App - { - static void Main(string[] args) - { - using (var game = new Game()) - { - game.Run(); - } - } - } -} +using var game = new Game(); +game.Run(); + diff --git a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.Windows/$PackageGameNameShort$App.cs.t4 b/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.Windows/$PackageGameNameShort$App.cs.t4 index a79988ec3f..ecca99dbeb 100644 --- a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.Windows/$PackageGameNameShort$App.cs.t4 +++ b/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.Windows/$PackageGameNameShort$App.cs.t4 @@ -1,16 +1,6 @@ <#@ template inherits="ProjectTemplateTransformation" language="C#" #> using Stride.Engine; -namespace <#= Properties.Namespace #> -{ - class <#= Properties.PackageGameNameShort #>App - { - static void Main(string[] args) - { - using (var game = new Game()) - { - game.Run(); - } - } - } -} +using var game = new Game(); +game.Run(); + diff --git a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.macOS/$PackageGameNameShort$App.cs.t4 b/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.macOS/$PackageGameNameShort$App.cs.t4 index a79988ec3f..ecca99dbeb 100644 --- a/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.macOS/$PackageGameNameShort$App.cs.t4 +++ b/sources/editor/Stride.Assets.Presentation/Templates/Core/ProjectExecutable.macOS/$PackageGameNameShort$App.cs.t4 @@ -1,16 +1,6 @@ <#@ template inherits="ProjectTemplateTransformation" language="C#" #> using Stride.Engine; -namespace <#= Properties.Namespace #> -{ - class <#= Properties.PackageGameNameShort #>App - { - static void Main(string[] args) - { - using (var game = new Game()) - { - game.Run(); - } - } - } -} +using var game = new Game(); +game.Run(); + diff --git a/sources/engine/Stride.Input.Tests/AdvancedInputTest.cs b/sources/engine/Stride.Input.Tests/AdvancedInputTest.cs index 4cb939bf2b..5917c8ae8a 100644 --- a/sources/engine/Stride.Input.Tests/AdvancedInputTest.cs +++ b/sources/engine/Stride.Input.Tests/AdvancedInputTest.cs @@ -327,8 +327,8 @@ public void RunAdvancedInputTest() internal static void Main(string[] args) { - using (var game = new AdvancedInputTest()) - game.Run(); + using var game = new AdvancedInputTest(); + game.Run(); } } } diff --git a/sources/engine/Stride.Input.Tests/TestInputEvents.cs b/sources/engine/Stride.Input.Tests/TestInputEvents.cs index bae5cd2de8..eb1142ec6d 100644 --- a/sources/engine/Stride.Input.Tests/TestInputEvents.cs +++ b/sources/engine/Stride.Input.Tests/TestInputEvents.cs @@ -123,8 +123,8 @@ public void RunTestInputEvents() internal static void Main(string[] args) { - using (var game = new TestInputEvents()) - game.Run(); + using var game = new TestInputEvents(); + game.Run(); } private struct EventLog