Vectrex
06-01-2010 12:48:18
Hi, when I try and create a MOIS keyboard or mouse with Ogre embedded in winforms it crashes. This only happens when my Ogre render window is part of the .net winforms window and not if the Ogre window is seperated. When the window is seperate it doesn't crash but I don't seem to get the input events either..
Has anyone used MOIS with winforms in this way? Care to paste a few lines?
Has anyone used MOIS with winforms in this way? Care to paste a few lines?
public void Initialise()
{
MOIS.ParamList pl = new MOIS.ParamList();
IntPtr windowHnd;
Renderer.Instance.RenderWindow.GetCustomAttribute("WINDOW", out windowHnd);
pl.Insert("WINDOW", windowHnd.ToString());
inputManager = MOIS.InputManager.CreateInputSystem(pl);
// CRASHES HERE if embedded. 'RenderWindow' and windowHnd seem to have ok values
InputMouse = (MOIS.Mouse)inputManager.CreateInputObject(MOIS.Type.OISMouse, true);
InputKeyboard = (MOIS.Keyboard)inputManager.CreateInputObject(MOIS.Type.OISKeyboard, true);
// These events don't seem to get called either
InputKeyboard.KeyPressed += new KeyListener.KeyPressedHandler(InputKeyboard_KeyPressed);
InputMouse.MouseMoved += new MouseListener.MouseMovedHandler(InputMouse_MouseMoved);
}