Updated KD and ModulLoader

This commit is contained in:
Mueller Wayan
2025-05-18 18:05:23 +02:00
parent 47ddfed9bc
commit 1862530728
38 changed files with 602 additions and 360 deletions
@@ -0,0 +1,19 @@
using SFML.Window;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Firebird2D.EventPipelines.EventArguments
{
public class FirebirdJoystickButtonEventArgs : JoystickButtonEventArgs
{
public InputEventType InputEventType { get; private set; }
public FirebirdJoystickButtonEventArgs(JoystickButtonEvent e, InputEventType t) : base(e)
{
InputEventType = t;
}
}
}
@@ -0,0 +1,19 @@
using SFML.Window;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Firebird2D.EventPipelines.EventArguments
{
public class FirebirdKeyEventArgs : KeyEventArgs
{
public InputEventType InputEventType { get; private set; }
public FirebirdKeyEventArgs(KeyEvent e, InputEventType t) : base(e)
{
InputEventType = t;
}
}
}
@@ -0,0 +1,19 @@
using SFML.Window;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Firebird2D.EventPipelines.EventArguments
{
public class FirebirdMouseButtonEventArgs : MouseButtonEventArgs
{
public InputEventType InputEventType { get; private set; }
public FirebirdMouseButtonEventArgs(MouseButtonEvent e,InputEventType t) : base(e)
{
InputEventType = t;
}
}
}
@@ -4,12 +4,11 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Firebird2D.Datatypes
namespace Firebird2D.EventPipelines.EventArguments
{
public enum ModuleType
public enum InputEventType
{
Extension = 0,
EventSystem = 1,
KeyMapper = 2
Pressed = 0,
Released = 1
}
}
@@ -6,4 +6,8 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SFML.Net" Version="2.6.1" />
</ItemGroup>
</Project>
@@ -10,11 +10,11 @@ namespace Firebird2D.Interfaces
{
public interface IEventBus
{
public void OnPipelineIsBuild(Action<IPipeline> callback, FirebirdEvent firebirdEvent);
public void OnPipelineIsBuild(Action<IPipelineBase> callback, FirebirdEvent firebirdEvent);
public IPipeline GetOrBuildPipeline(FirebirdEvent type, Type argsType, object master);
public IPipeline<T> GetOrBuildPipeline<T>(FirebirdEvent type, object master) where T : EventArgs;
public IPipeline? GetPipeline(FirebirdEvent type, Type argsType);
public IPipelineBase GetPipeline(FirebirdEvent type);
public void DestroyPipeline(FirebirdEvent type, object master);
}
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Firebird2D.DataypesAndInterfaces.Interfaces
{
public interface IExtensionBase
{
public void Startup();
}
}
+4 -1
View File
@@ -1,4 +1,5 @@
using Firebird2D.Interfaces;
using Firebird2D.DataypesAndInterfaces.Interfaces;
using Firebird2D.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -10,5 +11,7 @@ namespace Firebird2D.Interfaces
public interface IGame
{
public IEventBus EventBus { get; set; }
public IKeyMapper KeyMapper { get; set; }
}
}
@@ -0,0 +1,28 @@
using Firebird2D.Datatypes;
using Firebird2D.EventPipelines.EventArguments;
using Firebird2D.Interfaces;
using SFML.Window;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
namespace Firebird2D.DataypesAndInterfaces.Interfaces
{
public interface IKeyMapper
{
void RegisterEvent<T>(string EventName, EventHandler<T> handler, FirebirdEvent eventNumber) where T : EventArgs;
void Map(string EventName, FirebirdEvent eventNumber);
void SaveMapping(string Path);
void LoadMapping(string Path);
void InvalidatePipelineCache(FirebirdEvent fbEvent);
void HandleKeyboardInput(KeyEvent key, InputEventType type);
void HandleMouseInput(MouseButtonEvent button, InputEventType type);
void HandleJoystickButtonInput(JoystickButtonEvent joystickButton, InputEventType type);
void HandleMouseMovement(MouseMoveEvent mouseMove);
public void HandleJoytickMove(JoystickMoveEvent joystickMove);
}
}
+10 -4
View File
@@ -6,10 +6,7 @@ using System.Threading.Tasks;
namespace Firebird2D.Interfaces
{
/// <summary>
/// Interface for the Firebird event Pipeline
/// </summary>
public interface IPipeline
public interface IPipelineBase
{
/// <summary>
/// Class witch owns the Pipeline and has the right to send events or delete the pipeline
@@ -30,6 +27,15 @@ namespace Firebird2D.Interfaces
/// </summary>
/// <param name="handler">Handler witch should be removed from the Pipeline</param>
void Unsubscribe(Delegate handler);
}
/// <summary>
/// Interface for the Firebird event Pipeline
/// </summary>
public interface IPipeline<T> : IPipelineBase where T : EventArgs
{
void SendEvent(object sender, T args);
}
}