Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

P_FreeVRButtons.C

Go to the documentation of this file.
00001 /***************************************************************************
00002  *cr                                                                       
00003  *cr            (C) Copyright 1995-2019 The Board of Trustees of the      
00004  *cr                        University of Illinois                       
00005  *cr                         All Rights Reserved                        
00006  *cr                                                                   
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  * RCS INFORMATION:
00011  *
00012  *      $RCSfile: P_FreeVRButtons.C,v $
00013  *      $Author: johns $        $Locker:  $             $State: Exp $
00014  *      $Revision: 1.20 $       $Date: 2019/01/17 21:21:00 $
00015  *
00016  ***************************************************************************
00017  * DESCRIPTION:
00018  * This is Paul's new Tracker code -- pgrayson@ks.uiuc.edu
00019  ***************************************************************************/
00020 
00021 #include <freevr.h>
00022 #include "P_FreeVRButtons.h"
00023 #include "VMDApp.h"
00024 #include "TextEvent.h"
00025 #include "CommandQueue.h"
00026 #include "Inform.h"
00027 
00028 int FreeVRButtons::do_start(const SensorConfig *) {
00029   // XXX Somehow check that a FreeVR environment exists.  If it doesn't,
00030   // return false.
00031   if ( 0 ) {
00032     return 0;  // no FreeVR, cannot run FreeVR buttons.
00033   }
00034   return 1;    // FreeVR is active.
00035 }
00036 
00037 void FreeVRButtons::update() {
00038   // the mapping of buttons is different in FreeVR than CAVElib
00039   stat[0]=vrGet2switchValue(1);
00040   stat[1]=vrGet2switchValue(2);
00041   stat[2]=vrGet2switchValue(3);
00042   stat[3]=vrGet2switchValue(0);
00043 
00044   // XXX Bill wants to send button events to user-defined scripts...
00045   // 4-6 are in one of the default configs as user buttons.
00046   int i; 
00047   for (i=4; i<11; i++) {
00048 #if 1
00049     if (vrGet2switchDelta(i)) {  // report state only when it changes 
00050 #else
00051     if (vrGet2switchValue(i)) {  // report current state on every query
00052 #endif
00053 //      msgInfo << "Generated AUX event for FreeVR button[" << i << "]" << sendmsg;    
00054       Command *cmd = new UserKeyEvent(DisplayDevice::WIN_KBD, ((char) '0'+i), (int) DisplayDevice::AUX);
00055       app->commandQueue->runcommand(cmd);
00056     }
00057   }
00058 }
00059 

Generated on Fri Oct 11 02:44:27 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002