Change To OpenGL

This commit is contained in:
Mueller Wayan
2025-08-15 10:44:29 +02:00
parent 1862530728
commit a36789dd7e
101 changed files with 2981 additions and 1027 deletions
@@ -0,0 +1,102 @@
using SFML.Graphics;
using SFML.System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Firebird2D.Interfaces.Actors
{
public enum ResizeMode
{
Resize,
DontResize,
CutImage
}
public enum AnchorPoint
{
topLeft,
topMiddle,
topRight,
bottomLeft,
bottomMiddle,
bottomRight,
LeftMiddle,
RightMiddle,
Center
}
public enum AnchorMode
{
stayInValue,
stayInRatio,
stayInPlace
}
public struct Anchors
{
public bool top;
public bool left;
public bool right;
public bool bottom;
AnchorPoint anchorPoint;
AnchorMode anchorMode;
public Anchors() : this(true, true, false, false, AnchorPoint.Center, AnchorMode.stayInValue) { }
public Anchors(bool top, bool left, bool right, bool bottom) : this(top, left, right, bottom, AnchorPoint.Center, AnchorMode.stayInValue) { }
public Anchors(bool top, bool left, bool right, bool bottom, AnchorPoint anchorPoint) : this(top, left, right, bottom, anchorPoint, AnchorMode.stayInValue) { }
public Anchors(bool top, bool left, bool right, bool bottom, AnchorPoint anchorPoint, AnchorMode anchorMode)
{
this.top = top;
this.left = left;
this.right = right;
this.bottom = bottom;
this.anchorPoint = anchorPoint;
this.anchorMode = anchorMode;
}
}
public interface IRenderable
{
public void Render(RenderWindow window);
}
public interface IUpdatable
{
void Tick(int timeDifference);
}
public interface IResizable : IRenderable
{
void Resize(int width, int height);
void OnWindowResize(int width, int height);
}
public interface I_BaseActor : IRenderable, IUpdatable, IComparable
{
public string Name { get; }
public ResizeMode resizeMode { get; set; }
public Anchors Anchors { get; set; }
public Vector2f Position { get; set; }
public Vector2f Size { get; set; }
public float Rotation { get; set; }
public int Z_Index { get; set; }
}
}
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Firebird2D.Interfaces.Actors
{
public interface I_Clickable : I_BaseActor
{
public event EventHandler Click;
}
}
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Firebird2D.Interfaces.Actors
{
public interface I_HitboxActor
{
}
}
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Firebird2D.Interfaces.Actors
{
public interface I_InteractableActor : I_BaseActor
{
public bool Interact(I_PlayerActor player);
}
}
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Firebird2D.Interfaces.Actors
{
public interface I_PlayerActor : I_BaseActor
{
}
}
+14 -7
View File
@@ -1,21 +1,28 @@
using System;
using Firebird2D.Datatypes;
using Firebird2D.DataypesAndInterfaces.Datatypes;
using Firebird2D.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Firebird2D.Datatypes;
using Firebird2D.Interfaces;
namespace Firebird2D.Interfaces
{
public interface IEventBus
{
public void OnPipelineIsBuild(Action<IPipelineBase> callback, FirebirdEvent firebirdEvent);
public void OnPipelineIsBuild(Action<IPipelineBase> callback, FirebirdEventId firebirdEvent);
public IPipeline<T> GetOrBuildPipeline<T>(FirebirdEvent type, object master) where T : EventArgs;
public IPipeline<T> GetOrBuildPipeline<T>(FirebirdEventId type, object master) where T : EventArgs;
public IPipelineBase GetPipeline(FirebirdEvent type);
public IPipelineBase? GetPipeline(FirebirdEventId type);
public void DestroyPipeline(FirebirdEvent type, object master);
public void DestroyPipeline(FirebirdEventId type, object master);
public FirebirdEventId ReserveFreePipeline();
public FirebirdEventId[] ReserveFreePipelines(int numberOfPipelines);
public void CancleReservationOnPipeline(FirebirdEventId PipelineKey);
}
}
@@ -9,5 +9,7 @@ namespace Firebird2D.DataypesAndInterfaces.Interfaces
public interface IExtensionBase
{
public void Startup();
public void Run();
}
}
+4 -1
View File
@@ -12,6 +12,9 @@ namespace Firebird2D.Interfaces
{
public IEventBus EventBus { get; set; }
public IKeyMapper KeyMapper { get; set; }
public IKeyMapper? KeyMapper { get; set; }
public IExtensionBase GetExtension(string extensionName);
}
}
@@ -14,11 +14,11 @@ 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 RegisterEvent<T>(string EventName, EventHandler<T> handler, FirebirdSystemEventIds eventNumber) where T : EventArgs;
void Map(string EventName, FirebirdSystemEventIds eventNumber);
void SaveMapping(string Path);
void LoadMapping(string Path);
void InvalidatePipelineCache(FirebirdEvent fbEvent);
void InvalidatePipelineCache(FirebirdSystemEventIds fbEvent);
void HandleKeyboardInput(KeyEvent key, InputEventType type);
void HandleMouseInput(MouseButtonEvent button, InputEventType type);
void HandleJoystickButtonInput(JoystickButtonEvent joystickButton, InputEventType type);
@@ -0,0 +1,35 @@
using Firebird2D.Interfaces.Actors;
using Firebird2D.Rendering;
using SFML.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
namespace Firebird2D.SceneSystem
{
public interface I_Scene
{
public string Name { get; }
public I_PlayerActor Player { get; }
public List<I_InteractableActor> Interactable { get; }
public List<I_HitboxActor> Hitbox { get; }
public List<I_Clickable> Clickables{ get; }
public I_Scene BuildScene();
public void DestroyScene();
public void TickScene(double DeltaTime);
public void RenderScene(Matrix4x4 projection, FirebirdShader shader, double deltaTime);
public void addActor(I_BaseActor Actor);
}
}