11
\$\begingroup\$

As a preliminary solution, I am currently using the Nuclex framework (see note below) in an C#/XNA game project for buffered keyboard input. Sadly, Nuclex relies on SlimDX.Directinput.dll and therefore to my knowledge can only be used under Windows OSs. However, I use MonoGame to target other platforms (Linux, OSX, etc.) and therfore I am looking for a portable way to integrate buffered keyboard input aross all platforms. Is there any?

Note:
This question originally linked to Nuclex on CodePlex, which has been in archive mode since 2017 and will be going offline soon.
The link now provided (mirror) goes to a copy of last version of Nuclex posted to CodePlex.
Cygon appears to be maintaining development here.
A different branch is available here.

\$\endgroup\$
1
  • \$\begingroup\$ Doesn't exist as a library yet. People have done it for Mac and Linux when porting my gui library to monogame and I am trying to get people to contribute their code. \$\endgroup\$ Apr 7, 2013 at 23:04

2 Answers 2

4
+50
\$\begingroup\$

SharpInputSystem was created for this exact purpose. It provides a portable way of access the Keyboard and Mouse on most platforms and GamePad/Joystick on a few others. In full disclosure, I am the author, but I needed a similar library for the samples I provide with Axiom.

It may need to be modified to load the MonoGame assemblies properly, I am currently loading the Xna libraries dynamically to avoid a dependency on a strong name. I can either look into making those changes if you want or if you feel up to it, submit a patch once you've got it working.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Good effort but not a real answer since it's not usable at this point without significant work. \$\endgroup\$
    – ashes999
    Mar 8, 2013 at 23:50
0
\$\begingroup\$

While not properly portable (it is only for Windows and Linux). MonoGame has an event for text input that uses properly buffered keyboard input.

MonoGame.Framework/GameWindow.cs

    /// Use this event to retrieve text for objects like textbox's.
    /// This event is not raised by noncharacter keys.
    /// This event also supports key repeat.
    /// For more information this event is based off:
    /// http://msdn.microsoft.com/en-AU/library/system.windows.forms.control.keypress.aspx
    /// </summary>
    /// <remarks>
    /// This event is only supported on the Windows DirectX, Windows OpenGL and Linux platforms.
    /// </remarks>
    public event EventHandler<TextInputEventArgs> TextInput;
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .