Skip to content

Commit

Permalink
Ready
Browse files Browse the repository at this point in the history
  • Loading branch information
Software Antics committed Apr 18, 2024
1 parent 82b5312 commit 654152a
Show file tree
Hide file tree
Showing 13 changed files with 61 additions and 90 deletions.
5 changes: 4 additions & 1 deletion FinalEngine.ECS/EntitySystemBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ internal void RemoveAllEntities()
this.entities.Clear();
}

protected abstract bool IsMatch([NotNull] IReadOnlyEntity entity);
protected virtual bool IsMatch([NotNull] IReadOnlyEntity entity)
{
return false;
}

protected virtual void OnEntityAdded(Entity entity)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// <copyright file="EditorUpdateEntitySystem.cs" company="Software Antics">
// Copyright (c) Software Antics. All rights reserved.
// </copyright>

namespace FinalEngine.Editor.Common.Driver.Systems;

using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using FinalEngine.ECS;
using FinalEngine.ECS.Attributes;
using FinalEngine.Input.Keyboards;
using FinalEngine.Input.Mouses;

[EntitySystemProcess(ExecutionType = GameLoopType.Update)]
public sealed class EditorUpdateEntitySystem : EntitySystemBase
{
private readonly IKeyboard keyboard;

private readonly IMouse mouse;

public EditorUpdateEntitySystem(IKeyboard keyboard, IMouse mouse)
{
this.keyboard = keyboard ?? throw new ArgumentNullException(nameof(keyboard));
this.mouse = mouse ?? throw new ArgumentNullException(nameof(mouse));
}

protected override void Process([NotNull] IEnumerable<Entity> entities)
{
this.keyboard.Update();
this.mouse.Update();
}
}
2 changes: 2 additions & 0 deletions FinalEngine.Editor.Desktop/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ namespace FinalEngine.Editor.Desktop;
using FinalEngine.Editor.Common.Services.Application;
using FinalEngine.Editor.Common.Services.Environment;
using FinalEngine.Editor.Common.Services.Scenes;
using FinalEngine.Editor.Desktop.Extensions;
using FinalEngine.Editor.Desktop.Services.Actions;
using FinalEngine.Editor.Desktop.Services.Layout;
using FinalEngine.Editor.Desktop.Views;
Expand Down Expand Up @@ -90,6 +91,7 @@ private static void ConfigureServices(HostBuilderContext context, IServiceCollec
});

services.AddRuntime();
services.AddEditorPlatform();

services.AddTransient<IScene, Scene>();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// <copyright file="ServiceCollectionExtensions.cs" company="Software Antics">
// Copyright (c) Software Antics. All rights reserved.
// </copyright>

namespace FinalEngine.Editor.Desktop.Extensions;

using System;
using Microsoft.Extensions.DependencyInjection;

public static class ServiceCollectionExtensions
{
public static IServiceCollection AddEditorPlatform(this IServiceCollection services)
{
ArgumentNullException.ThrowIfNull(services, nameof(services));
return services;
}
}
4 changes: 4 additions & 0 deletions FinalEngine.Editor.Desktop/FinalEngine.Editor.Desktop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,8 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

<ItemGroup>
<Folder Include="Framework\Input\" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static void AddDesktopPlatform(this IServiceCollection services)
Profile = ContextProfile.Core,
AutoLoadBindings = false,
StartVisible = true,
StartVisible = false,
WindowBorder = WindowBorder.Fixed,
WindowState = WindowState.Normal,
Expand Down
1 change: 0 additions & 1 deletion FinalEngine.Rendering/Batching/SpriteDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ internal sealed class SpriteDrawer : ISpriteDrawer, IDisposable

private IVertexBuffer? vertexBuffer;

//// TODO: Projection width and height should be customizable and not set in constructor for DI.
public SpriteDrawer(IRenderDevice renderDevice, ISpriteBatcher batcher, ITextureBinder binder, int projectionWidth, int projectionHeight)
{
this.renderDevice = renderDevice ?? throw new ArgumentNullException(nameof(renderDevice));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public static IServiceCollection AddRendering(this IServiceCollection services)
services.AddSingleton<IRenderCoordinator, RenderCoordinator>();
services.AddSingleton<IRenderingEngine, RenderingEngine>();

// TODO: Model should be IModel? Think about a better solution to the whole thing tbh.
services.AddResourceLoader<ITexture2D, Texture2DResourceLoader>();
services.AddResourceLoader<IShader, ShaderResourceLoader>();
services.AddResourceLoader<IShaderProgram, ShaderProgramResourceLoader>();
Expand Down
1 change: 0 additions & 1 deletion FinalEngine.Rendering/Renderers/SkyboxRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ internal sealed class SkyboxRenderer : ISkyboxRenderer, IDisposable

private ITextureCube? texture;

//// TODO: Fix this for DI stuff.
public SkyboxRenderer(IRenderDevice renderDevice)
{
this.renderDevice = renderDevice ?? throw new ArgumentNullException(nameof(renderDevice));
Expand Down
4 changes: 0 additions & 4 deletions FinalEngine.Runtime/Extensions/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ namespace FinalEngine.Runtime.Extensions;
using System.IO.Abstractions;
using FinalEngine.Audio.OpenAL.Extensions;
using FinalEngine.Input.Extensions;
using FinalEngine.Platform.Desktop.Extensions;
using FinalEngine.Rendering.Extensions;
using FinalEngine.Rendering.OpenGL.Extensions;
using FinalEngine.Resources.Extensionss;
using FinalEngine.Runtime.Rendering;
using Microsoft.Extensions.DependencyInjection;

public static class ServiceCollectionExtensions
Expand All @@ -22,10 +20,8 @@ public static IServiceCollection AddRuntime(this IServiceCollection services)
ArgumentNullException.ThrowIfNull(services, nameof(services));

services.AddSingleton<IFileSystem, FileSystem>();
services.AddSingleton<IDisplayManager, DisplayManager>();
services.AddSingleton<IRuntimeContext, RuntimeContext>();

services.AddDesktopPlatform();
services.AddOpenGL();
services.AddOpenAL();
services.AddInput();
Expand Down
51 changes: 0 additions & 51 deletions FinalEngine.Runtime/Rendering/DisplayManager.cs

This file was deleted.

16 changes: 0 additions & 16 deletions FinalEngine.Runtime/Rendering/DisplayResolution.cs

This file was deleted.

14 changes: 0 additions & 14 deletions FinalEngine.Runtime/Rendering/IDisplayManager.cs

This file was deleted.

0 comments on commit 654152a

Please sign in to comment.