An open-source, virtual keyboard library for MonoGame.
Welcome to MiKeys! The focus of this project is to provide a simple interface for collecting user input. The library is designed to be flexible, accessible and easily customizable.
- Keyboard
- Mouse
- GamePad
Eye-Tracking(If you can find an open-source project to integrate for this, @Aristurtle will love you)
- Mini
- Keypad
Full(Planned)TKL(Planned)Compact(Planned)
The project should just run out of the box. To run the example, wait for the project to load, then hit Space to open the virtual keyboard. When finished, hit Enter to close the virtual keyboard and view the typed message.
The main integrations points are:
Add and initialize the EntryManager:
EntryManager EM;
EM = new EntryManager();
Call Load()
on EntryManager:
EM.Load(Content, "MiKey_KeyExample");
Create a return string container and a callback event to assign the EntryManager's InputCaptured
event:
string resultString = "";
void InputCaptured(object sender, EventArgs e)
{
resultString = sender as string;
EM.InputCaptured -= InputCaptured;
}
Define a setup call to build a virtual keyboard layout and assign the callback:
RefreshKeyboardAndMouse();
RefreshGamepads();
if (EM.IsActive)
{
EM.Update(gameTime);
} else {
if (GetKeyTap(Keys.Space)) {
EM.SetupInput(gameState, 0, 32, 15);
EM.InputCaptured += InputCaptured;
}
}
The key uses a simple tileset for idle, highlighted and disabled keys. A template and example file can be found in the Content directory. The template file shows how the key is pieced together.
Currently MiKeys only supports monospaced font. The font included in the repo is FixedSys Excelsior, a public domain font. The original .ttx and updated .ttf can be found here https://github.com/kika/fixedsys/ and here https://github.com/delinx/Fixedsys-Core
The code is released under the MIT License, so go crazy. If you make anything cool, show me! Credit is appreciated :)