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
46 #if defined(FX) && defined(XMESA)
47 # include <GL/xmesa.h>
56 #include <simgear/constants.h>
57 #include <simgear/debug/logstream.hxx>
58 #include <simgear/misc/sg_path.hxx>
59 #include <simgear/screen/screen-dump.hxx>
61 #include <Include/general.hxx>
62 #include <Aircraft/aircraft.hxx>
63 #include <Airports/simple.hxx>
64 #include <Autopilot/auto_gui.hxx>
65 #include <Autopilot/newauto.hxx>
66 #include <Cockpit/panel.hxx>
67 #include <Controls/controls.hxx>
68 #include <FDM/flight.hxx>
69 #include <Main/fg_init.hxx>
70 #include <Main/fg_io.hxx>
71 #include <Main/globals.hxx>
72 #include <Main/fg_props.hxx>
73 #include <Main/viewmgr.hxx>
76 #include <NetworkOLK/network.h>
79 #if defined( WIN32 ) && !defined( __CYGWIN__ ) && !defined(__MINGW32__)
80 # include <simgear/screen/win32-printer.h>
81 # include <simgear/screen/GlBitmaps.h>
85 #include "gui_local.hxx"
86 #include "apt_dlg.hxx"
87 #include "net_dlg.hxx"
88 #include "sgVec3Slider.hxx"
89 #include "prop_picker.hxx"
93 #ifndef SG_HAVE_NATIVE_SGI_COMPILERS
97 // main.cxx hack, should come from an include someplace
98 extern void fgInitVisuals( void );
99 extern void fgReshape( int width, int height );
100 extern void fgRenderFrame( void );
102 extern FGInterface cur_view_fdm;
103 extern void fgHUDalphaAdjust( puObject * );
106 extern void fgLatLonFormatToggle( puObject *);
108 #ifdef FG_NETWORK_OLK
109 extern void net_fgd_scan(puObject *cb);
110 #endif // #ifdef FG_NETWORK_OLK
112 #if defined( TR_HIRES_SNAP)
113 #include <simgear/screen/tr.h>
114 extern void trRenderFrame( void );
115 extern void fgUpdateHUD( GLfloat x_start, GLfloat y_start,
116 GLfloat x_end, GLfloat y_end );
119 extern puMenuBar *mainMenuBar;
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 {"NewAirport", NewAirport},
171 #ifdef FG_NETWORK_OLK
172 {"net_display_toggle", net_display_toggle},
173 {"NewCallSign", NewCallSign},
174 {"net_fgd_scan", net_fgd_scan},
175 {"net_register", net_register},
176 {"net_unregister", net_unregister},
180 {"NewAltitude", NewAltitude},
181 {"AddWayPoint", AddWayPoint},
182 {"PopWayPoint", PopWayPoint},
183 {"ClearRoute", ClearRoute},
184 {"fgAPAdjust", fgAPAdjust},
185 {"fgLatLonFormatToggle", fgLatLonFormatToggle},
190 // Structure termination
195 /* ================ General Purpose Functions ================ */
197 void initDialog(void) {
198 // Initialize our GLOBAL GUI STRINGS
199 gui_msg_OK = msg_OK; // "OK"
200 gui_msg_NO = msg_NO; // "NO"
201 gui_msg_YES = msg_YES; // "YES"
202 gui_msg_CANCEL = msg_CANCEL; // "CANCEL"
203 gui_msg_RESET = msg_RESET; // "RESET"
206 // General Purpose Message Box
207 void mkDialog (const char *txt)
209 strncpy(global_dialog_string, txt, 256);
210 dialogBoxMessage->setLabel(global_dialog_string);
211 FG_PUSH_PUI_DIALOG( dialogBox );
214 // Message Box to report an error.
215 void guiErrorMessage (const char *txt)
217 SG_LOG(SG_GENERAL, SG_ALERT, txt);
222 // Message Box to report a throwable (usually an exception).
223 void guiErrorMessage (const char *txt, const sg_throwable &throwable)
227 msg += throwable.getFormattedMessage();
228 if (!throwable.getOrigin().empty()) {
229 msg += "\n (reported by ";
230 msg += throwable.getOrigin();
233 SG_LOG(SG_GENERAL, SG_ALERT, msg);
235 mkDialog(msg.c_str());
238 // Toggle the Menu and Mouse display state
239 void guiToggleMenu(void)
242 // printf("Hiding Menu\n");
243 mainMenuBar->hide ();
244 #if defined(WIN32_CURSOR_TWEAKS_OFF)
245 if( mouse_mode == MOUSE_POINTER )
247 #endif // WIN32_CURSOR_TWEAKS_OFF
249 // printf("Showing Menu\n");
250 mainMenuBar->reveal();
255 gui_menu_on = ~gui_menu_on;
258 // Intercept the Escape Key
259 void ConfirmExitDialog(void)
261 FG_PUSH_PUI_DIALOG( YNdialogBox );
266 /* -----------------------------------------------------------------------
267 the Gui callback functions
268 ____________________________________________________________________*/
271 // Hier Neu :-) This is my newly added code
272 // Added by David Findlay <nedz@bigpond.com>
273 // on Sunday 3rd of December
275 // Start new Save Dialog Box
276 puDialogBox *SaveDialog = 0;
277 puFrame *SaveDialogFrame = 0;
278 puText *SaveDialogMessage = 0;
279 puInput *SaveDialogInput = 0;
281 puOneShot *SaveDialogOkButton = 0;
282 puOneShot *SaveDialogCancelButton = 0;
283 // static puOneShot *SaveDialogResetButton = 0;
285 // Default save filename
286 char saveFile[256] = "fgfs.sav";
289 void SaveDialogCancel(puObject *) {
290 FG_POP_PUI_DIALOG( SaveDialog );
293 // If press OK do this
294 void SaveDialogOk(puObject*) {
296 FG_POP_PUI_DIALOG( SaveDialog );
299 SaveDialogInput->getValue(&s);
302 cout << saveFile << endl;
303 if (output.good() && fgSaveFlight(output)) {
305 mkDialog("Saved flight");
306 SG_LOG(SG_INPUT, SG_INFO, "Saved flight");
308 mkDialog("Cannot save flight");
309 SG_LOG(SG_INPUT, SG_ALERT, "Cannot save flight");
314 void saveFlight(puObject *cv) {
315 SaveDialog = new puDialogBox (150, 50);
317 SaveDialogFrame = new puFrame (0,0,350, 150);
319 = new puText( (150 - puGetDefaultLabelFont().getStringWidth( "File Name:" ) / 2), 110 );
320 SaveDialogMessage -> setLabel ("File Name:");
322 SaveDialogInput = new puInput (50, 70, 300, 100);
323 SaveDialogInput -> setValue (saveFile);
324 SaveDialogInput -> acceptInput();
326 SaveDialogOkButton = new puOneShot (50, 10, 110, 50);
327 SaveDialogOkButton -> setLegend (gui_msg_OK);
328 SaveDialogOkButton -> setCallback ( SaveDialogOk );
329 SaveDialogOkButton -> makeReturnDefault(TRUE);
331 SaveDialogCancelButton = new puOneShot (140, 10, 210, 50);
332 SaveDialogCancelButton -> setLegend (gui_msg_CANCEL);
333 SaveDialogCancelButton -> setCallback ( SaveDialogCancel );
335 FG_FINALIZE_PUI_DIALOG( SaveDialog );
337 SaveDialog -> reveal();
341 puDialogBox *LoadDialog = 0;
342 puFrame *LoadDialogFrame = 0;
343 puText *LoadDialogMessage = 0;
344 puInput *LoadDialogInput = 0;
346 puOneShot *LoadDialogOkButton = 0;
347 puOneShot *LoadDialogCancelButton = 0;
348 // static puOneShot *LoadDialogResetButton = 0;
350 // Default load filename
351 char loadFile[256] = "fgfs.sav";
353 // Do this if the person click okay
354 void LoadDialogOk(puObject *) {
356 FG_POP_PUI_DIALOG( LoadDialog );
359 LoadDialogInput->getValue(&l);
362 if (input.good() && fgLoadFlight(input)) {
364 mkDialog("Loaded flight");
365 SG_LOG(SG_INPUT, SG_INFO, "Restored flight");
367 mkDialog("Failed to load flight");
368 SG_LOG(SG_INPUT, SG_ALERT, "Cannot load flight");
372 // Do this if the person presses cancel
373 void LoadDialogCancel(puObject *) {
374 FG_POP_PUI_DIALOG( LoadDialog );
377 // Create Load Dialog
378 void loadFlight(puObject *cb)
380 LoadDialog = new puDialogBox (150, 50);
382 LoadDialogFrame = new puFrame (0,0,350, 150);
384 = new puText( (150 - puGetDefaultLabelFont().getStringWidth( "File Name:" ) / 2), 110 );
385 LoadDialogMessage -> setLabel ("File Name:");
387 LoadDialogInput = new puInput (50, 70, 300, 100);
388 LoadDialogInput -> setValue (loadFile);
389 LoadDialogInput -> acceptInput();
391 LoadDialogOkButton = new puOneShot (50, 10, 110, 50);
392 LoadDialogOkButton -> setLegend (gui_msg_OK);
393 LoadDialogOkButton -> setCallback ( LoadDialogOk );
394 LoadDialogOkButton -> makeReturnDefault(TRUE);
396 LoadDialogCancelButton = new puOneShot (140, 10, 210, 50);
397 LoadDialogCancelButton -> setLegend (gui_msg_CANCEL);
398 LoadDialogCancelButton -> setCallback ( LoadDialogCancel );
400 FG_FINALIZE_PUI_DIALOG( LoadDialog );
402 LoadDialog -> reveal();
405 // This is the accessor function
406 void guiTogglePanel(puObject *cb)
408 if (fgGetBool("/sim/panel/visibility"))
409 fgSetBool("/sim/panel/visibility", false);
411 fgSetBool("/sim/panel/visibility", true);
413 fgReshape(fgGetInt("/sim/startup/xsize"),
414 fgGetInt("/sim/startup/ysize"));
417 //void MenuHideMenuCb(puObject *cb)
418 void hideMenuCb (puObject *cb)
423 void goodBye(puObject *)
425 // SG_LOG( SG_INPUT, SG_ALERT,
426 // "Program exiting normally at user request." );
427 cout << "Program exiting normally at user request." << endl;
429 #ifdef FG_NETWORK_OLK
430 if ( fgGetBool("/sim/networking/network-olk") ) {
431 if ( net_is_registered == 0 ) fgd_send_com( "8", FGFS_host);
435 // close all external I/O connections
436 globals->get_io()->shutdown_all();
442 void goAwayCb (puObject *me)
444 FG_POP_PUI_DIALOG( dialogBox );
447 void mkDialogInit (void)
449 // printf("mkDialogInit\n");
450 int x = (fgGetInt("/sim/startup/xsize")/2 - 400/2);
451 int y = (fgGetInt("/sim/startup/ysize")/2 - 100/2);
452 dialogBox = new puDialogBox (x, y); // 150, 50
454 dialogFrame = new puFrame (0,0,400,100);
455 dialogBoxMessage = new puText (10, 70);
456 dialogBoxMessage -> setLabel ("");
457 dialogBoxOkButton = new puOneShot (180, 10, 240, 50);
458 dialogBoxOkButton -> setLegend (gui_msg_OK);
459 dialogBoxOkButton -> makeReturnDefault (TRUE );
460 dialogBoxOkButton -> setCallback (goAwayCb);
462 FG_FINALIZE_PUI_DIALOG( dialogBox );
465 void MayBeGoodBye(puObject *)
470 void goAwayYesNoCb(puObject *me)
472 FG_POP_PUI_DIALOG( YNdialogBox);
475 void ConfirmExitDialogInit(void)
477 char msg[] = "Really Quit";
480 // printf("ConfirmExitDialogInit\n");
481 int len = 200 - puGetDefaultLabelFont().getStringWidth ( msg ) / 2;
483 int x = (fgGetInt("/sim/startup/xsize")/2 - 400/2);
484 int y = (fgGetInt("/sim/startup/ysize")/2 - 100/2);
486 YNdialogBox = new puDialogBox (x, y); // 150, 50
488 YNdialogFrame = new puFrame (0,0,400, 100);
490 YNdialogBoxMessage = new puText (len, 70);
491 YNdialogBoxMessage -> setDefaultValue (msg);
492 YNdialogBoxMessage -> getDefaultValue (&s);
493 YNdialogBoxMessage -> setLabel (s);
495 YNdialogBoxOkButton = new puOneShot (100, 10, 160, 50);
496 YNdialogBoxOkButton -> setLegend (gui_msg_OK);
497 YNdialogBoxOkButton -> makeReturnDefault (TRUE );
498 YNdialogBoxOkButton -> setCallback (goodBye);
500 YNdialogBoxNoButton = new puOneShot (240, 10, 300, 50);
501 YNdialogBoxNoButton -> setLegend (gui_msg_NO);
502 YNdialogBoxNoButton -> setCallback (goAwayYesNoCb);
504 FG_FINALIZE_PUI_DIALOG( YNdialogBox );
507 void notCb (puObject *)
509 mkDialog ("This function isn't implemented yet");
512 void helpCb (puObject *)
516 #if defined(FX) && !defined(WIN32)
517 # if defined(XMESA_FX_FULLSCREEN) && defined(XMESA_FX_WINDOW)
518 if ( globals->get_fullscreen() ) {
519 globals->set_fullscreen(false);
520 XMesaSetFXmode( XMESA_FX_WINDOW );
525 SGPath path( globals->get_fg_root() );
526 path.append( "Docs/index.html" );
529 string help_app = fgGetString("/sim/startup/browser-app");
531 if ( system("xwininfo -name Netscape > /dev/null 2>&1") == 0 ) {
532 command = help_app + " -remote \"openURL(" + path.str() + ")\"";
534 command = help_app + " " + path.str();
539 command += path.str();
542 system( command.c_str() );
543 mkDialog ("Help started in your web browser window.");
546 #if defined( TR_HIRES_SNAP)
551 bool show_pu_cursor = false;
552 bool show_menu = false;
553 char *filename = new char [24];
554 static int count = 1;
556 static const SGPropertyNode *master_freeze
557 = fgGetNode("/sim/freeze/master");
559 bool freeze = master_freeze->getBoolValue();
561 fgSetBool("/sim/freeze/master", true);
569 if ( !puCursorIsHidden() ) {
570 show_pu_cursor = true;
575 fgReshape( fgGetInt("/sim/startup/xsize"),
576 fgGetInt("/sim/startup/ysize") );
578 // we need two render frames here to clear the menu and cursor
579 // ... not sure why but doing an extra fgRenderFrame() shouldn't
584 // Make sure we have SSG projection primed for current view
585 glMatrixMode(GL_MODELVIEW);
587 ssgSetCamera( (sgVec4 *)globals->get_current_view()->get_VIEW() );
588 ssgSetFOV( globals->get_current_view()->get_h_fov(),
589 globals->get_current_view()->get_v_fov() );
590 // ssgSetNearFar( 10.0f, 120000.0f );
591 ssgSetNearFar( 0.5f, 1200000.0f );
594 // This ImageSize stuff is a temporary hack
595 // should probably use 128x128 tile size and
596 // support any image size
598 // This should be a requester to get multiplier from user
600 int width = fgGetInt("/sim/startup/xsize");
601 int height = fgGetInt("/sim/startup/ysize");
603 /* allocate buffer large enough to store one tile */
604 GLubyte *tile = (GLubyte *)malloc(width * height * 3 * sizeof(GLubyte));
606 printf("Malloc of tile buffer failed!\n");
610 int imageWidth = multiplier*width;
611 int imageHeight = multiplier*height;
613 /* allocate buffer to hold a row of tiles */
615 = (GLubyte *)malloc(imageWidth * height * 3 * sizeof(GLubyte));
618 printf("Malloc of tile row buffer failed!\n");
621 TRcontext *tr = trNew();
622 trTileSize(tr, width, height, 0);
623 trTileBuffer(tr, GL_RGB, GL_UNSIGNED_BYTE, tile);
624 trImageSize(tr, imageWidth, imageHeight);
625 trRowOrder(tr, TR_TOP_TO_BOTTOM);
626 sgFrustum *frustum = ssgGetFrustum();
628 frustum->getLeft(), frustum->getRight(),
629 frustum->getBot(), frustum->getTop(),
630 frustum->getNear(), frustum->getFar());
632 /* Prepare ppm output file */
633 while (count < 1000) {
634 snprintf(filename, 24, "fgfs-screen-%03d.ppm", count++);
635 if ( (f = fopen(filename, "r")) == NULL )
639 f = fopen(filename, "wb");
641 printf("Couldn't open image file: %s\n", filename);
647 fprintf(f,"# ppm-file created by %s\n", "trdemo2");
648 fprintf(f,"%i %i\n", imageWidth, imageHeight);
651 /* just to be safe... */
652 glPixelStorei(GL_PACK_ALIGNMENT, 1);
654 /* Because the HUD and Panel change the ViewPort we will
655 * need to handle some lowlevel stuff ourselves */
656 int ncols = trGet(tr, TR_COLUMNS);
657 int nrows = trGet(tr, TR_ROWS);
659 bool do_hud = fgGetBool("/sim/hud/visibility");
660 GLfloat hud_col_step = 640.0 / ncols;
661 GLfloat hud_row_step = 480.0 / nrows;
663 bool do_panel = fgPanelVisible();
664 GLfloat panel_col_step = current_panel->getWidth() / ncols;
665 GLfloat panel_row_step = current_panel->getHeight() / nrows;
671 int curColumn = trGet(tr, TR_CURRENT_COLUMN);
672 int curRow = trGet(tr, TR_CURRENT_ROW);
675 fgUpdateHUD( curColumn*hud_col_step, curRow*hud_row_step,
676 (curColumn+1)*hud_col_step, (curRow+1)*hud_row_step );
678 current_panel->update( curColumn*panel_col_step, panel_col_step,
679 curRow*panel_row_step, panel_row_step );
680 more = trEndTile(tr);
682 /* save tile into tile row buffer*/
683 int curTileWidth = trGet(tr, TR_CURRENT_TILE_WIDTH);
684 int bytesPerImageRow = imageWidth * 3*sizeof(GLubyte);
685 int bytesPerTileRow = (width) * 3*sizeof(GLubyte);
686 int xOffset = curColumn * bytesPerTileRow;
687 int bytesPerCurrentTileRow = (curTileWidth) * 3*sizeof(GLubyte);
689 for (i=0;i<height;i++) {
690 memcpy(buffer + i*bytesPerImageRow + xOffset, /* Dest */
691 tile + i*bytesPerTileRow, /* Src */
692 bytesPerCurrentTileRow); /* Byte count*/
695 if (curColumn == trGet(tr, TR_COLUMNS)-1) {
696 /* write this buffered row of tiles to the file */
697 int curTileHeight = trGet(tr, TR_CURRENT_TILE_HEIGHT);
698 int bytesPerImageRow = imageWidth * 3*sizeof(GLubyte);
700 for (i=0;i<curTileHeight;i++) {
701 /* Remember, OpenGL images are bottom to top. Have to reverse. */
702 GLubyte *rowPtr = buffer + (curTileHeight-1-i) * bytesPerImageRow;
703 fwrite(rowPtr, 1, imageWidth*3, f);
709 fgReshape( width, height );
715 message = "Snap shot saved to ";
717 mkDialog (message.c_str());
722 // message = "Snap shot saved to ";
723 // message += filename;
724 // mkDialog (message.c_str());
731 if ( show_pu_cursor ) {
736 fgSetBool("/sim/freeze/master", false);
739 #endif // #if defined( TR_HIRES_SNAP)
742 #if defined( WIN32 ) && !defined( __CYGWIN__) && !defined(__MINGW32__)
744 void rotateView( double roll, double pitch, double yaw )
750 GLubyte *hiResScreenCapture( int multiplier )
752 float oldfov = fgGetDouble("/sim/current-view/field-of-view");
753 float fov = oldfov / multiplier;
754 FGViewer *v = globals->get_current_view();
755 fgSetDouble("/sim/current-view/field-of-view", fov);
757 int cur_width = fgGetInt("/sim/startup/xsize");
758 int cur_height = fgGetInt("/sim/startup/ysize");
759 if (b1) delete( b1 );
760 // New empty (mostly) bitmap
761 b1 = new GlBitmap( GL_RGB, 1, 1, (unsigned char *)"123" );
763 for ( y = 0; y < multiplier; y++ ) {
764 for ( x = 0; x < multiplier; x++ ) {
765 fgReshape( cur_width, cur_height );
767 rotateView( 0, (y*fov)-((multiplier-1)*fov/2), (x*fov)-((multiplier-1)*fov/2) );
771 b1->copyBitmap( &b2, cur_width*x, cur_height*y );
774 fgSetDouble("/sim/current-view/field-of-view", oldfov);
775 return b1->getBitmap();
779 #if defined( WIN32 ) && !defined( __CYGWIN__) && !defined(__MINGW32__)
780 // win32 print screen function
781 void printScreen ( puObject *obj ) {
782 bool show_pu_cursor = false;
784 if ( !puCursorIsHidden() ) {
785 show_pu_cursor = true;
791 CGlPrinter p( CGlPrinter::PRINT_BITMAP );
792 int cur_width = fgGetInt("/sim/startup/xsize");
793 int cur_height = fgGetInt("/sim/startup/ysize");
794 p.Begin( "FlightGear", cur_width*3, cur_height*3 );
795 p.End( hiResScreenCapture(3) );
798 mainMenuBar->reveal();
801 if ( show_pu_cursor ) {
806 #endif // #ifdef WIN32
809 void dumpSnapShot ( puObject *obj ) {
814 void dumpHiResSnapShot ( puObject *obj ) {
819 // do a screen snap shot
820 void fgDumpSnapShot () {
821 bool show_pu_cursor = false;
822 char *filename = new char [24];
824 static int count = 1;
826 static const SGPropertyNode *master_freeze
827 = fgGetNode("/sim/freeze/master");
829 bool freeze = master_freeze->getBoolValue();
831 fgSetBool("/sim/freeze/master", true);
836 if ( !puCursorIsHidden() ) {
837 show_pu_cursor = true;
842 fgReshape( fgGetInt("/sim/startup/xsize"),
843 fgGetInt("/sim/startup/ysize") );
845 // we need two render frames here to clear the menu and cursor
846 // ... not sure why but doing an extra fgRenderFrame() shouldn't
851 while (count < 1000) {
853 snprintf(filename, 24, "fgfs-screen-%03d.ppm", count++);
854 if ( (fp = fopen(filename, "r")) == NULL )
859 if ( sg_glDumpWindow( filename,
860 fgGetInt("/sim/startup/xsize"),
861 fgGetInt("/sim/startup/ysize")) ) {
862 message = "Snap shot saved to ";
865 message = "Failed to save to ";
869 mkDialog (message.c_str());
873 if ( show_pu_cursor ) {
879 mainMenuBar->reveal();
883 fgSetBool("/sim/freeze/master", false);
887 #ifdef FG_NETWORK_OLK
888 void net_display_toggle( puObject *cb)
890 net_hud_display = (net_hud_display) ? 0 : 1;
891 printf("Toggle net_hud_display : %d\n", net_hud_display);
894 void net_register( puObject *cb)
896 fgd_send_com( "1", FGFS_host );
897 net_is_registered = 0;
898 printf("Registering to deamon\n");
901 void net_unregister( puObject *cb)
903 fgd_send_com( "8", FGFS_host );
904 net_is_registered = -1;
905 printf("Unregistering from deamon\n");
908 #endif // #ifdef FG_NETWORK_OLK