mirror of
https://github.com/Stone-Red-Code/StoneRed.LogicSimulator.git
synced 2026-09-04 09:06:29 +02:00
Create StoneRed.LogicSimulator.Api project
This commit is contained in:
@@ -0,0 +1,12 @@
|
|||||||
|
namespace StoneRed.LogicSimulator.Api.Attributes;
|
||||||
|
|
||||||
|
[AttributeUsage(AttributeTargets.Class)]
|
||||||
|
public class LogicGateDescriptionAttribute : Attribute
|
||||||
|
{
|
||||||
|
public string Description { get; }
|
||||||
|
|
||||||
|
public LogicGateDescriptionAttribute(string description)
|
||||||
|
{
|
||||||
|
Description = description;
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
-4
@@ -1,9 +1,7 @@
|
|||||||
using System;
|
namespace StoneRed.LogicSimulator.Api.Attributes;
|
||||||
|
|
||||||
namespace StoneRed.LogicSimulator.Simulation.LogicGates.Attributes;
|
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.Class)]
|
[AttributeUsage(AttributeTargets.Class)]
|
||||||
internal class LogicGateNameAttribute : Attribute
|
public class LogicGateNameAttribute : Attribute
|
||||||
{
|
{
|
||||||
public string Name { get; }
|
public string Name { get; }
|
||||||
|
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
|
|
||||||
namespace StoneRed.LogicSimulator.Simulation.LogicGates.Interfaces;
|
namespace StoneRed.LogicSimulator.Api.Interfaces;
|
||||||
|
|
||||||
internal interface IColorable
|
internal interface IColorable
|
||||||
{
|
{
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
|
||||||
namespace StoneRed.LogicSimulator.Simulation.LogicGates.Interfaces;
|
namespace StoneRed.LogicSimulator.Api.Interfaces;
|
||||||
|
|
||||||
internal interface IDrawable
|
internal interface IDrawable
|
||||||
{
|
{
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
using MonoGame.Extended.Input;
|
using MonoGame.Extended.Input;
|
||||||
|
|
||||||
namespace StoneRed.LogicSimulator.Simulation.LogicGates.Interfaces;
|
namespace StoneRed.LogicSimulator.Api.Interfaces;
|
||||||
|
|
||||||
internal interface IInteractable
|
internal interface IInteractable
|
||||||
{
|
{
|
||||||
+2
-5
@@ -1,11 +1,8 @@
|
|||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
|
||||||
using StoneRed.LogicSimulator.Utilities;
|
using StoneRed.LogicSimulator.Api.Utilities;
|
||||||
|
|
||||||
using System;
|
namespace StoneRed.LogicSimulator.Api.Interfaces;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace StoneRed.LogicSimulator.Simulation.LogicGates.Interfaces;
|
|
||||||
#pragma warning disable S112 // General exceptions should never be thrown
|
#pragma warning disable S112 // General exceptions should never be thrown
|
||||||
|
|
||||||
internal abstract class LogicGate
|
internal abstract class LogicGate
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<InternalsVisibleTo Include="StoneRed.LogicSimulator" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="MonoGame.Extended" Version="3.8.0" />
|
||||||
|
<PackageReference Include="MonoGame.Extended.Input" Version="3.8.0" />
|
||||||
|
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.1.303" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
+1
-3
@@ -1,6 +1,4 @@
|
|||||||
using System;
|
namespace StoneRed.LogicSimulator.Api.Utilities;
|
||||||
|
|
||||||
namespace StoneRed.LogicSimulator.Utilities;
|
|
||||||
|
|
||||||
#pragma warning disable S112 // General exceptions should never be thrown
|
#pragma warning disable S112 // General exceptions should never be thrown
|
||||||
|
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
|
|
||||||
namespace StoneRed.LogicSimulator.Simulation.LogicGates;
|
namespace StoneRed.LogicSimulator.Api.Utilities;
|
||||||
|
|
||||||
internal record LogicGateWorldData
|
internal record LogicGateWorldData
|
||||||
{
|
{
|
||||||
@@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.6.33815.320
|
VisualStudioVersion = 17.6.33815.320
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StoneRed.LogicSimulator", "StoneRed.LogicSimulator\StoneRed.LogicSimulator.csproj", "{7B259CCA-2947-4DF8-8252-7CF75FE39B8E}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StoneRed.LogicSimulator", "StoneRed.LogicSimulator\StoneRed.LogicSimulator.csproj", "{7B259CCA-2947-4DF8-8252-7CF75FE39B8E}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StoneRed.LogicSimulator.Api", "StoneRed.LogicSimulator.Api\StoneRed.LogicSimulator.Api.csproj", "{CD9C3C4D-4AF1-4A31-BDED-34CB91503B4C}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@@ -15,6 +17,10 @@ Global
|
|||||||
{7B259CCA-2947-4DF8-8252-7CF75FE39B8E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{7B259CCA-2947-4DF8-8252-7CF75FE39B8E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{7B259CCA-2947-4DF8-8252-7CF75FE39B8E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{7B259CCA-2947-4DF8-8252-7CF75FE39B8E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{7B259CCA-2947-4DF8-8252-7CF75FE39B8E}.Release|Any CPU.Build.0 = Release|Any CPU
|
{7B259CCA-2947-4DF8-8252-7CF75FE39B8E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{CD9C3C4D-4AF1-4A31-BDED-34CB91503B4C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{CD9C3C4D-4AF1-4A31-BDED-34CB91503B4C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{CD9C3C4D-4AF1-4A31-BDED-34CB91503B4C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{CD9C3C4D-4AF1-4A31-BDED-34CB91503B4C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 226 KiB After Width: | Height: | Size: 623 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 264 KiB |
@@ -1,4 +1,4 @@
|
|||||||
using StoneRed.LogicSimulator.Simulation.LogicGates.Interfaces;
|
using StoneRed.LogicSimulator.Api.Interfaces;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
|
|||||||
-14
@@ -1,14 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace StoneRed.LogicSimulator.Simulation.LogicGates.Attributes;
|
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.All)]
|
|
||||||
internal class LogicGateDescriptionAttribute : Attribute
|
|
||||||
{
|
|
||||||
public string Description { get; }
|
|
||||||
|
|
||||||
public LogicGateDescriptionAttribute(string description)
|
|
||||||
{
|
|
||||||
Description = description;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
using MonoGame.Extended.Input;
|
using MonoGame.Extended.Input;
|
||||||
|
|
||||||
using StoneRed.LogicSimulator.Simulation.LogicGates.Attributes;
|
using StoneRed.LogicSimulator.Api.Attributes;
|
||||||
using StoneRed.LogicSimulator.Simulation.LogicGates.Interfaces;
|
using StoneRed.LogicSimulator.Api.Interfaces;
|
||||||
|
|
||||||
namespace StoneRed.LogicSimulator.Simulation.LogicGates;
|
namespace StoneRed.LogicSimulator.Simulation.LogicGates;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using MonoGame.Extended.Input;
|
using MonoGame.Extended.Input;
|
||||||
|
|
||||||
using StoneRed.LogicSimulator.Simulation.LogicGates.Attributes;
|
using StoneRed.LogicSimulator.Api.Attributes;
|
||||||
using StoneRed.LogicSimulator.Simulation.LogicGates.Interfaces;
|
using StoneRed.LogicSimulator.Api.Interfaces;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
|
|
||||||
using StoneRed.LogicSimulator.Simulation.LogicGates.Attributes;
|
using StoneRed.LogicSimulator.Api.Attributes;
|
||||||
using StoneRed.LogicSimulator.Simulation.LogicGates.Interfaces;
|
using StoneRed.LogicSimulator.Api.Interfaces;
|
||||||
|
|
||||||
namespace StoneRed.LogicSimulator.Simulation.LogicGates;
|
namespace StoneRed.LogicSimulator.Simulation.LogicGates;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using StoneRed.LogicSimulator.Simulation.LogicGates.Attributes;
|
using StoneRed.LogicSimulator.Api.Attributes;
|
||||||
using StoneRed.LogicSimulator.Simulation.LogicGates.Interfaces;
|
using StoneRed.LogicSimulator.Api.Interfaces;
|
||||||
|
|
||||||
namespace StoneRed.LogicSimulator.Simulation.LogicGates;
|
namespace StoneRed.LogicSimulator.Simulation.LogicGates;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using StoneRed.LogicSimulator.Simulation.LogicGates.Attributes;
|
using StoneRed.LogicSimulator.Api.Attributes;
|
||||||
using StoneRed.LogicSimulator.Simulation.LogicGates.Interfaces;
|
using StoneRed.LogicSimulator.Api.Interfaces;
|
||||||
|
|
||||||
namespace StoneRed.LogicSimulator.Simulation.LogicGates;
|
namespace StoneRed.LogicSimulator.Simulation.LogicGates;
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
using MonoGame.Extended.Input;
|
using MonoGame.Extended.Input;
|
||||||
|
|
||||||
using StoneRed.LogicSimulator.Simulation.LogicGates.Attributes;
|
using StoneRed.LogicSimulator.Api.Attributes;
|
||||||
using StoneRed.LogicSimulator.Simulation.LogicGates.Interfaces;
|
using StoneRed.LogicSimulator.Api.Interfaces;
|
||||||
|
|
||||||
namespace StoneRed.LogicSimulator.Simulation.LogicGates;
|
namespace StoneRed.LogicSimulator.Simulation.LogicGates;
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
using Microsoft.Xna.Framework;
|
#if DEBUG
|
||||||
|
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
|
||||||
using StoneRed.LogicSimulator.Simulation.LogicGates.Attributes;
|
using StoneRed.LogicSimulator.Api.Attributes;
|
||||||
using StoneRed.LogicSimulator.Simulation.LogicGates.Interfaces;
|
using StoneRed.LogicSimulator.Api.Interfaces;
|
||||||
|
|
||||||
namespace StoneRed.LogicSimulator.Simulation.LogicGates;
|
namespace StoneRed.LogicSimulator.Simulation.LogicGates;
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
|
|
||||||
[LogicGateName("Test")]
|
[LogicGateName("Test")]
|
||||||
internal class TestLogicGate : LogicGate, Interfaces.IDrawable
|
internal class TestLogicGate : LogicGate, Api.Interfaces.IDrawable
|
||||||
{
|
{
|
||||||
private readonly Color[] colors = new Color[9];
|
private readonly Color[] colors = new Color[9];
|
||||||
private Texture2D texture = null!;
|
private Texture2D texture = null!;
|
||||||
|
|||||||
@@ -33,6 +33,9 @@
|
|||||||
<PackageReference Include="MonoGame.Content.Builder.Task" Version="3.8.1.303" />
|
<PackageReference Include="MonoGame.Content.Builder.Task" Version="3.8.1.303" />
|
||||||
<PackageReference Include="Myra" Version="1.4.5" />
|
<PackageReference Include="Myra" Version="1.4.5" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\StoneRed.LogicSimulator.Api\StoneRed.LogicSimulator.Api.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Update="UserInterface\Windows\SettingsWindow.cs">
|
<Compile Update="UserInterface\Windows\SettingsWindow.cs">
|
||||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ using MonoGame.Extended.Input;
|
|||||||
|
|
||||||
using Myra.Graphics2D.UI;
|
using Myra.Graphics2D.UI;
|
||||||
|
|
||||||
|
using StoneRed.LogicSimulator.Api.Interfaces;
|
||||||
using StoneRed.LogicSimulator.Simulation;
|
using StoneRed.LogicSimulator.Simulation;
|
||||||
using StoneRed.LogicSimulator.Simulation.LogicGates.Interfaces;
|
|
||||||
using StoneRed.LogicSimulator.UserInterface.Windows;
|
using StoneRed.LogicSimulator.UserInterface.Windows;
|
||||||
using StoneRed.LogicSimulator.Utilities;
|
using StoneRed.LogicSimulator.Utilities;
|
||||||
using StoneRed.LogicSimulator.WorldSaveSystem;
|
using StoneRed.LogicSimulator.WorldSaveSystem;
|
||||||
@@ -18,7 +18,7 @@ using StoneRed.LogicSimulator.WorldSaveSystem;
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
using IColorable = StoneRed.LogicSimulator.Simulation.LogicGates.Interfaces.IColorable;
|
using IColorable = StoneRed.LogicSimulator.Api.Interfaces.IColorable;
|
||||||
|
|
||||||
namespace StoneRed.LogicSimulator.UserInterface.Screens;
|
namespace StoneRed.LogicSimulator.UserInterface.Screens;
|
||||||
|
|
||||||
@@ -119,7 +119,7 @@ internal class WorldScreen : SrlsScreen<Grid>
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Draw logic gate
|
// Draw logic gate
|
||||||
if (logicGate is Simulation.LogicGates.Interfaces.IDrawable drawable)
|
if (logicGate is Api.Interfaces.IDrawable drawable)
|
||||||
{
|
{
|
||||||
Rectangle rectangle = new Rectangle((logicGate.WorldData.Position * srls.Scale).ToPoint(), (logicGateSize * srls.Scale).ToPoint());
|
Rectangle rectangle = new Rectangle((logicGate.WorldData.Position * srls.Scale).ToPoint(), (logicGateSize * srls.Scale).ToPoint());
|
||||||
srls.SpriteBatch.Draw(drawable.Texture, rectangle, null, color, 0, Vector2.Zero, SpriteEffects.None, 0.2f);
|
srls.SpriteBatch.Draw(drawable.Texture, rectangle, null, color, 0, Vector2.Zero, SpriteEffects.None, 0.2f);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
|
||||||
using StoneRed.LogicSimulator.Simulation.LogicGates.Attributes;
|
using StoneRed.LogicSimulator.Api.Attributes;
|
||||||
using StoneRed.LogicSimulator.Simulation.LogicGates.Interfaces;
|
using StoneRed.LogicSimulator.Api.Interfaces;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -41,7 +41,7 @@ internal class LogicGatesManager
|
|||||||
|
|
||||||
public void LoadLogicGates()
|
public void LoadLogicGates()
|
||||||
{
|
{
|
||||||
IEnumerable<Type> logicGateTypes = typeof(LogicGate)
|
IEnumerable<Type> logicGateTypes = GetType()
|
||||||
.Assembly.GetTypes()
|
.Assembly.GetTypes()
|
||||||
.Where(t => t.IsSubclassOf(typeof(LogicGate)) && !t.IsAbstract);
|
.Where(t => t.IsSubclassOf(typeof(LogicGate)) && !t.IsAbstract);
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using StoneRed.LogicSimulator.Simulation.LogicGates.Interfaces;
|
using StoneRed.LogicSimulator.Api.Interfaces;
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using FluentResults;
|
using FluentResults;
|
||||||
|
|
||||||
|
using StoneRed.LogicSimulator.Api.Interfaces;
|
||||||
using StoneRed.LogicSimulator.Misc;
|
using StoneRed.LogicSimulator.Misc;
|
||||||
using StoneRed.LogicSimulator.Simulation.LogicGates.Interfaces;
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using FluentResults;
|
using FluentResults;
|
||||||
|
|
||||||
|
using StoneRed.LogicSimulator.Api.Attributes;
|
||||||
|
using StoneRed.LogicSimulator.Api.Interfaces;
|
||||||
using StoneRed.LogicSimulator.Misc;
|
using StoneRed.LogicSimulator.Misc;
|
||||||
using StoneRed.LogicSimulator.Simulation.LogicGates.Attributes;
|
|
||||||
using StoneRed.LogicSimulator.Simulation.LogicGates.Interfaces;
|
|
||||||
using StoneRed.LogicSimulator.Utilities;
|
using StoneRed.LogicSimulator.Utilities;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|||||||
Reference in New Issue
Block a user