Gui.

New Message Reply Date view Thread view Subject view Author view

From: Svend Tang-Petersen (svend++at++copen.sgi.com)
Date: 01/31/2000 07:43:39


Hi guys.

I added a shared mem structure to share data and allow a nice exit
from Performer.

-- 

Regards Svend

******************************************************************* Svend Tang-Petersen, MSc Email: svend++at++copen.sgi.com AGD, Europe Silicon Graphics Fax: (+45) 43438606 Hovedgaden 451 Phone: (+45) 43438600 2640 Hedehusene VNET: 540-0422 Denmark http://reality.sgi.com/svend_copen *******************************************************************

#include <Performer/pfutil.h> #include <Performer/pf.h> #include <Performer/pfui.h> #include <Performer/pfdu.h> //#include <Performer/pfui/pfiXformer.h> #include <Performer/pfutil/pfuProcessManager.h> #include <Performer/pf/pfPipeWindow.h> #include <Performer/pf/pfChannel.h> #include <X11/X.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/keysym.h> #include <iostream.h>

// general includes #include <stdlib.h> #include <stdio.h> #include <string.h> #include <math.h> #include <getopt.h> // for cmdline handler

// proecess control includes #include <sys/types.h> #include <sys/prctl.h> #ifndef __linux__ #include <sys/sysmp.h> #include <sys/schedctl.h> #endif

// X Window includes #include <X11/X.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/keysym.h>

// GL includes

// Performer includes #include <Performer/pf/pfChannel.h> #include <Performer/pf/pfDCS.h> #include <Performer/pf/pfLightSource.h> #include <Performer/pf/pfGeode.h> #include <Performer/pr/pfTexture.h> #include <Performer/pr/pfGeoSet.h>

#include <Performer/pfutil.h> #include <Performer/pfdu.h> #include <Performer/pfui/pfiXformer.h>

typedef struct {

int exit;

} SharedData;

SharedData *Shared;

static void controlPanel(pfuWidget *w) {

extern SharedData *Shared;

switch( pfuGetWidgetId(w) ) { case 3: Shared->exit = 1; break;

default: break; } }

void OpenPipeWin( pfPipeWindow *pw ) { pw -> open() ; }

int main() {

extern SharedData *Shared;

pfInit () ; pfuInit () ; pfConfig() ; //pfiInit () ;

/***** Pipe Initialisation *****/ pfPipe* p = pfGetPipe( 0 ) ; pfPipeWindow *pw = new pfPipeWindow( p ) ; pw -> setOriginSize( 0, 0, 800, 800 ) ; pw -> setConfigFunc( OpenPipeWin ) ; pw -> config() ;

pfFrame() ;

Shared = (SharedData *) pfMalloc( sizeof(SharedData), pfGetSharedArena() ); Shared->exit = 0;

/***** GUI Stuff *****/ pfuInitInput ( pw, PFUINPUT_X ) ; pfuInitGUI ( pw ) ; pfuEnableGUI ( 1 ) ; pfuGUIViewport( 0, 0.2, 0.5, 1 ) ;

/***** Build the Panel *****/ pfuPanel *panel = pfuNewPanel() ;

pfuWidget *wid3 = pfuNewWidget( panel, PFUGUI_BUTTON, 3); pfuWidgetDim ( wid3, 0, 0, 100, 20 ) ; pfuWidgetLabel ( wid3, "QUIT" ) ; pfuWidgetActionFunc( wid3, controlPanel ) ; pfuEnableWidget ( wid3 ) ;

pfuWidget *wid2 = pfuNewWidget( panel, PFUGUI_BUTTON, 2); pfuWidgetDim ( wid2, 0, 40, 100, 20 ) ; pfuWidgetLabel ( wid2, "STOP" ) ; pfuEnableWidget ( wid2 ) ;

pfuWidget *wid1 = pfuNewWidget( panel, PFUGUI_BUTTON, 1); pfuWidgetDim ( wid1, 0, 80, 100, 20 ) ; pfuWidgetLabel ( wid1, "START" ) ; pfuEnableWidget ( wid1 ) ;

pfuResetGUI();

pfuMouse mmouse ; pfuEventStream events ;

while( !Shared->exit ) { pfSync() ;

pfuRedrawGUI(); pfuGetMouse ( &mmouse ) ; pfFrame() ; pfuGetEvents( &events ) ; pfuCollectInput(); pfuUpdateGUI( &mmouse ) ; }

pfExit(); }


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Mon Jan 31 2000 - 07:45:41 PST

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.