Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions Mallos.Input.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29123.88
# Visual Studio Version 17
VisualStudioVersion = 17.7.34031.279
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{4FB0816A-AD8E-448E-928A-774A64FC1C30}"
EndProject
Expand Down Expand Up @@ -33,11 +33,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "veldrid", "veldrid", "{071F
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Veldrid.SDL2.Sample", "samples\veldrid\Veldrid.SDL2.Sample\Veldrid.SDL2.Sample.csproj", "{D426D75B-352E-48DD-A3EC-84FC238E8AFA}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mallos.Input.MonoGame", "src\Mallos.Input.MonoGame\Mallos.Input.MonoGame.csproj", "{E8194C7D-B9DA-453B-8CCB-8D2AAC763676}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
src\Mallos.Input.Debug\Mallos.Input.Debug.projitems*{185e0c41-48cb-4a2e-b9cd-9696d3a0100c}*SharedItemsImports = 5
src\Mallos.Input.Debug\Mallos.Input.Debug.projitems*{ffda853a-f774-491d-bb94-918464bebe47}*SharedItemsImports = 13
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Expand Down Expand Up @@ -131,6 +129,18 @@ Global
{D426D75B-352E-48DD-A3EC-84FC238E8AFA}.Release|x64.Build.0 = Release|Any CPU
{D426D75B-352E-48DD-A3EC-84FC238E8AFA}.Release|x86.ActiveCfg = Release|Any CPU
{D426D75B-352E-48DD-A3EC-84FC238E8AFA}.Release|x86.Build.0 = Release|Any CPU
{E8194C7D-B9DA-453B-8CCB-8D2AAC763676}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E8194C7D-B9DA-453B-8CCB-8D2AAC763676}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E8194C7D-B9DA-453B-8CCB-8D2AAC763676}.Debug|x64.ActiveCfg = Debug|Any CPU
{E8194C7D-B9DA-453B-8CCB-8D2AAC763676}.Debug|x64.Build.0 = Debug|Any CPU
{E8194C7D-B9DA-453B-8CCB-8D2AAC763676}.Debug|x86.ActiveCfg = Debug|Any CPU
{E8194C7D-B9DA-453B-8CCB-8D2AAC763676}.Debug|x86.Build.0 = Debug|Any CPU
{E8194C7D-B9DA-453B-8CCB-8D2AAC763676}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E8194C7D-B9DA-453B-8CCB-8D2AAC763676}.Release|Any CPU.Build.0 = Release|Any CPU
{E8194C7D-B9DA-453B-8CCB-8D2AAC763676}.Release|x64.ActiveCfg = Release|Any CPU
{E8194C7D-B9DA-453B-8CCB-8D2AAC763676}.Release|x64.Build.0 = Release|Any CPU
{E8194C7D-B9DA-453B-8CCB-8D2AAC763676}.Release|x86.ActiveCfg = Release|Any CPU
{E8194C7D-B9DA-453B-8CCB-8D2AAC763676}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -146,8 +156,13 @@ Global
{2FB3D047-5D83-4430-80E3-320991B56038} = {F2321B34-936B-4466-B8D3-AF57FC15140D}
{071FD44A-9C85-4847-A580-4E99B268840F} = {1CD9C844-1AED-414E-814A-96CD68EC107A}
{D426D75B-352E-48DD-A3EC-84FC238E8AFA} = {071FD44A-9C85-4847-A580-4E99B268840F}
{E8194C7D-B9DA-453B-8CCB-8D2AAC763676} = {4FB0816A-AD8E-448E-928A-774A64FC1C30}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D3F35AF9-BE47-4EEB-9C2F-CD7AF08FFA4E}
EndGlobalSection
GlobalSection(SharedMSBuildProjectFiles) = preSolution
src\Mallos.Input.Debug\Mallos.Input.Debug.projitems*{185e0c41-48cb-4a2e-b9cd-9696d3a0100c}*SharedItemsImports = 5
src\Mallos.Input.Debug\Mallos.Input.Debug.projitems*{ffda853a-f774-491d-bb94-918464bebe47}*SharedItemsImports = 13
EndGlobalSection
EndGlobal
15 changes: 15 additions & 0 deletions src/Mallos.Input.MonoGame/Mallos.Input.MonoGame.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.1.303" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Mallos.Input\Mallos.Input.csproj" />
</ItemGroup>

</Project>
6 changes: 6 additions & 0 deletions src/Mallos.Input.MonoGame/MonoGameDevice.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Mallos.Input.MonoGame
{
public abstract class MonoGameDevice
{
}
}
18 changes: 18 additions & 0 deletions src/Mallos.Input.MonoGame/MonoGameDeviceSet.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace Mallos.Input.MonoGame
{
public class MonoGameDeviceSet
: DeviceSet<
MonoGameKeyboard,
MonoGameMouse,
MonoGameGamePad
>
{
public MonoGameDeviceSet()
: base("MonoGame",
new MonoGameKeyboard(),
new MonoGameMouse(),
null)
{
}
}
}
19 changes: 19 additions & 0 deletions src/Mallos.Input.MonoGame/MonoGameKeyboard.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
namespace Mallos.Input.MonoGame
{
using Mallos.Input.Trackers;

public class MonoGameKeyboard : MonoGameDevice, IKeyboard
{
public TextInput TextInput => throw new System.NotImplementedException();

public string Name => throw new System.NotImplementedException();

public IKeyboardTracker CreateTracker()
=> new BasicKeyboardTracker(this);

public KeyboardState GetCurrentState()
{
throw new System.NotImplementedException();
}
}
}
46 changes: 46 additions & 0 deletions src/Mallos.Input.MonoGame/MonoGameMouse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
namespace Mallos.Input.MonoGame
{
using Mallos.Input.Trackers;

public class MonoGameMouse : MonoGameDevice, IMouse
{
public string Name => "Mouse";

private int lastScrollWheelValue = 0;

public IMouseTracker CreateTracker()
=> new BasicMouseTracker(this);

public MouseState GetCurrentState()
{
Microsoft.Xna.Framework.Input.MouseState state = Microsoft.Xna.Framework.Input.Mouse.GetState();

MouseState newState = new(
x: state.X,
y: state.Y,
scrollWheel: state.ScrollWheelValue - this.lastScrollWheelValue,
leftButton: state.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Pressed,
middleButton: state.MiddleButton == Microsoft.Xna.Framework.Input.ButtonState.Pressed,
rightButton: state.RightButton == Microsoft.Xna.Framework.Input.ButtonState.Pressed,
xButton1: state.XButton1 == Microsoft.Xna.Framework.Input.ButtonState.Pressed,
xButton2: state.XButton2 == Microsoft.Xna.Framework.Input.ButtonState.Pressed
);

this.lastScrollWheelValue = state.ScrollWheelValue;
return newState;
}

public void GetPosition(out int x, out int y)
{
Microsoft.Xna.Framework.Input.MouseState state = Microsoft.Xna.Framework.Input.Mouse.GetState();

x = state.X;
y = state.Y;
}

public void SetPosition(int x, int y)
{
throw new System.NotSupportedException();
}
}
}
21 changes: 21 additions & 0 deletions src/Mallos.Input.MonoGame/MonoGamePad.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
namespace Mallos.Input.MonoGame
{
using Mallos.Input.Trackers;

public class MonoGameGamePad : MonoGameDevice, IGamePad
{
public int Index => throw new System.NotImplementedException();

public string Name => throw new System.NotImplementedException();

public IGamePadTracker CreateTracker()
{
throw new System.NotImplementedException();
}

public GamePadState GetCurrentState()
{
throw new System.NotImplementedException();
}
}
}