]> git.mxchange.org Git - flightgear.git/commitdiff
Added screen dumping and screen printing (win32) functionality.
authorcurt <curt>
Thu, 14 Oct 1999 23:46:28 +0000 (23:46 +0000)
committercurt <curt>
Thu, 14 Oct 1999 23:46:28 +0000 (23:46 +0000)
src/GUI/gui.cxx
src/Main/Makefile.am
src/Main/main.cxx

index cdce52314233c5eb54cb96b2b08cc6f4305b0009..6acecfdaa613d5df116b73c47f5c60a25b9c95ed 100644 (file)
 #include <Main/views.hxx>
 #include <Misc/fgpath.hxx>
 #include <Network/network.h>
+#include <Screen/screen-dump.hxx>
 #include <Time/fg_time.hxx>
 
+#ifdef WIN32
+#  include <Screen/win32-printer.h>
+#endif
+
 #include "gui.h"
 
 FG_USING_STD(string);
@@ -71,6 +76,11 @@ FG_USING_STD(string);
 FG_USING_STD(cout);
 #endif
 
+// hack, should come from an include someplace
+extern void fgInitVisuals( void );
+extern void fgReshape( int width, int height );
+extern void fgRenderFrame( void );
+
 puFont guiFnt = 0;
 fntTexFont *guiFntHandle = 0;
 
@@ -539,6 +549,73 @@ void helpCb (puObject *)
     mkDialog ("Help started in netscape window.");
 }
 
+
+
+#ifdef WIN32
+// win32 print screen function
+void printScreen ( puObject *obj ) {
+    bool show_pu_cursor = false;
+    TurnCursorOff();
+    if ( !puCursorIsHidden() ) {
+       show_pu_cursor = true;
+       puHideCursor();
+    }
+    BusyCursor( 0 );
+    mainMenuBar->hide();
+
+    CGlPrinter p;
+    p.Begin( "FlightGear" );
+    fgInitVisuals();
+    fgReshape( p.GetHorzRes(), p.GetVertRes() );
+    fgRenderFrame();
+    p.End();
+
+    if( menu_on ) {
+       mainMenuBar->reveal();
+    }
+    BusyCursor(1);
+    if ( show_pu_cursor ) {
+       puShowCursor();
+    }
+    TurnCursorOn();
+}
+#endif // #ifdef WIN32
+
+
+// do a screen dump
+void dumpScreen ( puObject *obj ) {
+    bool show_pu_cursor = false;
+
+    mainMenuBar->hide();
+    TurnCursorOff();
+    if ( !puCursorIsHidden() ) {
+       show_pu_cursor = true;
+       puHideCursor();
+    }
+
+    fgInitVisuals();
+    fgReshape( current_options.get_xsize(), current_options.get_ysize() );
+    fgRenderFrame();
+    fgRenderFrame();
+
+    my_glDumpWindow( "fgfs-screen.ppm", 
+                    current_options.get_xsize(), 
+                    current_options.get_ysize() );
+    
+    mkDialog ("Screen dump saved to fgfs-screen.ppm");
+
+    if ( show_pu_cursor ) {
+       puShowCursor();
+    }
+
+    TurnCursorOn();
+    if( menu_on ) {
+       mainMenuBar->reveal();
+    }
+
+}
+
+
 /// The beginnings of teleportation :-)
 //  Needs cleaning up but works
 //  These statics should disapear when this is a class
@@ -750,11 +827,22 @@ static void net_blaster_toggle( puObject *cb)
 The menu stuff 
 ---------------------------------------------------------------------*/
 char *fileSubmenu               [] = {
-    "Exit", /* "Close", "---------", "Print", "---------", "Save", */ 
+    "Exit", /* "Close", "---------", */
+#ifdef WIN32
+    "Print",
+#endif
+    "Screen Dump",
+    /* "---------", "Save", */ 
     "Reset", NULL
 };
 puCallback fileSubmenuCb        [] = {
-    MayBeGoodBye, /* hideMenuCb, NULL, notCb, NULL, notCb, */ reInit, NULL
+    MayBeGoodBye, /* hideMenuCb, NULL, */
+#ifdef WIN32
+    printScreen, 
+#endif
+    /* NULL, notCb, */
+    dumpScreen,
+    reInit, NULL
 };
 
 /*
index 874dcee0c969d31e038d64d68901e3a2c5f69e26..72acdb50000057492822710a88ae27f6002e1b81 100644 (file)
@@ -48,6 +48,7 @@ fgfs_LDADD = \
        $(WEATHER_LIBS) \
        $(top_builddir)/Simulator/Joystick/libJoystick.a \
        $(SERIAL_LIBS) \
+       $(top_builddir)/Lib/Screen/libScreen.a \
        $(top_builddir)/Lib/Math/libMath.a \
        $(top_builddir)/Lib/Bucket/libBucket.a \
        $(top_builddir)/Lib/Voronoi/libVoronoi.a \
index 28a4f031cb6064904ba5518d4235aa0dd3903cad..f9c5922a85fa22200aee4a7cacccb299ea19bda4 100644 (file)
@@ -175,7 +175,7 @@ sgMat4 copy_of_ssgOpenGLAxisSwapMatrix =
 
 
 // fgInitVisuals() -- Initialize various GL/view parameters
-static void fgInitVisuals( void ) {
+void fgInitVisuals( void ) {
     fgLIGHT *l;
 
     l = &cur_light_params;
@@ -224,7 +224,7 @@ static void fgInitVisuals( void ) {
 
 
 // Update all Visuals (redraws anything graphics related)
-static void fgRenderFrame( void ) {
+void fgRenderFrame( void ) {
     fgLIGHT *l = &cur_light_params;
     FGTime *t = FGTime::cur_time_params;
     // FGView *v = &current_view;