Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Reformat startup WIP #2574

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public override void Clear()
}
}

private async Task HighlightMaterial(Game game, Material material, float duration)
private async Task HighlightMaterial(DefaultGame game, Material material, float duration)
{
// TODO: this could be factorized between the different highlighters
if (material == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public override void Clear()
}
}

private async Task HighlightMesh(Game game, Mesh mesh, float duration)
private async Task HighlightMesh(DefaultGame game, Mesh mesh, float duration)
{
// TODO: this could be factorized between the different highlighters
if (mesh == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Stride.Assets.Presentation.AssetEditors.GameEditor.Game
/// </summary>
public class EditorGameDebugService : EditorGameServiceBase, IEditorGameDebugViewModelService
{
private Engine.Game game;
private Engine.DefaultGame game;

/// <summary>
/// Gets the stats of the scene editor asset manager.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,8 @@ private void SceneGameRunThread()

// Notify game start
gameStartedTaskSource.SetResult(true);
Game.Run(context);
//Game.Run(context);
throw new NotImplementedException("Game.Run(context) is not implemented");
Game.Dispose();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,12 @@ public override void Update()
if (Input.HasDownMouseButtons)
{
Input.LockMousePosition();
Game.IsMouseVisible = false;
//Game.IsMouseVisible = false;
}
else
{
Input.UnlockMousePosition();
Game.IsMouseVisible = true;
//Game.IsMouseVisible = true;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace Stride.Editor.EditorGame.ViewModels
{
/// <summary>
/// Base interface for services accessible from a view model class, that allows to interact with a instance of a <see cref="Stride.Engine.Game"/>.
/// Base interface for services accessible from a view model class, that allows to interact with a instance of a <see cref="Stride.Engine.DefaultGame"/>.
/// </summary>
public interface IEditorGameViewModelService
{
Expand Down
4 changes: 2 additions & 2 deletions sources/editor/Stride.Editor/Engine/EmbeddedGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Stride.Editor.Engine
/// <summary>
/// Represents a Game that is embedded in a external window.
/// </summary>
public class EmbeddedGame : Game
public class EmbeddedGame : DefaultGame
{
/// <summary>
/// All created embedded games (preview, scene, etc...) will have <see cref="DeviceCreationFlags.Debug"/> set.
Expand All @@ -34,7 +34,7 @@ protected override void Initialize()
base.Initialize();

Window.IsBorderLess = true;
Window.IsMouseVisible = true;
IsMouseVisible = true;
}

/// <inheritdoc />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ private void StrideUIThread()
if (!DisablePreview)
{
PreviewGame.GraphicsDeviceManager.DeviceCreated += GraphicsDeviceManagerDeviceCreated;
PreviewGame.Run(context);
//PreviewGame.Run(context);
throw new NotImplementedException("Game.Run(context) is not implemented");
PreviewGame.Dispose();
}
}
Expand Down
2 changes: 1 addition & 1 deletion sources/editor/Stride.Editor/Preview/PreviewGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
namespace Stride.Editor.Preview
{
/// <summary>
/// A <see cref="Game"/> instance specialized to render previews and create thumbnails
/// A <see cref="DefaultGame"/> instance specialized to render previews and create thumbnails
/// </summary>
public class PreviewGame : EditorGame.Game.EditorServiceGame
{
Expand Down
2 changes: 1 addition & 1 deletion sources/engine/Stride.Assets.Tests/TexturePackerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static TexturePackerTests()

public TexturePackerTests()
{
Game.InitializeAssetDatabase();
DefaultGame.InitializeAssetDatabase();
}

[Fact]
Expand Down
4 changes: 2 additions & 2 deletions sources/engine/Stride.Assets.Tests2/AutoAlphaTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class AutoAlphaTests : GameTestBase
{ Tuple.Create(PlatformType.iOS, AlphaFormat.Interpolated), PixelFormat.ETC2_RGBA },
};

private static void CheckTextureFormat(Game game, string textureUrl, AlphaFormat expectedFormat)
private static void CheckTextureFormat(DefaultGame game, string textureUrl, AlphaFormat expectedFormat)
{
var expectedPixelFormat = PlaformAndAlphaToPixelFormats[Tuple.Create(Platform.Type, expectedFormat)];
var texture = game.Content.Load<Texture>(textureUrl);
Expand Down Expand Up @@ -106,7 +106,7 @@ public void TextureAutoAlphaResultInterpolatedTests()
);
}

private static void CheckSpriteTransparencies(Game game, string spriteSheetName, AlphaFormat alphaFormat)
private static void CheckSpriteTransparencies(DefaultGame game, string spriteSheetName, AlphaFormat alphaFormat)
{
var expectedPixelFormat = PlaformAndAlphaToPixelFormats[Tuple.Create(Platform.Type, alphaFormat)];
var spriteSheet = game.Content.Load<SpriteSheet>(spriteSheetName);
Expand Down
2 changes: 1 addition & 1 deletion sources/engine/Stride.Assets/GameSettingsAsset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public partial class GameSettingsAsset : Asset
/// </summary>
public const string FileExtension = ".sdgamesettings";

public const string GameSettingsLocation = GameSettings.AssetUrl;
public static readonly string GameSettingsLocation = GameSettings.AssetUrl;

public const string DefaultSceneLocation = "MainScene";

Expand Down
1 change: 1 addition & 0 deletions sources/engine/Stride.Assets/GameSettingsAssetCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ protected override Task<ResultStatus> DoCommandOverride(ICommandContext commandC
SetPlatformOrientation(solutionProject, Parameters.GetOrDefault<RenderingSettings>().DisplayOrientation);

var assetManager = new ContentManager(MicrothreadLocalDatabases.ProviderService);
GameSettings.AssetUrl = Url;
assetManager.Save(Url, result);

return Task.FromResult(ResultStatus.Successful);
Expand Down
10 changes: 5 additions & 5 deletions sources/engine/Stride.Audio.Tests/Engine/GameClassForTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ protected override async Task LoadContent()
ContentLoaded = true;
}

public event Action<Game> LoadingContent;
public event Action<Game> BeforeUpdating;
public event Action<Game> AfterUpdating;
public event Action<Game> BeforeDrawing;
public event Action<Game> AfterDrawing;
public event Action<DefaultGame> LoadingContent;
public event Action<DefaultGame> BeforeUpdating;
public event Action<DefaultGame> AfterUpdating;
public event Action<DefaultGame> BeforeDrawing;
public event Action<DefaultGame> AfterDrawing;
}
}
4 changes: 2 additions & 2 deletions sources/engine/Stride.Audio.Tests/Engine/TestAssetLoading.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public void TestSoundEffectLoading()

private static SoundInstance testInstance;

private static void TestSoundEffectLoadingImpl(Game game)
private static void TestSoundEffectLoadingImpl(DefaultGame game)
{
var sound = game.Content.Load<Sound>("EffectBip");
Assert.NotNull(sound);
Expand All @@ -40,7 +40,7 @@ public void TestSoundMusicLoading()
TestUtilities.ExecuteScriptInUpdateLoop(TestSoundMusicLoadingImpl, TestUtilities.ExitGameAfterSleep(2000));
}

private static void TestSoundMusicLoadingImpl(Game game)
private static void TestSoundMusicLoadingImpl(DefaultGame game)
{
var sound = game.Content.Load<Sound>("EffectBip");
Assert.NotNull(sound);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private void BuildEntityHierarchy()
/// Load some default random <see cref="SoundEffect"/>, attach them to the emitter components, and query their controllers.
/// </summary>
/// <param name="game"></param>
private void AddSoundEffectToEmitterComponents(Game game)
private void AddSoundEffectToEmitterComponents(DefaultGame game)
{
sounds = new List<Sound>
{
Expand All @@ -77,7 +77,7 @@ private void AddSoundEffectToEmitterComponents(Game game)
/// Add the root entity to the entity system
/// </summary>
/// <param name="game"></param>
private void AddRootEntityToEntitySystem(Game game)
private void AddRootEntityToEntitySystem(DefaultGame game)
{
throw new NotImplementedException("TODO: UPDATE TO USE Scene and Graphics Composer"); // game.Entities.Add(rootEntity);
}
Expand All @@ -86,7 +86,7 @@ private void AddRootEntityToEntitySystem(Game game)
/// Add all the <see cref="AudioListenerComponent"/> to the <see cref="AudioSystem"/>.
/// </summary>
/// <param name="game"></param>
private void AddListenersToAudioSystem(Game game)
private void AddListenersToAudioSystem(DefaultGame game)
{
foreach (var t in listComps)
game.Audio.AddListener(t);
Expand Down Expand Up @@ -159,7 +159,7 @@ public void TestAddRemoveListeners()
TestUtilities.CreateAndRunGame(TestAddRemoveListenersHelper, TestUtilities.ExitGame);
}

private void TestAddRemoveListenersHelper(Game game)
private void TestAddRemoveListenersHelper(DefaultGame game)
{
BuildEntityHierarchy();
CreateAndAddListenerComponentToEntities();
Expand Down Expand Up @@ -209,7 +209,7 @@ public void TestAddRemoveEntityWithEmitter()
TestUtilities.CreateAndRunGame(TestAddRemoveEntityWithEmitterHelper, TestUtilities.ExitGame);
}

private void TestAddRemoveEntityWithEmitterHelper(Game game)
private void TestAddRemoveEntityWithEmitterHelper(DefaultGame game)
{
BuildEntityHierarchy();
CreateAndAddListenerComponentToEntities();
Expand Down Expand Up @@ -251,7 +251,7 @@ public void TestAddRemoveSoundEffect()
}


private void TestAddRemoveSoundEffectHelper(Game game)
private void TestAddRemoveSoundEffectHelper(DefaultGame game)
{
BuildEntityHierarchy();
CreateAndAddListenerComponentToEntities();
Expand Down Expand Up @@ -303,7 +303,7 @@ public void TestEmitterUpdateValues()
/// Setup configuration for the test.
/// </summary>
/// <param name="game"></param>
private void TestEmitterUpdateValuesSetup(Game game)
private void TestEmitterUpdateValuesSetup(DefaultGame game)
{
BuildEntityHierarchy();
CreateAndAddListenerComponentToEntities();
Expand All @@ -319,7 +319,7 @@ private void TestEmitterUpdateValuesSetup(Game game)
/// <param name="game"></param>
/// <param name="loopCount"></param>
/// <param name="loopCountSum"></param>
private void EntityPositionAndEmitterbfrUpdate(Game game, int loopCount, int loopCountSum)
private void EntityPositionAndEmitterbfrUpdate(DefaultGame game, int loopCount, int loopCountSum)
{
rootSubEntity1.Transform.Position += new Vector3(loopCount, 2 * loopCount, 3 * loopCount);
rootSubEntity2.Transform.Position += 2 * new Vector3(loopCount, 2 * loopCount, 3 * loopCount);
Expand Down Expand Up @@ -385,7 +385,7 @@ private void EntityPositionAndEmitterbfrUpdate(Game game, int loopCount, int loo
// private bool soundController0WentToStopState;
// private bool soundController2WentToStopState;

private void TestEmitterUpdateValuesAtfUpdate(Game game, int loopCount, int loopCountSum)
private void TestEmitterUpdateValuesAtfUpdate(DefaultGame game, int loopCount, int loopCountSum)
{
//throw new NotImplementedException("TODO: UPDATE TO USE Scene and Graphics Composer");
//var matchingEntities = game.Entities.Processors.OfType<AudioEmitterProcessor>().First().MatchingEntitiesForDebug;
Expand Down Expand Up @@ -458,7 +458,7 @@ public void TestMultiListener()
TestUtilities.ExecuteScriptInDrawLoop(TestEmitterUpdateValuesSetup, TestMulteListenerUpdate);
}

private void TestMulteListenerUpdate(Game game, int loopCount, int loopCountSum)
private void TestMulteListenerUpdate(DefaultGame game, int loopCount, int loopCountSum)
{
throw new NotImplementedException("TODO: UPDATE TO USE Scene and Graphics Composer");
//var matchingEntities = game.Entities.Processors.OfType<AudioEmitterProcessor>().First().MatchingEntitiesForDebug;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void TestAddAudioSysThenEntitySys()
TestUtilities.ExecuteScriptInUpdateLoop(TestAddAudioSysThenEntitySysSetup, EntityPositionUpdate, TestAddAudioSysThenEntitySysLoopImpl);
}

private void TestAddAudioSysThenEntitySysSetup(Game game)
private void TestAddAudioSysThenEntitySysSetup(DefaultGame game)
{
var audio = game.Audio;

Expand All @@ -77,7 +77,7 @@ private void TestAddAudioSysThenEntitySysSetup(Game game)
listComp2Entity.Transform.RotationEulerXYZ = new Vector3(MathF.PI/2,0,0);
}

private void EntityPositionUpdate(Game game, int loopCount, int loopCountSum)
private void EntityPositionUpdate(DefaultGame game, int loopCount, int loopCountSum)
{
rootSubEntity1.Transform.Position += new Vector3(loopCount, 2 * loopCount, 3 * loopCount);
rootSubEntity2.Transform.Position += new Vector3(loopCount, 2 * loopCount, 3 * loopCount);
Expand All @@ -86,7 +86,7 @@ private void EntityPositionUpdate(Game game, int loopCount, int loopCountSum)
listComp2Entity.Transform.Position -= new Vector3(loopCount, 2 * loopCount, 3 * loopCount);
}

private void TestAddAudioSysThenEntitySysLoopImpl(Game game, int loopCount, int loopCountSum)
private void TestAddAudioSysThenEntitySysLoopImpl(DefaultGame game, int loopCount, int loopCountSum)
{
Internal.Refactor.ThrowNotImplementedException("TODO: UPDATE TO USE Scene and Graphics Composer");
//var listenerProcessor = game.Entities.Processors.OfType<AudioListenerProcessor>().First();
Expand Down Expand Up @@ -148,7 +148,7 @@ public void TestAddEntitySysThenAudioSys()
TestUtilities.ExecuteScriptInUpdateLoop(TestAddEntitySysThenAudioSysSetup, EntityPositionUpdate, TestAddEntitySysThenAudioSysLoopImpl);
}

private void TestAddEntitySysThenAudioSysSetup(Game game)
private void TestAddEntitySysThenAudioSysSetup(DefaultGame game)
{
BuildEntityHierarchy();
CreateAndComponentToEntities();
Expand All @@ -159,7 +159,7 @@ private void TestAddEntitySysThenAudioSysSetup(Game game)
// game.Entities.Add(rootEntity);
}

private void TestAddEntitySysThenAudioSysLoopImpl(Game game, int loopCount, int loopCountSum)
private void TestAddEntitySysThenAudioSysLoopImpl(DefaultGame game, int loopCount, int loopCountSum)
{
var audio = game.Audio;
Internal.Refactor.ThrowNotImplementedException("TODO: UPDATE TO USE Scene and Graphics Composer");
Expand Down Expand Up @@ -250,7 +250,7 @@ public void TestRemoveListenerFromAudioSystem()
TestUtilities.ExecuteScriptInUpdateLoop(AddListeners, EntityPositionUpdate, TestRemoveListenerFromAudioSystemLoopImpl);
}

private void AddListeners(Game game)
private void AddListeners(DefaultGame game)
{
var audio = game.Audio;

Expand All @@ -266,7 +266,7 @@ private void AddListeners(Game game)
//game.Entities.Add(rootEntity);
}

private void TestRemoveListenerFromAudioSystemLoopImpl(Game game, int loopCount, int loopCountSum)
private void TestRemoveListenerFromAudioSystemLoopImpl(DefaultGame game, int loopCount, int loopCountSum)
{
var audio = game.Audio;
Internal.Refactor.ThrowNotImplementedException("TODO: UPDATE TO USE Scene and Graphics Composer");
Expand Down Expand Up @@ -329,7 +329,7 @@ public void TestRemoveListenerFromEntitySystem()
TestUtilities.ExecuteScriptInUpdateLoop(AddListeners, EntityPositionUpdate, TestRemoveListenerFromEntitySystemLoopImpl);
}

private void TestRemoveListenerFromEntitySystemLoopImpl(Game game, int loopCount, int loopCountSum)
private void TestRemoveListenerFromEntitySystemLoopImpl(DefaultGame game, int loopCount, int loopCountSum)
{
var audio = game.Audio;
Internal.Refactor.ThrowNotImplementedException("TODO: UPDATE TO USE Scene and Graphics Composer");
Expand Down Expand Up @@ -375,7 +375,7 @@ public void TestEmitterUpdateValues()
/// Setup configuration for the test.
/// </summary>
/// <param name="game"></param>
private void TestListenerUpdateValuesSetup(Game game)
private void TestListenerUpdateValuesSetup(DefaultGame game)
{
BuildEntityHierarchy();
CreateAndComponentToEntities();
Expand All @@ -391,7 +391,7 @@ private void TestListenerUpdateValuesSetup(Game game)
/// <param name="game">the instance of the game</param>
/// <param name="loopCount">the current loop count</param>
/// <param name="loopCountSum">the current loop count sum</param>
private void UpdateEntityPositionBfrUpdate(Game game, int loopCount, int loopCountSum)
private void UpdateEntityPositionBfrUpdate(DefaultGame game, int loopCount, int loopCountSum)
{
rootSubEntity1.Transform.Position += new Vector3(loopCount, 2 * loopCount, 3 * loopCount);
rootSubEntity2.Transform.Position += 2 * new Vector3(loopCount, 2 * loopCount, 3 * loopCount);
Expand All @@ -406,7 +406,7 @@ private void UpdateEntityPositionBfrUpdate(Game game, int loopCount, int loopCou
}
}

private void UpdateListenerTestValues(Game game, int loopCount, int loopCountSum)
private void UpdateListenerTestValues(DefaultGame game, int loopCount, int loopCountSum)
{
Internal.Refactor.ThrowNotImplementedException("TODO: UPDATE TO USE Scene and Graphics Composer");
//var matchingEntities = game.Entities.Processors.OfType<AudioListenerProcessor>().First().MatchingEntitiesForDebug;
Expand Down
Loading