Best way to Get Pointer to RenderWindow

Celtic

09-06-2007 08:14:53

Hey Everyone,

When I first started out with C#, I made an Input system that uses Microsoft's DirectInput to handle keyboard input. Until now, I have been creating a seperate form and embedding Ogre into it, but now I need to have the Ogre window created by Root..

Because of this, I have run into a few problems in other area's, like attaching my Input system onto the RenderWindow because I need to get the IntPtr to the window.

Currently, I am doing this as follows..

[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string lpClassName,string lpWindowName);


Passing null as the ClassName, and passing the Window caption as the WindowName. While this works fine, I was wondering if...

1) Is there any supported way to get the IntPtr to the RenderWindow? As in, a MOGRE/Ogre way, not my own stupid code :p

And this next question might be completely retarded, but is there any way to gain access to the events of the RenderWindow such as MouseMove ect? I am currently thinking of the RenderWindow as a Windows Form with some extra's, not as a different object all together... so this one might be way out there :p

Kind Regards

Celtic

Sweenie

11-06-2007 06:44:44

Try this...


IntPtr hwnd;
ogreRenderWin.GetCustomAttribute("WINDOW", hwnd);

Celtic

12-06-2007 01:17:32

Thanks alot!

Thats exactly the kind of thing I was looking for.

Kind Regards

Celtic