I'm trying to get access to the keyboard state in XNA from an embedded JavaScript runtime.
I'd like to do something similar to the following, but I can't seem to figure out how to get from "Left" to Keys.Left, in one line, for all 100+ keys or so.
js.SetParameter("XNA_Keyboard", new {
keyDown = (Func<string, bool>)((name) => {
return keyboardState.IsKeyDown(Keys[name]); // ! Can't index keys enum by name
}),
});
Is there some kind of reflection that will make this easier?