| |||||||||
|
|
| |||||||
|
| ||||||||
| |||||||||
#include <stdlib.h> // definition of print #include "vg.h" // main include file for Vega #include "pf.h" // main include file for Performer
//
//
// add a call back on the pick event, Note we do not
// pass in any user data as the vgPicker passes the
// picked item through udata pointer
//
//
vgAddFunc( vgFindPicker("my_picker"), VGPICK_PICKED, newPickEventCB, NULL );
void newPickEventCB( vgCommon* handle, void *udata ) { // #################################################################
// #
// # Static member function
// #
// # This Call-back function when the vpPicker picks a new item
// #
// #################################################################
vgPicker *picker = NULL; vgCommon *pickedItem = NULL;
// // The *handle is always a pointer to the
// vgClass instance we placed on the call-back
//
picker = (vgPicker*)handle;
// //
// Normally on Vega Calls instance call backs the user supplies
// udata which should be structure created from the shared arena
//
//
// However with the picked event the vgPicker uses the udata to
// pass in a pointer to the item tha has been picked item which
// has to be cast to its correct type
//
//
int which = vgGetProp( picker, VGPICK_HL_LEVEL );
switch( which ){
case VGPICK_OBJECT : case VGPICK_PART : case VGPICK_PART_DCS : case VGPICK_PLAYER :
pickedItem = dynamic_cast<vgCommon *>(udata);
// // Sanity check do we have a vega class pointer
//
if( pickedItem == NULL ) return;
// // Do something with the picked item
//
vgPrint( pickedItem );
break;
case VGPICK_GEODE :
printf("pfGeode Picked 0x%p\n", udata );
break;
case VGPICK_GEOSET : printf("pfGeoSet Picked 0x%p\n", udata );
break;
default:
printf("Unknown Picker Level\n");
break; }
} // newPickEventCB |
||
© Copyright 2004 Gordon Tomlinson All Rights Reserved. All logos, trademarks and copyrights in this site are property of their respective owner. |