1 /**************************************************************************
4 * Based on gui.cxx and renamed on 2002/08/13 by Erik Hofman.
6 * Written 1998 by Durk Talsma, started Juni, 1998. For the flight gear
9 * Additional mouse supported added by David Megginson, 1999.
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License as
13 * published by the Free Software Foundation; either version 2 of the
14 * License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 **************************************************************************/
33 #include <simgear/compiler.h>
35 #ifdef SG_MATH_EXCEPTION_CLASH
45 #if defined(FX) && defined(XMESA)
46 # include <GL/xmesa.h>
57 # include <shellapi.h>
59 # include <sys/cygwin.h>
63 #include <simgear/constants.h>
64 #include <simgear/debug/logstream.hxx>
65 #include <simgear/misc/sg_path.hxx>
66 #include <simgear/screen/screen-dump.hxx>
68 #include <Include/general.hxx>
69 #include <Aircraft/aircraft.hxx>
70 #include <Airports/simple.hxx>
71 #include <Autopilot/auto_gui.hxx>
72 #include <Autopilot/newauto.hxx>
73 #include <Cockpit/panel.hxx>
74 #include <Controls/controls.hxx>
75 #include <FDM/flight.hxx>
76 #include <Main/fg_init.hxx>
77 #include <Main/fg_io.hxx>
78 #include <Main/globals.hxx>
79 #include <Main/fg_props.hxx>
80 #include <Main/viewmgr.hxx>
83 #include <NetworkOLK/network.h>
86 #if defined( WIN32 ) && !defined( __CYGWIN__ ) && !defined(__MINGW32__)
87 # include <simgear/screen/win32-printer.h>
88 # include <simgear/screen/GlBitmaps.h>
92 #include "gui_local.hxx"
93 #include "net_dlg.hxx"
94 #include "preset_dlg.hxx"
95 #include "prop_picker.hxx"
96 #include "sgVec3Slider.hxx"
101 // main.cxx hack, should come from an include someplace
102 extern void fgInitVisuals( void );
103 extern void fgRenderFrame( void );
105 extern void fgHUDalphaAdjust( puObject * );
108 extern void fgLatLonFormatToggle( puObject *);
110 #ifdef FG_NETWORK_OLK
111 extern void net_fgd_scan(puObject *cb);
112 #endif // #ifdef FG_NETWORK_OLK
114 #if defined( TR_HIRES_SNAP)
115 #include <simgear/screen/tr.h>
116 extern void trRenderFrame( void );
117 extern void fgUpdateHUD( GLfloat x_start, GLfloat y_start,
118 GLfloat x_end, GLfloat y_end );
121 puDialogBox *dialogBox = 0;
122 puFrame *dialogFrame = 0;
123 puText *dialogBoxMessage = 0;
124 puOneShot *dialogBoxOkButton = 0;
126 puDialogBox *YNdialogBox = 0;
127 puFrame *YNdialogFrame = 0;
128 puText *YNdialogBoxMessage = 0;
129 puOneShot *YNdialogBoxOkButton = 0;
130 puOneShot *YNdialogBoxNoButton = 0;
132 char *gui_msg_OK; // "OK"
133 char *gui_msg_NO; // "NO"
134 char *gui_msg_YES; // "YES"
135 char *gui_msg_CANCEL; // "CANCEL"
136 char *gui_msg_RESET; // "RESET"
138 char msg_OK[] = "OK";
139 char msg_NO[] = "NO";
140 char msg_YES[] = "YES";
141 char msg_CANCEL[] = "Cancel";
142 char msg_RESET[] = "Reset";
144 char global_dialog_string[256];
146 const __fg_gui_fn_t __fg_gui_fn[] = {
149 {"saveFlight", saveFlight},
150 {"loadFlight", loadFlight},
153 {"dumpHiResSnapShot", dumpHiResSnapShot},
155 {"dumpSnapShot", dumpSnapShot},
156 #if defined( WIN32 ) && !defined( __CYGWIN__) && !defined(__MINGW32__)
157 {"printScreen", printScreen},
159 {"MayBeGoodBye", MayBeGoodBye},
162 {"guiTogglePanel", guiTogglePanel},
163 {"PilotOffsetAdjust", PilotOffsetAdjust},
164 {"fgHUDalphaAdjust", fgHUDalphaAdjust},
165 {"prop_pickerView", prop_pickerView},
168 {"fgPresetAirport", fgPresetAirport},
169 {"fgPresetRunway", fgPresetRunway},
170 {"fgPresetOffsetDistance", fgPresetOffsetDistance},
171 {"fgPresetAltitude", fgPresetAltitude},
172 {"fgPresetGlideslope", fgPresetGlideslope},
173 {"fgPresetAirspeed", fgPresetAirspeed},
174 {"fgPresetCommit", fgPresetCommit},
177 #ifdef FG_NETWORK_OLK
178 {"net_display_toggle", net_display_toggle},
179 {"NewCallSign", NewCallSign},
180 {"net_fgd_scan", net_fgd_scan},
181 {"net_register", net_register},
182 {"net_unregister", net_unregister},
186 {"NewAltitude", NewAltitude},
187 {"NewHeading", NewHeading},
188 {"AddWayPoint", AddWayPoint},
189 {"PopWayPoint", PopWayPoint},
190 {"ClearRoute", ClearRoute},
191 {"fgAPAdjust", fgAPAdjust},
192 {"fgLatLonFormatToggle", fgLatLonFormatToggle},
197 // Structure termination
202 /* ================ General Purpose Functions ================ */
204 void initDialog(void) {
205 // Initialize our GLOBAL GUI STRINGS
206 gui_msg_OK = msg_OK; // "OK"
207 gui_msg_NO = msg_NO; // "NO"
208 gui_msg_YES = msg_YES; // "YES"
209 gui_msg_CANCEL = msg_CANCEL; // "CANCEL"
210 gui_msg_RESET = msg_RESET; // "RESET"
213 // General Purpose Message Box
214 void mkDialog (const char *txt)
216 strncpy(global_dialog_string, txt, 256);
217 dialogBoxMessage->setLabel(global_dialog_string);
218 FG_PUSH_PUI_DIALOG( dialogBox );
221 // Message Box to report an error.
222 void guiErrorMessage (const char *txt)
224 SG_LOG(SG_GENERAL, SG_ALERT, txt);
229 // Message Box to report a throwable (usually an exception).
230 void guiErrorMessage (const char *txt, const sg_throwable &throwable)
234 msg += throwable.getFormattedMessage();
235 if (!throwable.getOrigin().empty()) {
236 msg += "\n (reported by ";
237 msg += throwable.getOrigin();
240 SG_LOG(SG_GENERAL, SG_ALERT, msg);
242 mkDialog(msg.c_str());
245 // Intercept the Escape Key
246 void ConfirmExitDialog(void)
248 FG_PUSH_PUI_DIALOG( YNdialogBox );
253 /* -----------------------------------------------------------------------
254 the Gui callback functions
255 ____________________________________________________________________*/
258 // Hier Neu :-) This is my newly added code
259 // Added by David Findlay <nedz@bigpond.com>
260 // on Sunday 3rd of December
262 // Start new Save Dialog Box
263 puDialogBox *SaveDialog = 0;
264 puFrame *SaveDialogFrame = 0;
265 puText *SaveDialogMessage = 0;
266 puInput *SaveDialogInput = 0;
268 puOneShot *SaveDialogOkButton = 0;
269 puOneShot *SaveDialogCancelButton = 0;
270 // static puOneShot *SaveDialogResetButton = 0;
272 // Default save filename
273 char saveFile[256] = "fgfs.sav";
276 void SaveDialogCancel(puObject *) {
277 FG_POP_PUI_DIALOG( SaveDialog );
280 // If press OK do this
281 void SaveDialogOk(puObject*) {
283 FG_POP_PUI_DIALOG( SaveDialog );
286 SaveDialogInput->getValue(&s);
289 // cout << saveFile << endl;
290 if (output.good() && fgSaveFlight(output)) {
292 mkDialog("Saved flight");
293 SG_LOG(SG_INPUT, SG_INFO, "Saved flight");
295 mkDialog("Cannot save flight");
296 SG_LOG(SG_INPUT, SG_ALERT, "Cannot save flight");
301 void saveFlight(puObject *cv) {
302 SaveDialog = new puDialogBox (150, 50);
304 SaveDialogFrame = new puFrame (0,0,350, 150);
306 = new puText( (150 - puGetDefaultLabelFont().getStringWidth( "File Name:" ) / 2), 110 );
307 SaveDialogMessage -> setLabel ("File Name:");
309 SaveDialogInput = new puInput (50, 70, 300, 100);
310 SaveDialogInput -> setValue (saveFile);
311 SaveDialogInput -> acceptInput();
313 SaveDialogOkButton = new puOneShot (50, 10, 110, 50);
314 SaveDialogOkButton -> setLegend (gui_msg_OK);
315 SaveDialogOkButton -> setCallback ( SaveDialogOk );
316 SaveDialogOkButton -> makeReturnDefault(TRUE);
318 SaveDialogCancelButton = new puOneShot (140, 10, 210, 50);
319 SaveDialogCancelButton -> setLegend (gui_msg_CANCEL);
320 SaveDialogCancelButton -> setCallback ( SaveDialogCancel );
322 FG_FINALIZE_PUI_DIALOG( SaveDialog );
324 SaveDialog -> reveal();
328 puDialogBox *LoadDialog = 0;
329 puFrame *LoadDialogFrame = 0;
330 puText *LoadDialogMessage = 0;
331 puInput *LoadDialogInput = 0;
333 puOneShot *LoadDialogOkButton = 0;
334 puOneShot *LoadDialogCancelButton = 0;
335 // static puOneShot *LoadDialogResetButton = 0;
337 // Default load filename
338 char loadFile[256] = "fgfs.sav";
340 // Do this if the person click okay
341 void LoadDialogOk(puObject *) {
343 FG_POP_PUI_DIALOG( LoadDialog );
346 LoadDialogInput->getValue(&l);
349 if (input.good() && fgLoadFlight(input)) {
351 mkDialog("Loaded flight");
352 SG_LOG(SG_INPUT, SG_INFO, "Restored flight");
354 mkDialog("Failed to load flight");
355 SG_LOG(SG_INPUT, SG_ALERT, "Cannot load flight");
359 // Do this if the person presses cancel
360 void LoadDialogCancel(puObject *) {
361 FG_POP_PUI_DIALOG( LoadDialog );
364 // Create Load Dialog
365 void loadFlight(puObject *cb)
367 LoadDialog = new puDialogBox (150, 50);
369 LoadDialogFrame = new puFrame (0,0,350, 150);
371 = new puText( (150 - puGetDefaultLabelFont().getStringWidth( "File Name:" ) / 2), 110 );
372 LoadDialogMessage -> setLabel ("File Name:");
374 LoadDialogInput = new puInput (50, 70, 300, 100);
375 LoadDialogInput -> setValue (loadFile);
376 LoadDialogInput -> acceptInput();
378 LoadDialogOkButton = new puOneShot (50, 10, 110, 50);
379 LoadDialogOkButton -> setLegend (gui_msg_OK);
380 LoadDialogOkButton -> setCallback ( LoadDialogOk );
381 LoadDialogOkButton -> makeReturnDefault(TRUE);
383 LoadDialogCancelButton = new puOneShot (140, 10, 210, 50);
384 LoadDialogCancelButton -> setLegend (gui_msg_CANCEL);
385 LoadDialogCancelButton -> setCallback ( LoadDialogCancel );
387 FG_FINALIZE_PUI_DIALOG( LoadDialog );
389 LoadDialog -> reveal();
392 // This is the accessor function
393 void guiTogglePanel(puObject *cb)
395 if (fgGetBool("/sim/panel/visibility"))
396 fgSetBool("/sim/panel/visibility", false);
398 fgSetBool("/sim/panel/visibility", true);
400 fgReshape(fgGetInt("/sim/startup/xsize"),
401 fgGetInt("/sim/startup/ysize"));
404 void goodBye(puObject *)
406 // SG_LOG( SG_INPUT, SG_ALERT,
407 // "Program exiting normally at user request." );
408 cout << "Program exiting normally at user request." << endl;
410 #ifdef FG_NETWORK_OLK
411 if ( fgGetBool("/sim/networking/network-olk") ) {
412 if ( net_is_registered == 0 ) fgd_send_com( "8", FGFS_host);
416 // close all external I/O connections
417 globals->get_io()->shutdown_all();
423 void goAwayCb (puObject *me)
425 FG_POP_PUI_DIALOG( dialogBox );
428 void mkDialogInit (void)
430 // printf("mkDialogInit\n");
431 int x = (fgGetInt("/sim/startup/xsize")/2 - 400/2);
432 int y = (fgGetInt("/sim/startup/ysize")/2 - 100/2);
433 dialogBox = new puDialogBox (x, y); // 150, 50
435 dialogFrame = new puFrame (0,0,400,100);
436 dialogBoxMessage = new puText (10, 70);
437 dialogBoxMessage -> setLabel ("");
438 dialogBoxOkButton = new puOneShot (180, 10, 240, 50);
439 dialogBoxOkButton -> setLegend (gui_msg_OK);
440 dialogBoxOkButton -> makeReturnDefault (TRUE );
441 dialogBoxOkButton -> setCallback (goAwayCb);
443 FG_FINALIZE_PUI_DIALOG( dialogBox );
446 void MayBeGoodBye(puObject *)
451 void goAwayYesNoCb(puObject *me)
453 FG_POP_PUI_DIALOG( YNdialogBox);
456 void ConfirmExitDialogInit(void)
458 char msg[] = "Really Quit";
461 // printf("ConfirmExitDialogInit\n");
462 int len = 200 - puGetDefaultLabelFont().getStringWidth ( msg ) / 2;
464 int x = (fgGetInt("/sim/startup/xsize")/2 - 400/2);
465 int y = (fgGetInt("/sim/startup/ysize")/2 - 100/2);
467 YNdialogBox = new puDialogBox (x, y); // 150, 50
469 YNdialogFrame = new puFrame (0,0,400, 100);
471 YNdialogBoxMessage = new puText (len, 70);
472 YNdialogBoxMessage -> setDefaultValue (msg);
473 YNdialogBoxMessage -> getDefaultValue (&s);
474 YNdialogBoxMessage -> setLabel (s);
476 YNdialogBoxOkButton = new puOneShot (100, 10, 160, 50);
477 YNdialogBoxOkButton -> setLegend (gui_msg_OK);
478 YNdialogBoxOkButton -> makeReturnDefault (TRUE );
479 YNdialogBoxOkButton -> setCallback (goodBye);
481 YNdialogBoxNoButton = new puOneShot (240, 10, 300, 50);
482 YNdialogBoxNoButton -> setLegend (gui_msg_NO);
483 YNdialogBoxNoButton -> setCallback (goAwayYesNoCb);
485 FG_FINALIZE_PUI_DIALOG( YNdialogBox );
488 void notCb (puObject *)
490 mkDialog ("This function isn't implemented yet");
493 void helpCb (puObject *)
497 #if defined(FX) && !defined(WIN32)
498 # if defined(XMESA_FX_FULLSCREEN) && defined(XMESA_FX_WINDOW)
499 if ( globals->get_fullscreen() ) {
500 globals->set_fullscreen(false);
501 XMesaSetFXmode( XMESA_FX_WINDOW );
506 SGPath path( globals->get_fg_root() );
507 path.append( "Docs/index.html" );
511 string help_app = fgGetString("/sim/startup/browser-app");
513 if ( system("xwininfo -name Netscape > /dev/null 2>&1") == 0 ) {
514 command = help_app + " -remote \"openURL(" + path.str() + ")\"";
516 command = help_app + " " + path.str();
519 system( command.c_str() );
523 // Look for favorite browser
524 char Dummy[1024], ExecName[1024], browserParameter[1024];
525 char win32_name[1024];
527 cygwin32_conv_to_full_win32_path(path.c_str(),win32_name);
529 strcpy(win32_name,path.c_str());
532 FindExecutable(win32_name, Dummy, ExecName);
533 sprintf(browserParameter, "file:///%s", win32_name);
534 ShellExecute ( NULL, "open", ExecName, browserParameter, Dummy,
539 mkDialog ("Help started in your web browser window.");
542 #if defined( TR_HIRES_SNAP)
547 bool show_pu_cursor = false;
548 char *filename = new char [24];
549 static int count = 1;
551 static const SGPropertyNode *master_freeze
552 = fgGetNode("/sim/freeze/master");
554 bool freeze = master_freeze->getBoolValue();
556 fgSetBool("/sim/freeze/master", true);
559 if ( !puCursorIsHidden() ) {
560 show_pu_cursor = true;
565 fgReshape( fgGetInt("/sim/startup/xsize"),
566 fgGetInt("/sim/startup/ysize") );
568 // we need two render frames here to clear the menu and cursor
569 // ... not sure why but doing an extra fgRenderFrame() shouldn't
574 // Make sure we have SSG projection primed for current view
575 glMatrixMode(GL_MODELVIEW);
577 ssgSetCamera( (sgVec4 *)globals->get_current_view()->get_VIEW() );
578 ssgSetFOV( globals->get_current_view()->get_h_fov(),
579 globals->get_current_view()->get_v_fov() );
580 // ssgSetNearFar( 10.0f, 120000.0f );
581 ssgSetNearFar( 0.5f, 1200000.0f );
584 // This ImageSize stuff is a temporary hack
585 // should probably use 128x128 tile size and
586 // support any image size
588 // This should be a requester to get multiplier from user
590 int width = fgGetInt("/sim/startup/xsize");
591 int height = fgGetInt("/sim/startup/ysize");
593 /* allocate buffer large enough to store one tile */
594 GLubyte *tile = (GLubyte *)malloc(width * height * 3 * sizeof(GLubyte));
596 printf("Malloc of tile buffer failed!\n");
600 int imageWidth = multiplier*width;
601 int imageHeight = multiplier*height;
603 /* allocate buffer to hold a row of tiles */
605 = (GLubyte *)malloc(imageWidth * height * 3 * sizeof(GLubyte));
608 printf("Malloc of tile row buffer failed!\n");
611 TRcontext *tr = trNew();
612 trTileSize(tr, width, height, 0);
613 trTileBuffer(tr, GL_RGB, GL_UNSIGNED_BYTE, tile);
614 trImageSize(tr, imageWidth, imageHeight);
615 trRowOrder(tr, TR_TOP_TO_BOTTOM);
616 sgFrustum *frustum = ssgGetFrustum();
618 frustum->getLeft(), frustum->getRight(),
619 frustum->getBot(), frustum->getTop(),
620 frustum->getNear(), frustum->getFar());
622 /* Prepare ppm output file */
623 while (count < 1000) {
624 snprintf(filename, 24, "fgfs-screen-%03d.ppm", count++);
625 if ( (f = fopen(filename, "r")) == NULL )
629 f = fopen(filename, "wb");
631 printf("Couldn't open image file: %s\n", filename);
637 fprintf(f,"# ppm-file created by %s\n", "trdemo2");
638 fprintf(f,"%i %i\n", imageWidth, imageHeight);
641 /* just to be safe... */
642 glPixelStorei(GL_PACK_ALIGNMENT, 1);
644 /* Because the HUD and Panel change the ViewPort we will
645 * need to handle some lowlevel stuff ourselves */
646 int ncols = trGet(tr, TR_COLUMNS);
647 int nrows = trGet(tr, TR_ROWS);
649 bool do_hud = fgGetBool("/sim/hud/visibility");
650 GLfloat hud_col_step = 640.0 / ncols;
651 GLfloat hud_row_step = 480.0 / nrows;
653 bool do_panel = fgPanelVisible();
654 GLfloat panel_col_step = globals->get_current_panel()->getWidth() / ncols;
655 GLfloat panel_row_step = globals->get_current_panel()->getHeight() / nrows;
661 int curColumn = trGet(tr, TR_CURRENT_COLUMN);
662 int curRow = trGet(tr, TR_CURRENT_ROW);
665 fgUpdateHUD( curColumn*hud_col_step, curRow*hud_row_step,
666 (curColumn+1)*hud_col_step, (curRow+1)*hud_row_step );
668 globals->get_current_panel()->update(
669 curColumn*panel_col_step, panel_col_step,
670 curRow*panel_row_step, panel_row_step );
671 more = trEndTile(tr);
673 /* save tile into tile row buffer*/
674 int curTileWidth = trGet(tr, TR_CURRENT_TILE_WIDTH);
675 int bytesPerImageRow = imageWidth * 3*sizeof(GLubyte);
676 int bytesPerTileRow = (width) * 3*sizeof(GLubyte);
677 int xOffset = curColumn * bytesPerTileRow;
678 int bytesPerCurrentTileRow = (curTileWidth) * 3*sizeof(GLubyte);
680 for (i=0;i<height;i++) {
681 memcpy(buffer + i*bytesPerImageRow + xOffset, /* Dest */
682 tile + i*bytesPerTileRow, /* Src */
683 bytesPerCurrentTileRow); /* Byte count*/
686 if (curColumn == trGet(tr, TR_COLUMNS)-1) {
687 /* write this buffered row of tiles to the file */
688 int curTileHeight = trGet(tr, TR_CURRENT_TILE_HEIGHT);
689 int bytesPerImageRow = imageWidth * 3*sizeof(GLubyte);
691 for (i=0;i<curTileHeight;i++) {
692 /* Remember, OpenGL images are bottom to top. Have to reverse. */
693 GLubyte *rowPtr = buffer + (curTileHeight-1-i) * bytesPerImageRow;
694 fwrite(rowPtr, 1, imageWidth*3, f);
700 fgReshape( width, height );
706 message = "Snap shot saved to ";
708 mkDialog (message.c_str());
713 // message = "Snap shot saved to ";
714 // message += filename;
715 // mkDialog (message.c_str());
719 if ( show_pu_cursor ) {
724 fgSetBool("/sim/freeze/master", false);
727 #endif // #if defined( TR_HIRES_SNAP)
730 #if defined( WIN32 ) && !defined( __CYGWIN__) && !defined(__MINGW32__)
732 void rotateView( double roll, double pitch, double yaw )
738 GLubyte *hiResScreenCapture( int multiplier )
740 float oldfov = fgGetDouble("/sim/current-view/field-of-view");
741 float fov = oldfov / multiplier;
742 FGViewer *v = globals->get_current_view();
743 fgSetDouble("/sim/current-view/field-of-view", fov);
745 int cur_width = fgGetInt("/sim/startup/xsize");
746 int cur_height = fgGetInt("/sim/startup/ysize");
747 if (b1) delete( b1 );
748 // New empty (mostly) bitmap
749 b1 = new GlBitmap( GL_RGB, 1, 1, (unsigned char *)"123" );
751 for ( y = 0; y < multiplier; y++ ) {
752 for ( x = 0; x < multiplier; x++ ) {
753 fgReshape( cur_width, cur_height );
755 rotateView( 0, (y*fov)-((multiplier-1)*fov/2), (x*fov)-((multiplier-1)*fov/2) );
759 b1->copyBitmap( &b2, cur_width*x, cur_height*y );
762 fgSetDouble("/sim/current-view/field-of-view", oldfov);
763 return b1->getBitmap();
767 #if defined( WIN32 ) && !defined( __CYGWIN__) && !defined(__MINGW32__)
768 // win32 print screen function
769 void printScreen ( puObject *obj ) {
770 bool show_pu_cursor = false;
772 if ( !puCursorIsHidden() ) {
773 show_pu_cursor = true;
778 CGlPrinter p( CGlPrinter::PRINT_BITMAP );
779 int cur_width = fgGetInt("/sim/startup/xsize");
780 int cur_height = fgGetInt("/sim/startup/ysize");
781 p.Begin( "FlightGear", cur_width*3, cur_height*3 );
782 p.End( hiResScreenCapture(3) );
785 if ( show_pu_cursor ) {
790 #endif // #ifdef WIN32
793 void dumpSnapShot ( puObject *obj ) {
798 void dumpHiResSnapShot ( puObject *obj ) {
803 // do a screen snap shot
804 void fgDumpSnapShot () {
805 bool show_pu_cursor = false;
806 char *filename = new char [24];
808 static int count = 1;
810 static const SGPropertyNode *master_freeze
811 = fgGetNode("/sim/freeze/master");
813 bool freeze = master_freeze->getBoolValue();
815 fgSetBool("/sim/freeze/master", true);
819 if ( !puCursorIsHidden() ) {
820 show_pu_cursor = true;
825 fgReshape( fgGetInt("/sim/startup/xsize"),
826 fgGetInt("/sim/startup/ysize") );
828 // we need two render frames here to clear the menu and cursor
829 // ... not sure why but doing an extra fgRenderFrame() shouldn't
834 while (count < 1000) {
836 snprintf(filename, 24, "fgfs-screen-%03d.ppm", count++);
837 if ( (fp = fopen(filename, "r")) == NULL )
842 if ( sg_glDumpWindow( filename,
843 fgGetInt("/sim/startup/xsize"),
844 fgGetInt("/sim/startup/ysize")) ) {
845 message = "Snap shot saved to ";
848 message = "Failed to save to ";
852 mkDialog (message.c_str());
856 if ( show_pu_cursor ) {
863 fgSetBool("/sim/freeze/master", false);
867 #ifdef FG_NETWORK_OLK
868 void net_display_toggle( puObject *cb)
870 net_hud_display = (net_hud_display) ? 0 : 1;
871 printf("Toggle net_hud_display : %d\n", net_hud_display);
874 void net_register( puObject *cb)
876 fgd_send_com( "1", FGFS_host );
877 net_is_registered = 0;
878 printf("Registering to deamon\n");
881 void net_unregister( puObject *cb)
883 fgd_send_com( "8", FGFS_host );
884 net_is_registered = -1;
885 printf("Unregistering from deamon\n");
888 #endif // #ifdef FG_NETWORK_OLK