Added screen dumping and screen printing (win32) functionality.
This commit is contained in:
parent
eddea671a2
commit
c866ba581d
3 changed files with 93 additions and 4 deletions
|
@ -61,8 +61,13 @@
|
||||||
#include <Main/views.hxx>
|
#include <Main/views.hxx>
|
||||||
#include <Misc/fgpath.hxx>
|
#include <Misc/fgpath.hxx>
|
||||||
#include <Network/network.h>
|
#include <Network/network.h>
|
||||||
|
#include <Screen/screen-dump.hxx>
|
||||||
#include <Time/fg_time.hxx>
|
#include <Time/fg_time.hxx>
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
# include <Screen/win32-printer.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
|
|
||||||
FG_USING_STD(string);
|
FG_USING_STD(string);
|
||||||
|
@ -71,6 +76,11 @@ FG_USING_STD(string);
|
||||||
FG_USING_STD(cout);
|
FG_USING_STD(cout);
|
||||||
#endif
|
#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;
|
puFont guiFnt = 0;
|
||||||
fntTexFont *guiFntHandle = 0;
|
fntTexFont *guiFntHandle = 0;
|
||||||
|
|
||||||
|
@ -539,6 +549,73 @@ void helpCb (puObject *)
|
||||||
mkDialog ("Help started in netscape window.");
|
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 :-)
|
/// The beginnings of teleportation :-)
|
||||||
// Needs cleaning up but works
|
// Needs cleaning up but works
|
||||||
// These statics should disapear when this is a class
|
// These statics should disapear when this is a class
|
||||||
|
@ -750,11 +827,22 @@ static void net_blaster_toggle( puObject *cb)
|
||||||
The menu stuff
|
The menu stuff
|
||||||
---------------------------------------------------------------------*/
|
---------------------------------------------------------------------*/
|
||||||
char *fileSubmenu [] = {
|
char *fileSubmenu [] = {
|
||||||
"Exit", /* "Close", "---------", "Print", "---------", "Save", */
|
"Exit", /* "Close", "---------", */
|
||||||
|
#ifdef WIN32
|
||||||
|
"Print",
|
||||||
|
#endif
|
||||||
|
"Screen Dump",
|
||||||
|
/* "---------", "Save", */
|
||||||
"Reset", NULL
|
"Reset", NULL
|
||||||
};
|
};
|
||||||
puCallback fileSubmenuCb [] = {
|
puCallback fileSubmenuCb [] = {
|
||||||
MayBeGoodBye, /* hideMenuCb, NULL, notCb, NULL, notCb, */ reInit, NULL
|
MayBeGoodBye, /* hideMenuCb, NULL, */
|
||||||
|
#ifdef WIN32
|
||||||
|
printScreen,
|
||||||
|
#endif
|
||||||
|
/* NULL, notCb, */
|
||||||
|
dumpScreen,
|
||||||
|
reInit, NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -48,6 +48,7 @@ fgfs_LDADD = \
|
||||||
$(WEATHER_LIBS) \
|
$(WEATHER_LIBS) \
|
||||||
$(top_builddir)/Simulator/Joystick/libJoystick.a \
|
$(top_builddir)/Simulator/Joystick/libJoystick.a \
|
||||||
$(SERIAL_LIBS) \
|
$(SERIAL_LIBS) \
|
||||||
|
$(top_builddir)/Lib/Screen/libScreen.a \
|
||||||
$(top_builddir)/Lib/Math/libMath.a \
|
$(top_builddir)/Lib/Math/libMath.a \
|
||||||
$(top_builddir)/Lib/Bucket/libBucket.a \
|
$(top_builddir)/Lib/Bucket/libBucket.a \
|
||||||
$(top_builddir)/Lib/Voronoi/libVoronoi.a \
|
$(top_builddir)/Lib/Voronoi/libVoronoi.a \
|
||||||
|
|
|
@ -175,7 +175,7 @@ sgMat4 copy_of_ssgOpenGLAxisSwapMatrix =
|
||||||
|
|
||||||
|
|
||||||
// fgInitVisuals() -- Initialize various GL/view parameters
|
// fgInitVisuals() -- Initialize various GL/view parameters
|
||||||
static void fgInitVisuals( void ) {
|
void fgInitVisuals( void ) {
|
||||||
fgLIGHT *l;
|
fgLIGHT *l;
|
||||||
|
|
||||||
l = &cur_light_params;
|
l = &cur_light_params;
|
||||||
|
@ -224,7 +224,7 @@ static void fgInitVisuals( void ) {
|
||||||
|
|
||||||
|
|
||||||
// Update all Visuals (redraws anything graphics related)
|
// Update all Visuals (redraws anything graphics related)
|
||||||
static void fgRenderFrame( void ) {
|
void fgRenderFrame( void ) {
|
||||||
fgLIGHT *l = &cur_light_params;
|
fgLIGHT *l = &cur_light_params;
|
||||||
FGTime *t = FGTime::cur_time_params;
|
FGTime *t = FGTime::cur_time_params;
|
||||||
// FGView *v = ¤t_view;
|
// FGView *v = ¤t_view;
|
||||||
|
|
Loading…
Add table
Reference in a new issue