I am currently working on a game of mine with Monogame and it is a cross platform project (I would like it to run on Windows, Linux and Mac).I have a problem with the getting the input.
I would like to have an event that is reaised when a KEY is pressed and give me the key. And another event when a CHAR is entered.
What I am doing atm.
I am using the Microsoft.Xna.Framework GameWindow from the main class called engine (The class that comes with monogame.) Text Input:
public static void Initialize(GameWindow window)
window.TextInput += CharEnteredEvent;
You should poll the keyboard state using
Keyboard.GetState() API. The
TextInput event is namely only for text input - it does not provide other keys.
You aren't supposed to peek into OpenTK when using MonoGame. As a cross-platform framework, MonoGame is meant to abstract such libraries away. For example, the upcoming 3.6 version will use SDL instead of the obsolete OpenTK.