Change To OpenGL
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
|
||||
using Firebird2D.SceneSystem;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Firebird2D.Abstracts
|
||||
{
|
||||
public abstract class SceneGroup
|
||||
{
|
||||
public string? GroupName { get; protected set; }
|
||||
|
||||
public List<I_Scene>? Scenes { get; protected set; }
|
||||
|
||||
public abstract I_Scene SceneChangeAnimation { get; protected set; }
|
||||
|
||||
public abstract void InitializeGroup();
|
||||
|
||||
public abstract I_Scene getStartingScene();
|
||||
|
||||
public I_Scene? Get_Scene(Type type)
|
||||
{
|
||||
if (type != typeof(I_Scene) || Scenes == null) return null;
|
||||
|
||||
return Scenes.FirstOrDefault(instance => instance.GetType() == type);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using Firebird2D.Datatypes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Firebird2D.DataypesAndInterfaces.Datatypes
|
||||
{
|
||||
public class FirebirdEventId : IEquatable<FirebirdEventId>
|
||||
{
|
||||
public int Value { get; set; }
|
||||
|
||||
public FirebirdEventId(int value) => Value = value;
|
||||
|
||||
public override string ToString() => $"EventId:{Value}";
|
||||
|
||||
public static explicit operator FirebirdEventId(int value) => new(value);
|
||||
|
||||
public static implicit operator int(FirebirdEventId id) => id.Value;
|
||||
|
||||
public static implicit operator FirebirdEventId(FirebirdSystemEventIds e) => new((int)e);
|
||||
|
||||
public static implicit operator FirebirdSystemEventIds(FirebirdEventId id) => (FirebirdSystemEventIds)id.Value;
|
||||
|
||||
public bool Equals(FirebirdEventId? other)
|
||||
{
|
||||
if (other == null) return false;
|
||||
return other.Value == Value;
|
||||
}
|
||||
|
||||
public override bool Equals(object? obj) => obj is FirebirdEventId other && Equals(other);
|
||||
|
||||
public override int GetHashCode() => Value;
|
||||
|
||||
public static bool operator ==(FirebirdEventId left, FirebirdEventId right) => left.Equals(right);
|
||||
public static bool operator !=(FirebirdEventId left, FirebirdEventId right) => !left.Equals(right);
|
||||
|
||||
public static FirebirdEventId operator ++(FirebirdEventId id)
|
||||
{
|
||||
id.Value++;
|
||||
return id;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+8
-1
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Firebird2D.Datatypes
|
||||
{
|
||||
public enum FirebirdEvent
|
||||
public enum FirebirdSystemEventIds
|
||||
{
|
||||
A = 0,
|
||||
//
|
||||
@@ -438,4 +438,11 @@ namespace Firebird2D.Datatypes
|
||||
MouseWheel,
|
||||
MouseMove
|
||||
}
|
||||
|
||||
public static class FirebirdSystemEventInfo
|
||||
{
|
||||
public static readonly FirebirdSystemEventIds MaxValue =
|
||||
Enum.GetValues(typeof(FirebirdSystemEventIds)).Cast<FirebirdSystemEventIds>().Max();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using Firebird2D.Rendering;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Firebird2D.DataypesAndInterfaces.EventArguments
|
||||
{
|
||||
public class FirebirdTickArgs : EventArgs
|
||||
{
|
||||
public double DeltaTime { get; private set; }
|
||||
|
||||
public FirebirdShader Shader { get; private set; }
|
||||
|
||||
public Matrix4x4 Projection { get; private set; }
|
||||
|
||||
public FirebirdTickArgs(double deltaTime, FirebirdShader shader, Matrix4x4 projection)
|
||||
{
|
||||
DeltaTime = deltaTime;
|
||||
Shader = shader;
|
||||
Projection = projection;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,4 +10,8 @@
|
||||
<PackageReference Include="SFML.Net" Version="2.6.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Firebird2D.Rendering\Firebird2D.Rendering.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user