It's about damn time we start working with Ogre stuff again. No we haven't started the game or Dwarf yet, but we're another step closer. PWOgreBox is another toolbox, this time containing Ogre-specific libraries. As of now, the only thing in PWOgreBox is a custom wxWidgets control. I don't yet know everything that will go into this library, but as the game and Dwarf develops, I'm sure there will be more to put in here.
For now I split PWOgreBox into two projects. The main project, titled PWOgreBox contains almost no code at the moment. In fact, it's just some helpers for exporting the API. Another project in the solution is called wxOgreControl. Although officially part of PWOgreBox, indeed it is in the same namespace and it shares code with the main project, I've decided to keep this as a separate project for now so people who just want to use a lightweight control to embed Ogre in wxWidgets don't need the whole PWOgreBox library. Likewise, people wanting to use the PWOgreBox library won't need wxWidgets installed. We'll see how this evolves. Merging the two later is trivial.
So without further ado, here's a working example of the wxOgreControl in PWOgreBox.
As you can see, the control is pretty much complete. I just have to document it and clean up some dead code. Then we can release it back to the Ogre community. Perhaps it will make a bigger splash than PWToolBox did.
I guess I should mention some features. wxOgreControl creates a new render window using the external window handle of the wxFrame. You don't have to worry about any of this. It's handled automatically for you. All you have to do is create a scene manager, which will be used by the control. The control will create a camera and a viewport for you, which you can access for full customizability.
The control also automatically handles the common events of resizing, cleaning up when closing the control, and intercepting mouse motion and calculating relative mouse motion. These events can be customized through a listener interface. Since you're working with wxWidgets, there's nothing stopping you from connecting to other events that are generated by the control and handling those yourself, outside of the listener interface.
Finally, each render window is updated separately. That means they can be paused/unpaused, and even render at different intervals, the default being 30 fps.
Hopefully I can get the documentation up to par, build and test this on Linux, and we can release it in a week or two.
Updated Well it took me a while, but I finally got it working in Linux. It took longer to get it to work in linux than it did to write it in Windows. There's a block of code to get the window handle in a way that is suitable for Ogre that is 2 lines long in Windows, and 16 lines in Linux. That was the major source of my problems, as there were many snippets of code that tried, but failed, to get that handle.
Working on this I realize just how much GTK sucks. There's so many little things you get for free in Windows that GTK doesn't give you. For example, having the control fill the entire frame is free on Windows. It doesn't matter what size you give the control, it will fill the frame. In GTK the control does not fill the frame. And because the size of the frame is not known by the frame itself yet, you have to pass in the desired size. I've just defaulted to automatically using the size of the parent window.
Furthermore, wxwidgets itself is not completely cross-platform. There's a function called OnEraseBackground which exists for wxWindows in Windows, but not when using GTK. They could've at least declared an empty function so I didn't end up with a compile error.