Thanks to visit codestin.com
Credit goes to github.com

Skip to content

An input implementation using GLFW #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 53 commits into from
Aug 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
179f457
Start of the GLFW Input implementation
Perksey Jul 14, 2019
ec588a7
A start I guess, it's messy and all over the place
Perksey Jul 15, 2019
e633f36
Additional work on GLFW input (#26)
devvoid Jul 19, 2019
2f87960
Merge branch 'master' into glfw-input
Perksey Jul 22, 2019
f80cba2
More input work
Perksey Jul 23, 2019
a1f6a27
Add an .editorconfig
Perksey Jul 23, 2019
8dcc3f1
ThumbstickCollection
frederikja163 Jul 24, 2019
92f9f68
ButtonCollection
frederikja163 Jul 24, 2019
4503a97
Hat and Trigger collection
frederikja163 Jul 25, 2019
2859bdf
Update collections
frederikja163 Jul 25, 2019
422c2f4
joystick axis cache
frederikja163 Jul 25, 2019
3cdcc40
Update cached axis
frederikja163 Jul 25, 2019
0046628
Update GlfwJoystick.cs
Perksey Jul 25, 2019
e0702c0
Joystick cache
frederikja163 Jul 25, 2019
1dc18db
Merge remote-tracking branch 'Ultz/glfw-input' into glfw-input
frederikja163 Jul 25, 2019
dae0f11
Merge remote-tracking branch 'origin/glfw-input' into glfw-input
Perksey Jul 25, 2019
958818b
AxisCollection
frederikja163 Jul 25, 2019
dcb02c6
GamePad and Joystick cache
frederikja163 Jul 25, 2019
d334135
Merge remote-tracking branch 'Ultz/glfw-input' into glfw-input
frederikja163 Jul 25, 2019
f159b8c
GamepadFix
frederikja163 Jul 25, 2019
213c760
GamePad Updates
frederikja163 Jul 25, 2019
a946ba2
Bracket fix
frederikja163 Jul 25, 2019
d9d0cae
work
Perksey Jul 26, 2019
85042ab
Thumbstick update
frederikja163 Jul 26, 2019
4cb7095
Gamepad implementation
frederikja163 Jul 26, 2019
b4fe961
nitpick
Perksey Jul 31, 2019
03e6969
merge
Perksey Jul 31, 2019
652450e
update test program
Perksey Jul 31, 2019
f8bef17
Update dispatcher
Perksey Jul 31, 2019
436c4f1
Only show window when running
Perksey Jul 31, 2019
f130cda
Fix context not being passed to enumerator
Perksey Jul 31, 2019
2ceb2f2
Fix a marshalling bug
Perksey Aug 1, 2019
013f410
Apply deadzone
Perksey Aug 1, 2019
1658f44
Enumerate over the disconnected joysticks too.
Perksey Aug 1, 2019
8083807
Update the test app.
Perksey Aug 1, 2019
bec0f33
Controller events fix
frederikja163 Aug 1, 2019
fe823d6
wip
Perksey Aug 1, 2019
abdb81a
Use indexers on the pointers
Perksey Aug 1, 2019
2220a7b
Fix mismatched enumerant names in GLFW
Perksey Aug 1, 2019
3c83428
Destroy window when we're done
Perksey Aug 1, 2019
32f385f
Fix wrong enum values in GLFW
Perksey Aug 1, 2019
8ddba81
Make properties update initialOptions, and only invoke GLFW if running
Perksey Aug 1, 2019
911d42c
Window is immovable when only 1 thread is used, investigate WindowUpdate
Perksey Aug 1, 2019
5ae7fc1
Fix `Get` methods (#30)
john-h-k Aug 1, 2019
3fba09b
Merge branch 'master' into glfw-input
Perksey Aug 1, 2019
71a5bd8
Merge branch 'master' into glfw-input
Perksey Aug 3, 2019
0b90dad
Fully implement mice, fix deadlock issues
Perksey Aug 3, 2019
b0c82f2
This is GLFW input.
Perksey Aug 3, 2019
8b7913f
Update GlfwInputContext.cs
Perksey Aug 4, 2019
0666704
Update Silk.NET.Input.Desktop.csproj
Perksey Aug 4, 2019
1fd3852
Update GlfwInputContext.cs
Perksey Aug 4, 2019
4c404b3
Update InputHandler.cs
Perksey Aug 4, 2019
1ca81fb
Update GlfwInputContext.cs
Perksey Aug 4, 2019
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
53 changes: 53 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

[*]
charset=utf-8
end_of_line=crlf
trim_trailing_whitespace=false
insert_final_newline=false
indent_style=space
indent_size=4

# Microsoft .NET properties
csharp_new_line_before_members_in_object_initializers=false
csharp_preferred_modifier_order=public, private, protected, internal, new, abstract, virtual, sealed, override, static, readonly, extern, unsafe, volatile, async:suggestion
csharp_style_var_elsewhere=true:hint
csharp_style_var_for_built_in_types=true:hint
csharp_style_var_when_type_is_apparent=true:hint
dotnet_style_predefined_type_for_locals_parameters_members=true:hint
dotnet_style_predefined_type_for_member_access=true:hint
dotnet_style_qualification_for_event=false:warning
dotnet_style_qualification_for_field=false:warning
dotnet_style_qualification_for_method=false:warning
dotnet_style_qualification_for_property=false:warning
dotnet_style_require_accessibility_modifiers=for_non_interface_members:hint

# ReSharper properties
resharper_autodetect_indent_settings=true
resharper_braces_for_for=required
resharper_braces_for_foreach=required
resharper_braces_for_ifelse=required
resharper_braces_for_while=required
resharper_csharp_insert_final_newline=true
resharper_csharp_wrap_before_declaration_lpar=true
resharper_csharp_wrap_before_invocation_lpar=true
resharper_csharp_wrap_extends_list_style=chop_if_long
resharper_csharp_wrap_parameters_style=chop_if_long
resharper_use_indent_from_vs=false
resharper_wrap_after_declaration_lpar=true
resharper_wrap_after_invocation_lpar=true
resharper_wrap_before_declaration_rpar=true
resharper_wrap_before_invocation_rpar=true
resharper_wrap_chained_method_calls=chop_if_long
resharper_xmldoc_indent_child_elements=DoNotTouch
resharper_xmldoc_indent_text=DoNotTouch

# ReSharper inspection severities
resharper_invert_if_highlighting=none
resharper_web_config_module_not_resolved_highlighting=warning
resharper_web_config_type_not_resolved_highlighting=warning
resharper_web_config_wrong_module_highlighting=warning

[*.{appxmanifest,asax,ascx,aspx,build,config,cs,cshtml,csproj,dbml,discomap,dtd,fs,fsi,fsscript,fsx,htm,html,jsproj,lsproj,master,ml,mli,njsproj,nuspec,proj,props,razor,resw,resx,skin,StyleCop,targets,tasks,vb,vbproj,xaml,xamlx,xml,xoml,xsd}]
indent_style=space
indent_size=4
tab_width=4
45 changes: 45 additions & 0 deletions Silk.NET.sln
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{0651C5EF-5
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Triangle", "examples\Triangle\Triangle.csproj", "{3478F392-7055-4ECC-B388-7F115AA7EA5A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.Input.Desktop", "src\Input\Silk.NET.Input.Desktop\Silk.NET.Input.Desktop.csproj", "{3908DEF6-7403-49F5-B8EC-5B3B12C325D4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.Input", "src\Input\Silk.NET.Input\Silk.NET.Input.csproj", "{020A8E88-B607-4281-BA0D-5ED03484A201}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InputTest", "examples\InputTest\InputTest.csproj", "{3E744E54-F450-4051-8919-04D9B591688E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -1044,6 +1050,42 @@ Global
{3478F392-7055-4ECC-B388-7F115AA7EA5A}.Release|x64.Build.0 = Release|Any CPU
{3478F392-7055-4ECC-B388-7F115AA7EA5A}.Release|x86.ActiveCfg = Release|Any CPU
{3478F392-7055-4ECC-B388-7F115AA7EA5A}.Release|x86.Build.0 = Release|Any CPU
{3908DEF6-7403-49F5-B8EC-5B3B12C325D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3908DEF6-7403-49F5-B8EC-5B3B12C325D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3908DEF6-7403-49F5-B8EC-5B3B12C325D4}.Debug|x64.ActiveCfg = Debug|Any CPU
{3908DEF6-7403-49F5-B8EC-5B3B12C325D4}.Debug|x64.Build.0 = Debug|Any CPU
{3908DEF6-7403-49F5-B8EC-5B3B12C325D4}.Debug|x86.ActiveCfg = Debug|Any CPU
{3908DEF6-7403-49F5-B8EC-5B3B12C325D4}.Debug|x86.Build.0 = Debug|Any CPU
{3908DEF6-7403-49F5-B8EC-5B3B12C325D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3908DEF6-7403-49F5-B8EC-5B3B12C325D4}.Release|Any CPU.Build.0 = Release|Any CPU
{3908DEF6-7403-49F5-B8EC-5B3B12C325D4}.Release|x64.ActiveCfg = Release|Any CPU
{3908DEF6-7403-49F5-B8EC-5B3B12C325D4}.Release|x64.Build.0 = Release|Any CPU
{3908DEF6-7403-49F5-B8EC-5B3B12C325D4}.Release|x86.ActiveCfg = Release|Any CPU
{3908DEF6-7403-49F5-B8EC-5B3B12C325D4}.Release|x86.Build.0 = Release|Any CPU
{020A8E88-B607-4281-BA0D-5ED03484A201}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{020A8E88-B607-4281-BA0D-5ED03484A201}.Debug|Any CPU.Build.0 = Debug|Any CPU
{020A8E88-B607-4281-BA0D-5ED03484A201}.Debug|x64.ActiveCfg = Debug|Any CPU
{020A8E88-B607-4281-BA0D-5ED03484A201}.Debug|x64.Build.0 = Debug|Any CPU
{020A8E88-B607-4281-BA0D-5ED03484A201}.Debug|x86.ActiveCfg = Debug|Any CPU
{020A8E88-B607-4281-BA0D-5ED03484A201}.Debug|x86.Build.0 = Debug|Any CPU
{020A8E88-B607-4281-BA0D-5ED03484A201}.Release|Any CPU.ActiveCfg = Release|Any CPU
{020A8E88-B607-4281-BA0D-5ED03484A201}.Release|Any CPU.Build.0 = Release|Any CPU
{020A8E88-B607-4281-BA0D-5ED03484A201}.Release|x64.ActiveCfg = Release|Any CPU
{020A8E88-B607-4281-BA0D-5ED03484A201}.Release|x64.Build.0 = Release|Any CPU
{020A8E88-B607-4281-BA0D-5ED03484A201}.Release|x86.ActiveCfg = Release|Any CPU
{020A8E88-B607-4281-BA0D-5ED03484A201}.Release|x86.Build.0 = Release|Any CPU
{3E744E54-F450-4051-8919-04D9B591688E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3E744E54-F450-4051-8919-04D9B591688E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3E744E54-F450-4051-8919-04D9B591688E}.Debug|x64.ActiveCfg = Debug|Any CPU
{3E744E54-F450-4051-8919-04D9B591688E}.Debug|x64.Build.0 = Debug|Any CPU
{3E744E54-F450-4051-8919-04D9B591688E}.Debug|x86.ActiveCfg = Debug|Any CPU
{3E744E54-F450-4051-8919-04D9B591688E}.Debug|x86.Build.0 = Debug|Any CPU
{3E744E54-F450-4051-8919-04D9B591688E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3E744E54-F450-4051-8919-04D9B591688E}.Release|Any CPU.Build.0 = Release|Any CPU
{3E744E54-F450-4051-8919-04D9B591688E}.Release|x64.ActiveCfg = Release|Any CPU
{3E744E54-F450-4051-8919-04D9B591688E}.Release|x64.Build.0 = Release|Any CPU
{3E744E54-F450-4051-8919-04D9B591688E}.Release|x86.ActiveCfg = Release|Any CPU
{3E744E54-F450-4051-8919-04D9B591688E}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{BFE429EB-4C2E-4BF3-A302-C9C5A2FDA6D7} = {23324041-2076-477C-A4BF-B385B8066C6C}
Expand Down Expand Up @@ -1119,5 +1161,8 @@ Global
{FD24E9FF-1097-4777-A418-F2D88C558665} = {0651C5EF-50AA-4598-8D9C-8F210ADD8490}
{136C6154-D300-4B82-80D3-17B637841A2B} = {0651C5EF-50AA-4598-8D9C-8F210ADD8490}
{3478F392-7055-4ECC-B388-7F115AA7EA5A} = {E1F91563-7277-4E9B-A3B7-8D5FD9802A4A}
{3908DEF6-7403-49F5-B8EC-5B3B12C325D4} = {FA9D1C95-5585-4DEC-B226-1447A486C376}
{020A8E88-B607-4281-BA0D-5ED03484A201} = {FA9D1C95-5585-4DEC-B226-1447A486C376}
{3E744E54-F450-4051-8919-04D9B591688E} = {E1F91563-7277-4E9B-A3B7-8D5FD9802A4A}
EndGlobalSection
EndGlobal
34 changes: 18 additions & 16 deletions documentation/proposals/Proposal - Input.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Summary
# Summary
Proposal API for Input via keyboards, mice, and controllers.

# Contributors
Expand Down Expand Up @@ -27,9 +27,9 @@ Proposal API for Input via keyboards, mice, and controllers.
```cs
public interface IJoystick : IInputDevice
{
IReadOnlyCollection<Axis> Axes { get; }
IReadOnlyCollection<Button> Buttons { get; }
IReadOnlyCollection<Hat> Hats { get; }
IReadOnlyList<Axis> Axes { get; }
IReadOnlyList<Button> Buttons { get; }
IReadOnlyList<Hat> Hats { get; }
Deadzone Deadzone { get; set; }
event Action<IJoystick, Button> ButtonDown;
event Action<IJoystick, Button> ButtonUp;
Expand All @@ -42,9 +42,9 @@ public interface IJoystick : IInputDevice
```cs
public interface IGamepad : IInputDevice
{
IReadOnlyCollection<Button> Buttons { get; }
IReadOnlyCollection<Thumbstick> Thumbsticks { get; }
IReadOnlyCollection<Trigger> Triggers { get; }
IReadOnlyList<Button> Buttons { get; }
IReadOnlyList<Thumbstick> Thumbsticks { get; }
IReadOnlyList<Trigger> Triggers { get; }
Deadzone Deadzone { get; set; }
event Action<IGamepad, Button> ButtonDown;
event Action<IGamepad, Button> ButtonUp;
Expand All @@ -57,7 +57,7 @@ public interface IGamepad : IInputDevice
```cs
public interface IKeyboard : IInputDevice
{
IReadOnlyCollection<Key> SupportedKeys { get; }
IReadOnlyList<Key> SupportedKeys { get; }
bool IsKeyPressed(Key key);
bool IsKeyPressed(uint scancode);
event Action<IKeyboard, Key> KeyDown;
Expand All @@ -69,8 +69,8 @@ public interface IKeyboard : IInputDevice
```cs
public interface IMouse : IInputDevice
{
IReadOnlyCollection<MouseButton> SupportedButtons { get; }
IReadOnlyCollection<ScrollWheel> ScrollWheels { get; }
IReadOnlyList<MouseButton> SupportedButtons { get; }
IReadOnlyList<ScrollWheel> ScrollWheels { get; }
bool IsButtonPressed(MouseButton btn);
event Action<IMouse, MouseButton> MouseDown;
event Action<IMouse, MouseButton> MouseUp;
Expand All @@ -94,11 +94,11 @@ public interface IInputDevice
public interface IInputContext : IDisposable
{
IntPtr Handle { get; }
IReadOnlyCollection<IGamepad> Gamepads { get; }
IReadOnlyCollection<IJoystick> Joysticks { get; }
IReadOnlyCollection<IKeyboard> Keyboards { get; }
IReadOnlyCollection<IMouse> Mice { get; }
IReadOnlyCollection<IInputDevice> OtherDevices { get; }
IReadOnlyList<IGamepad> Gamepads { get; }
IReadOnlyList<IJoystick> Joysticks { get; }
IReadOnlyList<IKeyboard> Keyboards { get; }
IReadOnlyList<IMouse> Mice { get; }
IReadOnlyList<IInputDevice> OtherDevices { get; }
}
```

Expand Down Expand Up @@ -162,7 +162,9 @@ public struct Axis
```cs
public struct Thumbstick
{
public int Index { get; }
public int Index { get; }
public float X { get; }
public float Y { get; }
public float Position { get; }
public float Direction { get; }

Expand Down
14 changes: 14 additions & 0 deletions examples/InputTest/InputTest.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Input\Silk.NET.Input.Desktop\Silk.NET.Input.Desktop.csproj" />
<ProjectReference Include="..\..\src\Input\Silk.NET.Input\Silk.NET.Input.csproj" />
<ProjectReference Include="..\..\src\Windowing\Silk.NET.Windowing\Silk.NET.Windowing.csproj" />
</ItemGroup>

</Project>
Loading