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/main.hxx>
77 #include <Main/fg_init.hxx>
78 #include <Main/fg_io.hxx>
79 #include <Main/globals.hxx>
80 #include <Main/fg_props.hxx>
81 #include <Main/viewmgr.hxx>
84 #include <NetworkOLK/network.h>
87 #if defined( WIN32 ) && !defined( __CYGWIN__ ) && !defined(__MINGW32__)
88 # include <simgear/screen/win32-printer.h>
89 # include <simgear/screen/GlBitmaps.h>
93 #include "gui_local.hxx"
94 #include "net_dlg.hxx"
95 #include "preset_dlg.hxx"
96 #include "prop_picker.hxx"
97 #include "sgVec3Slider.hxx"
102 extern void fgHUDalphaAdjust( puObject * );
105 extern void fgLatLonFormatToggle( puObject *);
107 #ifdef FG_NETWORK_OLK
108 extern void net_fgd_scan(puObject *cb);
109 #endif // #ifdef FG_NETWORK_OLK
111 #if defined( TR_HIRES_SNAP)
112 #include <simgear/screen/tr.h>
113 extern void trRenderFrame( void );
114 extern void fgUpdateHUD( GLfloat x_start, GLfloat y_start,
115 GLfloat x_end, GLfloat y_end );
118 puDialogBox *dialogBox = 0;
119 puFrame *dialogFrame = 0;
120 puText *dialogBoxMessage = 0;
121 puOneShot *dialogBoxOkButton = 0;
123 puDialogBox *YNdialogBox = 0;
124 puFrame *YNdialogFrame = 0;
125 puText *YNdialogBoxMessage = 0;
126 puOneShot *YNdialogBoxOkButton = 0;
127 puOneShot *YNdialogBoxNoButton = 0;
129 char *gui_msg_OK; // "OK"
130 char *gui_msg_NO; // "NO"
131 char *gui_msg_YES; // "YES"
132 char *gui_msg_CANCEL; // "CANCEL"
133 char *gui_msg_RESET; // "RESET"
135 char msg_OK[] = "OK";
136 char msg_NO[] = "NO";
137 char msg_YES[] = "YES";
138 char msg_CANCEL[] = "Cancel";
139 char msg_RESET[] = "Reset";
141 char global_dialog_string[256];
143 const __fg_gui_fn_t __fg_gui_fn[] = {
146 {"saveFlight", saveFlight},
147 {"loadFlight", loadFlight},
150 {"dumpHiResSnapShot", dumpHiResSnapShot},
152 {"dumpSnapShot", dumpSnapShot},
153 #if defined( WIN32 ) && !defined( __CYGWIN__) && !defined(__MINGW32__)
154 {"printScreen", printScreen},
156 {"MayBeGoodBye", MayBeGoodBye},
159 {"guiTogglePanel", guiTogglePanel},
160 {"PilotOffsetAdjust", PilotOffsetAdjust},
161 {"fgHUDalphaAdjust", fgHUDalphaAdjust},
162 {"prop_pickerView", prop_pickerView},
165 {"fgPresetAirport", fgPresetAirport},
166 {"fgPresetRunway", fgPresetRunway},
167 {"fgPresetOffsetDistance", fgPresetOffsetDistance},
168 {"fgPresetAltitude", fgPresetAltitude},
169 {"fgPresetGlideslope", fgPresetGlideslope},
170 {"fgPresetAirspeed", fgPresetAirspeed},
171 {"fgPresetCommit", fgPresetCommit},
174 #ifdef FG_NETWORK_OLK
175 {"net_display_toggle", net_display_toggle},
176 {"NewCallSign", NewCallSign},
177 {"net_fgd_scan", net_fgd_scan},
178 {"net_register", net_register},
179 {"net_unregister", net_unregister},
183 {"NewAltitude", NewAltitude},
184 {"NewHeading", NewHeading},
185 {"AddWayPoint", AddWayPoint},
186 {"PopWayPoint", PopWayPoint},
187 {"ClearRoute", ClearRoute},
188 {"fgAPAdjust", fgAPAdjust},
189 {"fgLatLonFormatToggle", fgLatLonFormatToggle},
194 // Structure termination
199 /* ================ General Purpose Functions ================ */
201 void initDialog(void) {
202 // Initialize our GLOBAL GUI STRINGS
203 gui_msg_OK = msg_OK; // "OK"
204 gui_msg_NO = msg_NO; // "NO"
205 gui_msg_YES = msg_YES; // "YES"
206 gui_msg_CANCEL = msg_CANCEL; // "CANCEL"
207 gui_msg_RESET = msg_RESET; // "RESET"
210 // General Purpose Message Box
211 void mkDialog (const char *txt)
213 strncpy(global_dialog_string, txt, 256);
214 dialogBoxMessage->setLabel(global_dialog_string);
215 FG_PUSH_PUI_DIALOG( dialogBox );
218 // Message Box to report an error.
219 void guiErrorMessage (const char *txt)
221 SG_LOG(SG_GENERAL, SG_ALERT, txt);
226 // Message Box to report a throwable (usually an exception).
227 void guiErrorMessage (const char *txt, const sg_throwable &throwable)
231 msg += throwable.getFormattedMessage();
232 if (!throwable.getOrigin().empty()) {
233 msg += "\n (reported by ";
234 msg += throwable.getOrigin();
237 SG_LOG(SG_GENERAL, SG_ALERT, msg);
239 mkDialog(msg.c_str());
242 // Intercept the Escape Key
243 void ConfirmExitDialog(void)
245 FG_PUSH_PUI_DIALOG( YNdialogBox );
250 /* -----------------------------------------------------------------------
251 the Gui callback functions
252 ____________________________________________________________________*/
255 // Hier Neu :-) This is my newly added code
256 // Added by David Findlay <nedz@bigpond.com>
257 // on Sunday 3rd of December
259 // Start new Save Dialog Box
260 puDialogBox *SaveDialog = 0;
261 puFrame *SaveDialogFrame = 0;
262 puText *SaveDialogMessage = 0;
263 puInput *SaveDialogInput = 0;
265 puOneShot *SaveDialogOkButton = 0;
266 puOneShot *SaveDialogCancelButton = 0;
267 // static puOneShot *SaveDialogResetButton = 0;
269 // Default save filename
270 char saveFile[256] = "fgfs.sav";
273 void SaveDialogCancel(puObject *) {
274 FG_POP_PUI_DIALOG( SaveDialog );
277 // If press OK do this
278 void SaveDialogOk(puObject*) {
280 FG_POP_PUI_DIALOG( SaveDialog );
283 SaveDialogInput->getValue(&s);
286 // cout << saveFile << endl;
287 if (output.good() && fgSaveFlight(output)) {
289 mkDialog("Saved flight");
290 SG_LOG(SG_INPUT, SG_INFO, "Saved flight");
292 mkDialog("Cannot save flight");
293 SG_LOG(SG_INPUT, SG_ALERT, "Cannot save flight");
298 void saveFlight(puObject *cv) {
299 SaveDialog = new puDialogBox (150, 50);
301 SaveDialogFrame = new puFrame (0,0,350, 150);
303 = new puText( (150 - puGetDefaultLabelFont().getStringWidth( "File Name:" ) / 2), 110 );
304 SaveDialogMessage -> setLabel ("File Name:");
306 SaveDialogInput = new puInput (50, 70, 300, 100);
307 SaveDialogInput -> setValue (saveFile);
308 SaveDialogInput -> acceptInput();
310 SaveDialogOkButton = new puOneShot (50, 10, 110, 50);
311 SaveDialogOkButton -> setLegend (gui_msg_OK);
312 SaveDialogOkButton -> setCallback ( SaveDialogOk );
313 SaveDialogOkButton -> makeReturnDefault(TRUE);
315 SaveDialogCancelButton = new puOneShot (140, 10, 210, 50);
316 SaveDialogCancelButton -> setLegend (gui_msg_CANCEL);
317 SaveDialogCancelButton -> setCallback ( SaveDialogCancel );
319 FG_FINALIZE_PUI_DIALOG( SaveDialog );
321 SaveDialog -> reveal();
325 puDialogBox *LoadDialog = 0;
326 puFrame *LoadDialogFrame = 0;
327 puText *LoadDialogMessage = 0;
328 puInput *LoadDialogInput = 0;
330 puOneShot *LoadDialogOkButton = 0;
331 puOneShot *LoadDialogCancelButton = 0;
332 // static puOneShot *LoadDialogResetButton = 0;
334 // Default load filename
335 char loadFile[256] = "fgfs.sav";
337 // Do this if the person click okay
338 void LoadDialogOk(puObject *) {
340 FG_POP_PUI_DIALOG( LoadDialog );
343 LoadDialogInput->getValue(&l);
346 if (input.good() && fgLoadFlight(input)) {
348 mkDialog("Loaded flight");
349 SG_LOG(SG_INPUT, SG_INFO, "Restored flight");
351 mkDialog("Failed to load flight");
352 SG_LOG(SG_INPUT, SG_ALERT, "Cannot load flight");
356 // Do this if the person presses cancel
357 void LoadDialogCancel(puObject *) {
358 FG_POP_PUI_DIALOG( LoadDialog );
361 // Create Load Dialog
362 void loadFlight(puObject *cb)
364 LoadDialog = new puDialogBox (150, 50);
366 LoadDialogFrame = new puFrame (0,0,350, 150);
368 = new puText( (150 - puGetDefaultLabelFont().getStringWidth( "File Name:" ) / 2), 110 );
369 LoadDialogMessage -> setLabel ("File Name:");
371 LoadDialogInput = new puInput (50, 70, 300, 100);
372 LoadDialogInput -> setValue (loadFile);
373 LoadDialogInput -> acceptInput();
375 LoadDialogOkButton = new puOneShot (50, 10, 110, 50);
376 LoadDialogOkButton -> setLegend (gui_msg_OK);
377 LoadDialogOkButton -> setCallback ( LoadDialogOk );
378 LoadDialogOkButton -> makeReturnDefault(TRUE);
380 LoadDialogCancelButton = new puOneShot (140, 10, 210, 50);
381 LoadDialogCancelButton -> setLegend (gui_msg_CANCEL);
382 LoadDialogCancelButton -> setCallback ( LoadDialogCancel );
384 FG_FINALIZE_PUI_DIALOG( LoadDialog );
386 LoadDialog -> reveal();
389 // This is the accessor function
390 void guiTogglePanel(puObject *cb)
392 if (fgGetBool("/sim/panel/visibility"))
393 fgSetBool("/sim/panel/visibility", false);
395 fgSetBool("/sim/panel/visibility", true);
397 fgReshape(fgGetInt("/sim/startup/xsize"),
398 fgGetInt("/sim/startup/ysize"));
401 void goodBye(puObject *)
403 // SG_LOG( SG_INPUT, SG_ALERT,
404 // "Program exiting normally at user request." );
405 cout << "Program exiting normally at user request." << endl;
407 #ifdef FG_NETWORK_OLK
408 if ( fgGetBool("/sim/networking/network-olk") ) {
409 if ( net_is_registered == 0 ) fgd_send_com( "8", FGFS_host);
413 // close all external I/O connections
414 globals->get_io()->shutdown_all();
420 void goAwayCb (puObject *me)
422 FG_POP_PUI_DIALOG( dialogBox );
425 void mkDialogInit (void)
427 // printf("mkDialogInit\n");
428 int x = (fgGetInt("/sim/startup/xsize")/2 - 400/2);
429 int y = (fgGetInt("/sim/startup/ysize")/2 - 100/2);
430 dialogBox = new puDialogBox (x, y); // 150, 50
432 dialogFrame = new puFrame (0,0,400,100);
433 dialogBoxMessage = new puText (10, 70);
434 dialogBoxMessage -> setLabel ("");
435 dialogBoxOkButton = new puOneShot (180, 10, 240, 50);
436 dialogBoxOkButton -> setLegend (gui_msg_OK);
437 dialogBoxOkButton -> makeReturnDefault (TRUE );
438 dialogBoxOkButton -> setCallback (goAwayCb);
440 FG_FINALIZE_PUI_DIALOG( dialogBox );
443 void MayBeGoodBye(puObject *)
448 void goAwayYesNoCb(puObject *me)
450 FG_POP_PUI_DIALOG( YNdialogBox);
453 void ConfirmExitDialogInit(void)
455 char msg[] = "Really Quit";
458 // printf("ConfirmExitDialogInit\n");
459 int len = 200 - puGetDefaultLabelFont().getStringWidth ( msg ) / 2;
461 int x = (fgGetInt("/sim/startup/xsize")/2 - 400/2);
462 int y = (fgGetInt("/sim/startup/ysize")/2 - 100/2);
464 YNdialogBox = new puDialogBox (x, y); // 150, 50
466 YNdialogFrame = new puFrame (0,0,400, 100);
468 YNdialogBoxMessage = new puText (len, 70);
469 YNdialogBoxMessage -> setDefaultValue (msg);
470 YNdialogBoxMessage -> getDefaultValue (&s);
471 YNdialogBoxMessage -> setLabel (s);
473 YNdialogBoxOkButton = new puOneShot (100, 10, 160, 50);
474 YNdialogBoxOkButton -> setLegend (gui_msg_OK);
475 YNdialogBoxOkButton -> makeReturnDefault (TRUE );
476 YNdialogBoxOkButton -> setCallback (goodBye);
478 YNdialogBoxNoButton = new puOneShot (240, 10, 300, 50);
479 YNdialogBoxNoButton -> setLegend (gui_msg_NO);
480 YNdialogBoxNoButton -> setCallback (goAwayYesNoCb);
482 FG_FINALIZE_PUI_DIALOG( YNdialogBox );
485 void notCb (puObject *)
487 mkDialog ("This function isn't implemented yet");
490 void helpCb (puObject *)
494 #if defined(FX) && !defined(WIN32)
495 # if defined(XMESA_FX_FULLSCREEN) && defined(XMESA_FX_WINDOW)
496 if ( globals->get_fullscreen() ) {
497 globals->set_fullscreen(false);
498 XMesaSetFXmode( XMESA_FX_WINDOW );
503 SGPath path( globals->get_fg_root() );
504 path.append( "Docs/index.html" );
508 string help_app = fgGetString("/sim/startup/browser-app");
510 if ( system("xwininfo -name Netscape > /dev/null 2>&1") == 0 ) {
511 command = help_app + " -remote \"openURL(" + path.str() + ")\"";
513 command = help_app + " " + path.str();
516 system( command.c_str() );
520 // Look for favorite browser
521 char Dummy[1024], ExecName[1024], browserParameter[1024];
522 char win32_name[1024];
524 cygwin32_conv_to_full_win32_path(path.c_str(),win32_name);
526 strcpy(win32_name,path.c_str());
529 FindExecutable(win32_name, Dummy, ExecName);
530 sprintf(browserParameter, "file:///%s", win32_name);
531 ShellExecute ( NULL, "open", ExecName, browserParameter, Dummy,
536 mkDialog ("Help started in your web browser window.");
539 #if defined( TR_HIRES_SNAP)
544 bool show_pu_cursor = false;
545 char *filename = new char [24];
546 static int count = 1;
548 static const SGPropertyNode *master_freeze
549 = fgGetNode("/sim/freeze/master");
551 bool freeze = master_freeze->getBoolValue();
553 fgSetBool("/sim/freeze/master", true);
556 if ( !puCursorIsHidden() ) {
557 show_pu_cursor = true;
562 fgReshape( fgGetInt("/sim/startup/xsize"),
563 fgGetInt("/sim/startup/ysize") );
565 // we need two render frames here to clear the menu and cursor
566 // ... not sure why but doing an extra fgRenderFrame() shouldn't
571 // Make sure we have SSG projection primed for current view
572 glMatrixMode(GL_MODELVIEW);
574 ssgSetCamera( (sgVec4 *)globals->get_current_view()->get_VIEW() );
575 ssgSetFOV( globals->get_current_view()->get_h_fov(),
576 globals->get_current_view()->get_v_fov() );
577 // ssgSetNearFar( 10.0f, 120000.0f );
578 ssgSetNearFar( 0.5f, 1200000.0f );
581 // This ImageSize stuff is a temporary hack
582 // should probably use 128x128 tile size and
583 // support any image size
585 // This should be a requester to get multiplier from user
587 int width = fgGetInt("/sim/startup/xsize");
588 int height = fgGetInt("/sim/startup/ysize");
590 /* allocate buffer large enough to store one tile */
591 GLubyte *tile = (GLubyte *)malloc(width * height * 3 * sizeof(GLubyte));
593 printf("Malloc of tile buffer failed!\n");
597 int imageWidth = multiplier*width;
598 int imageHeight = multiplier*height;
600 /* allocate buffer to hold a row of tiles */
602 = (GLubyte *)malloc(imageWidth * height * 3 * sizeof(GLubyte));
605 printf("Malloc of tile row buffer failed!\n");
608 TRcontext *tr = trNew();
609 trTileSize(tr, width, height, 0);
610 trTileBuffer(tr, GL_RGB, GL_UNSIGNED_BYTE, tile);
611 trImageSize(tr, imageWidth, imageHeight);
612 trRowOrder(tr, TR_TOP_TO_BOTTOM);
613 sgFrustum *frustum = ssgGetFrustum();
615 frustum->getLeft(), frustum->getRight(),
616 frustum->getBot(), frustum->getTop(),
617 frustum->getNear(), frustum->getFar());
619 /* Prepare ppm output file */
620 while (count < 1000) {
621 snprintf(filename, 24, "fgfs-screen-%03d.ppm", count++);
622 if ( (f = fopen(filename, "r")) == NULL )
626 f = fopen(filename, "wb");
628 printf("Couldn't open image file: %s\n", filename);
634 fprintf(f,"# ppm-file created by %s\n", "trdemo2");
635 fprintf(f,"%i %i\n", imageWidth, imageHeight);
638 /* just to be safe... */
639 glPixelStorei(GL_PACK_ALIGNMENT, 1);
641 /* Because the HUD and Panel change the ViewPort we will
642 * need to handle some lowlevel stuff ourselves */
643 int ncols = trGet(tr, TR_COLUMNS);
644 int nrows = trGet(tr, TR_ROWS);
646 bool do_hud = fgGetBool("/sim/hud/visibility");
647 GLfloat hud_col_step = 640.0 / ncols;
648 GLfloat hud_row_step = 480.0 / nrows;
650 bool do_panel = fgPanelVisible();
651 GLfloat panel_col_step = globals->get_current_panel()->getWidth() / ncols;
652 GLfloat panel_row_step = globals->get_current_panel()->getHeight() / nrows;
658 int curColumn = trGet(tr, TR_CURRENT_COLUMN);
659 int curRow = trGet(tr, TR_CURRENT_ROW);
662 fgUpdateHUD( curColumn*hud_col_step, curRow*hud_row_step,
663 (curColumn+1)*hud_col_step, (curRow+1)*hud_row_step );
665 globals->get_current_panel()->update(
666 curColumn*panel_col_step, panel_col_step,
667 curRow*panel_row_step, panel_row_step );
668 more = trEndTile(tr);
670 /* save tile into tile row buffer*/
671 int curTileWidth = trGet(tr, TR_CURRENT_TILE_WIDTH);
672 int bytesPerImageRow = imageWidth * 3*sizeof(GLubyte);
673 int bytesPerTileRow = (width) * 3*sizeof(GLubyte);
674 int xOffset = curColumn * bytesPerTileRow;
675 int bytesPerCurrentTileRow = (curTileWidth) * 3*sizeof(GLubyte);
677 for (i=0;i<height;i++) {
678 memcpy(buffer + i*bytesPerImageRow + xOffset, /* Dest */
679 tile + i*bytesPerTileRow, /* Src */
680 bytesPerCurrentTileRow); /* Byte count*/
683 if (curColumn == trGet(tr, TR_COLUMNS)-1) {
684 /* write this buffered row of tiles to the file */
685 int curTileHeight = trGet(tr, TR_CURRENT_TILE_HEIGHT);
686 int bytesPerImageRow = imageWidth * 3*sizeof(GLubyte);
688 for (i=0;i<curTileHeight;i++) {
689 /* Remember, OpenGL images are bottom to top. Have to reverse. */
690 GLubyte *rowPtr = buffer + (curTileHeight-1-i) * bytesPerImageRow;
691 fwrite(rowPtr, 1, imageWidth*3, f);
697 fgReshape( width, height );
703 message = "Snap shot saved to ";
705 mkDialog (message.c_str());
710 // message = "Snap shot saved to ";
711 // message += filename;
712 // mkDialog (message.c_str());
716 if ( show_pu_cursor ) {
721 fgSetBool("/sim/freeze/master", false);
724 #endif // #if defined( TR_HIRES_SNAP)
727 #if defined( WIN32 ) && !defined( __CYGWIN__) && !defined(__MINGW32__)
729 void rotateView( double roll, double pitch, double yaw )
735 GLubyte *hiResScreenCapture( int multiplier )
737 float oldfov = fgGetDouble("/sim/current-view/field-of-view");
738 float fov = oldfov / multiplier;
739 FGViewer *v = globals->get_current_view();
740 fgSetDouble("/sim/current-view/field-of-view", fov);
742 int cur_width = fgGetInt("/sim/startup/xsize");
743 int cur_height = fgGetInt("/sim/startup/ysize");
744 if (b1) delete( b1 );
745 // New empty (mostly) bitmap
746 b1 = new GlBitmap( GL_RGB, 1, 1, (unsigned char *)"123" );
748 for ( y = 0; y < multiplier; y++ ) {
749 for ( x = 0; x < multiplier; x++ ) {
750 fgReshape( cur_width, cur_height );
752 rotateView( 0, (y*fov)-((multiplier-1)*fov/2), (x*fov)-((multiplier-1)*fov/2) );
756 b1->copyBitmap( &b2, cur_width*x, cur_height*y );
759 fgSetDouble("/sim/current-view/field-of-view", oldfov);
760 return b1->getBitmap();
764 #if defined( WIN32 ) && !defined( __CYGWIN__) && !defined(__MINGW32__)
765 // win32 print screen function
766 void printScreen ( puObject *obj ) {
767 bool show_pu_cursor = false;
769 if ( !puCursorIsHidden() ) {
770 show_pu_cursor = true;
775 CGlPrinter p( CGlPrinter::PRINT_BITMAP );
776 int cur_width = fgGetInt("/sim/startup/xsize");
777 int cur_height = fgGetInt("/sim/startup/ysize");
778 p.Begin( "FlightGear", cur_width*3, cur_height*3 );
779 p.End( hiResScreenCapture(3) );
782 if ( show_pu_cursor ) {
787 #endif // #ifdef WIN32
790 void dumpSnapShot ( puObject *obj ) {
795 void dumpHiResSnapShot ( puObject *obj ) {
800 // do a screen snap shot
801 void fgDumpSnapShot () {
802 bool show_pu_cursor = false;
803 char *filename = new char [24];
805 static int count = 1;
807 static const SGPropertyNode *master_freeze
808 = fgGetNode("/sim/freeze/master");
810 bool freeze = master_freeze->getBoolValue();
812 fgSetBool("/sim/freeze/master", true);
816 if ( !puCursorIsHidden() ) {
817 show_pu_cursor = true;
822 fgReshape( fgGetInt("/sim/startup/xsize"),
823 fgGetInt("/sim/startup/ysize") );
825 // we need two render frames here to clear the menu and cursor
826 // ... not sure why but doing an extra fgRenderFrame() shouldn't
831 while (count < 1000) {
833 snprintf(filename, 24, "fgfs-screen-%03d.ppm", count++);
834 if ( (fp = fopen(filename, "r")) == NULL )
839 if ( sg_glDumpWindow( filename,
840 fgGetInt("/sim/startup/xsize"),
841 fgGetInt("/sim/startup/ysize")) ) {
842 message = "Snap shot saved to ";
845 message = "Failed to save to ";
849 mkDialog (message.c_str());
853 if ( show_pu_cursor ) {
860 fgSetBool("/sim/freeze/master", false);
864 #ifdef FG_NETWORK_OLK
865 void net_display_toggle( puObject *cb)
867 net_hud_display = (net_hud_display) ? 0 : 1;
868 printf("Toggle net_hud_display : %d\n", net_hud_display);
871 void net_register( puObject *cb)
873 fgd_send_com( "1", FGFS_host );
874 net_is_registered = 0;
875 printf("Registering to deamon\n");
878 void net_unregister( puObject *cb)
880 fgd_send_com( "8", FGFS_host );
881 net_is_registered = -1;
882 printf("Unregistering from deamon\n");
885 #endif // #ifdef FG_NETWORK_OLK