[osg-submissions] Updated osgviewerWX example

Paul Melis paul at science.uva.nl
Wed May 14 08:16:47 PDT 2008


Hi Robert,

Here is an update to the osgviewerWX example. Keyboard events were not 
always received because the GraphicsWindowWX wasn't receiving focus. It 
now receives focus when the mouse enters the window.
* I split the mouse handling from a monolithic method to separate ones, 
slightly cleaner than a whole bunch of if()'s, especially with another 
case of the mouse entering the canvas.
* I changed the EVT_KEY_DOWN handler to an EVT_CHAR handler, although 
that now makes the up and down handler assymetric. The new down-handler 
returns translated key codes, so when you press the S key (without 
anything else), it actually returns 's' and not 'S' as the EVT_KEY_DOWN 
did. This means that statistics can be called up in the viewer window, 
while the example previously only printed a "Stats output:" line to the 
console. I'm not truly happy that the up handler returns _untranslated_ 
key codes. But solving this completely would probably mean adding some 
table that translated from wxWidgets' untranslated key codes to OSG's 
internal ones. This might be interesting to add, as anyone using OSG + 
wxWidgets in any serious manner would also have to add this.
* I commented out the evt.Skip()'s in the keyboard handlers as these 
would only be necessary if there were some key events that are not 
handled. But currently all key events are simply forwarded.
* I changed the handling of a mouse drag to a more general mouse move

Paul
-------------- next part --------------
A non-text attachment was scrubbed...
Name: osgviewerWX.cpp
Type: text/x-c++src
Size: 7294 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-submissions-openscenegraph.org/attachments/20080514/d8315275/attachment.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: osgviewerWX.h
Type: text/x-chdr
Size: 2081 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-submissions-openscenegraph.org/attachments/20080514/d8315275/attachment.h>


More information about the osg-submissions mailing list