per-application level. We can have multiple viewers ...
Cleaned up fov mistake on startup with panel activated.
#include <simgear/debug/logstream.hxx>
#include <simgear/misc/fgstream.hxx>
-#include <Main/options.hxx>
-
#include STL_STRING
#include STL_FUNCTIONAL
#include STL_ALGORITHM
#include <simgear/debug/logstream.hxx>
#include <simgear/misc/fgstream.hxx>
-#include <Main/options.hxx>
-
#include STL_STRING
#include STL_FUNCTIONAL
#include STL_ALGORITHM
#include <Main/bfi.hxx>
#include <Main/fg_init.hxx>
#include <Main/globals.hxx>
-#include <Main/options.hxx>
#include <Navaids/fixlist.hxx>
#include "auto_gui.hxx"
#include <FDM/flight.hxx>
#include <Main/bfi.hxx>
#include <Main/globals.hxx>
-#include <Main/options.hxx>
#include <Scenery/scenery.hxx>
#include "newauto.hxx"
#endif
#include <GL/glut.h>
-#include <simgear/xgl/xgl.h>
+// #include <simgear/xgl/xgl.h>
#include <stdlib.h>
#include <stdio.h>
#include <Include/general.hxx>
#include <FDM/ADA.hxx>
#include <Main/globals.hxx>
-#include <Main/options.hxx>
#include <Scenery/scenery.hxx>
#include <Time/fg_timer.hxx>
#include <GUI/gui.h>
"Cockpit: code " << ac_cockpit->code() << " status "
<< ac_cockpit->status() );
- int iwidth = globals->get_current_view()->get_winWidth();
- int iheight = globals->get_current_view()->get_winHeight();
+ int iwidth = globals->get_options()->get_xsize();
+ int iheight = globals->get_options()->get_ysize();
float width = iwidth;
float height = iheight;
// sprintf(buf,"%-4.1f %7.0f %7.0f", fps, tris, culled);
sprintf(buf,"%-5.1f", fps);
- glMatrixMode(GL_PROJECTION);
+ glMatrixMode( GL_PROJECTION );
glPushMatrix();
glLoadIdentity();
- gluOrtho2D(0, width, 0, height);
- glMatrixMode(GL_MODELVIEW);
+ gluOrtho2D( 0, globals->get_options()->get_xsize(),
+ 0, globals->get_options()->get_ysize() );
+ glMatrixMode( GL_MODELVIEW );
glPushMatrix();
glLoadIdentity();
- glDisable(GL_DEPTH_TEST);
- glDisable(GL_LIGHTING);
+ glDisable( GL_DEPTH_TEST );
+ glDisable( GL_LIGHTING );
- glColor3f (0.9, 0.4, 0.2);
+ glColor3f( 0.9, 0.4, 0.2 );
guiFnt.drawString( buf,
- // width/2 - guiFnt.getStringWidth(buf)/2,
int(width - guiFnt.getStringWidth(buf) - 10),
10 );
- glEnable(GL_DEPTH_TEST);
- glEnable(GL_LIGHTING);
- glMatrixMode(GL_PROJECTION);
+ glEnable( GL_DEPTH_TEST );
+ glEnable( GL_LIGHTING );
+ glMatrixMode( GL_PROJECTION );
glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
+ glMatrixMode( GL_MODELVIEW );
glPopMatrix();
}
#endif // #ifdef DISPLAY_COUNTER
- xglViewport( 0, 0, iwidth, iheight );
+ glViewport( 0, 0,
+ globals->get_options()->get_xsize(),
+ globals->get_options()->get_ysize() );
if (current_panel != 0)
current_panel->update();
#include <Aircraft/aircraft.hxx>
#include <Autopilot/newauto.hxx>
#include <GUI/gui.h>
-#include <Main/options.hxx>
+#include <Main/globals.hxx>
#ifdef FG_NETWORK_OLK
#include <NetworkOLK/network.h>
#endif
#include <simgear/debug/logstream.hxx>
#include <simgear/misc/fgpath.hxx>
#include <Main/globals.hxx>
-#include <Main/options.hxx>
#include <Objects/texload.h>
#include "hud.hxx"
}
// Scale for the real window size.
- x = int(((float)x / globals->get_current_view()->get_winWidth()) * _winw);
- y = int(_winh - (((float)y / globals->get_current_view()->get_winHeight())
+ x = int(((float)x / globals->get_options()->get_xsize()) * _winw);
+ y = int(_winh - (((float)y / globals->get_options()->get_ysize())
* _winh));
// Adjust for offsets.
#include <simgear/math/sg_types.hxx>
#include <simgear/misc/props.hxx>
#include <Aircraft/aircraft.hxx>
-#include <Main/options.hxx>
#include <Main/bfi.hxx>
+#include <Main/globals.hxx>
#include <NetworkOLK/features.hxx>
FG_USING_NAMESPACE(std);
#include <Aircraft/aircraft.hxx>
#include <Controls/controls.hxx>
-#include <Main/options.hxx>
+#include <Main/globals.hxx>
#include "Balloon.h"
#include <Aircraft/aircraft.hxx>
#include <Controls/controls.hxx>
-#include <Main/options.hxx>
+#include <Main/globals.hxx>
#include <FDM/JSBSim/FGFDMExec.h>
#include <FDM/JSBSim/FGAircraft.h>
#include <simgear/math/sg_geodesy.hxx>
#include <FDM/LaRCsim/ls_interface.h>
-#include <Main/options.hxx>
+#include <Main/globals.hxx>
#include <Time/timestamp.hxx>
#include "External.hxx"
#include <Main/fg_init.hxx>
#include <Main/fg_io.hxx>
#include <Main/globals.hxx>
-#include <Main/options.hxx>
#include <Main/save.hxx>
#ifdef FG_NETWORK_OLK
#include <NetworkOLK/network.h>
}
#endif
#if defined(X_CURSOR_TWEAKS)
- glutWarpPointer( globals->get_current_view()->get_winWidth()/2,
- globals->get_current_view()->get_winHeight()/2);
+ glutWarpPointer( globals->get_options()->get_xsize()/2,
+ globals->get_options()->get_ysize()/2);
#endif
}
#if defined(WIN32_CURSOR_TWEAKS)
glutSetCursor(GLUT_CURSOR_NONE);
#elif defined(X_CURSOR_TWEAKS)
- glutWarpPointer( globals->get_current_view()->get_winWidth(),
- globals->get_current_view()->get_winHeight());
+ glutWarpPointer( globals->get_options()->get_xsize(),
+ globals->get_options()->get_ysize());
#endif
}
// reset left click MOUSE_VIEW toggle feature
_mVtoggle = 0;
- ww = globals->get_current_view()->get_winWidth();
- wh = globals->get_current_view()->get_winHeight();
+ ww = globals->get_options()->get_xsize();
+ wh = globals->get_options()->get_ysize();
switch (mouse_mode) {
case MOUSE_YOKE:
_quat[1] = curquat[1];
_quat[2] = curquat[2];
_quat[3] = curquat[3];
- x = globals->get_current_view()->get_winWidth()/2;
- y = globals->get_current_view()->get_winHeight()/2;
+ x = globals->get_options()->get_xsize()/2;
+ y = globals->get_options()->get_ysize()/2;
Quat0();
- _view_offset = globals->get_current_view()->get_goal_view_offset();
+ _view_offset =
+ globals->get_current_view()->get_goal_view_offset();
globals->get_current_view()->set_goal_view_offset(0.0);
#ifdef NO_SMOOTH_MOUSE_VIEW
globals->get_current_view()->set_view_offset(0.0);
_savedX = x;
_savedY = y;
// start with zero point in center of screen
- _mX = globals->get_current_view()->get_winWidth()/2;
- _mY = globals->get_current_view()->get_winHeight()/2;
+ _mX = globals->get_options()->get_xsize()/2;
+ _mY = globals->get_options()->get_ysize()/2;
// try to have the MOUSE_YOKE position
// reflect the current stick position
case MOUSE_YOKE:
mouse_mode = MOUSE_VIEW;
globals->get_options()->set_control_mode( FGOptions::FG_JOYSTICK );
- x = globals->get_current_view()->get_winWidth()/2;
- y = globals->get_current_view()->get_winHeight()/2;
+ x = globals->get_options()->get_xsize()/2;
+ y = globals->get_options()->get_ysize()/2;
_mVtoggle = 0;
Quat0();
build_rotmatrix(quat_mat, curquat);
}
fgInitVisuals();
- fgReshape( globals->get_current_view()->get_winWidth(),
- globals->get_current_view()->get_winHeight() );
+ fgReshape( globals->get_options()->get_xsize(),
+ globals->get_options()->get_ysize() );
// we need two render frames here to clear the menu and cursor
// ... not sure why but doing an extra fgFenderFrame() shoulnd't
#endif
#include "globals.hxx"
-#include "options.hxx"
#include "save.hxx"
#include "fg_init.hxx"
#include <simgear/misc/props.hxx>
#include "fg_init.hxx"
#include "fg_io.hxx"
#include "globals.hxx"
-#include "options.hxx"
#include "bfi.hxx"
#if defined(FX) && defined(XMESA)
extern const char *default_root;
+// from main.cxx
+extern void fgReshape( int width, int height );
+
// Read in configuration (file and command line) and just set fg_root
bool fgInitFGRoot ( int argc, char **argv ) {
#include "bfi.hxx"
#include "globals.hxx"
#include "keyboard.hxx"
-#include "options.hxx"
#include "save.hxx"
// From main.cxx
v->set_view_offset( FG_PI * 1.75 );
globals->get_pilot_view()->set_pilot_offset(25.0, -25.0, 1.0);
}
- fgReshape( globals->get_current_view()->get_winWidth(),
- globals->get_current_view()->get_winHeight() );
+ fgReshape( globals->get_options()->get_xsize(),
+ globals->get_options()->get_ysize() );
return;
case 120: // x key
fov = globals->get_options()->get_fov();
}
case GLUT_KEY_F5: {
current_panel->setYOffset(current_panel->getYOffset() - 5);
- fgReshape(globals->get_current_view()->get_winWidth(),
- globals->get_current_view()->get_winHeight());
+ fgReshape(globals->get_options()->get_xsize(),
+ globals->get_options()->get_ysize());
return;
}
case GLUT_KEY_F6: {
current_panel->setYOffset(current_panel->getYOffset() + 5);
- fgReshape(globals->get_current_view()->get_winWidth(),
- globals->get_current_view()->get_winHeight());
+ fgReshape(globals->get_options()->get_xsize(),
+ globals->get_options()->get_ysize());
return;
}
case GLUT_KEY_F7: {
#include "fg_io.hxx"
#include "globals.hxx"
#include "keyboard.hxx"
-#include "options.hxx"
#include "splash.hxx"
// Another hack
int use_signals = 0;
+// forward declaration
+void fgReshape( int width, int height );
+
// Global structures for the Audio library
#ifdef ENABLE_AUDIO_SUPPORT
slEnvelope pitch_envelope ( 1, SL_SAMPLE_ONE_SHOT ) ;
// sleep(1);
idle_state = 1000;
+
+ cout << "Panel visible = " << fgPanelVisible() << endl;
+ fgReshape( globals->get_options()->get_xsize(),
+ globals->get_options()->get_ysize() );
}
if ( idle_state == 1000 ) {
(GLint)(width), (GLint)(view_h) );
}
- globals->get_current_view()->set_winWidth( width );
- globals->get_current_view()->set_winHeight( height );
+ globals->get_options()->set_xsize( width );
+ globals->get_options()->set_ysize( height );
globals->get_current_view()->force_update_fov_math();
// set these fov to be the same as in fgRenderFrame()
// seed the random number generater
fg_srandom();
- // needs to happen before we parse command line options
+ // Allocate global data structures. This needs to happen before
+ // we parse command line options
globals = new FGGlobals;
SGRoute *route = new SGRoute;
FG_USING_STD(string);
FG_USING_NAMESPACE(std);
-// from GLUTmain.cxx
+// from main.cxx
extern void fgReshape( int width, int height );
inline double
wireframe(0),
xsize(800),
ysize(600),
- xmin(0),
- ymin(0),
- xmax(800),
- ymax(600),
bpp(16),
view_mode(FG_VIEW_PILOT),
default_view_offset(0),
fov *= (1.0 / 0.4232);
} */
- // fgReshape( xsize, ysize);
- fgReshape( globals->get_current_view()->get_winWidth(),
- globals->get_current_view()->get_winHeight() );
+ fgReshape( xsize, ysize);
if( !freeze )
globals->set_freeze( false );
FG_LOG( FG_GENERAL, FG_ALERT,
"Setting geometry to " << xsize << 'x' << ysize << '\n');
}
-
- xmin = ymin = 0;
- xmax = xsize;
- ymax = ysize;
} else if ( arg.find( "--bpp=" ) != string::npos ) {
string bits_per_pix = arg.substr( 6 );
if ( bits_per_pix == "16" ) {
bool textures; // Textures enabled/disabled
bool wireframe; // Wireframe mode enabled/disabled
int xsize, ysize; // window size derived from geometry string
- int xmin, ymin; // upper left corner of window to draw in
- int xmax, ymax; // lower right corner of window to draw in
int bpp; // bits per pixel
fgViewMode view_mode; // view mode
double default_view_offset; // default forward view offset (for use by
inline bool get_wireframe() const { return wireframe; }
inline int get_xsize() const { return xsize; }
inline int get_ysize() const { return ysize; }
- inline int get_xmin() const { return xmin; }
- inline int get_ymin() const { return ymin; }
- inline int get_xmax() const { return xmax; }
- inline int get_ymax() const { return ymax; }
inline int get_bpp() const { return bpp; }
inline fgViewMode get_view_mode() const { return view_mode; }
inline double get_default_view_offset() const {
int xsize = 480;
int ysize = 380;
- if ( !globals->get_current_view()->get_winWidth()
- || !globals->get_current_view()->get_winHeight() ) {
+ if ( !globals->get_options()->get_xsize()
+ || !globals->get_options()->get_ysize() ) {
return;
}
- xmin = (globals->get_current_view()->get_winWidth() - xsize) / 2;
+ xmin = (globals->get_options()->get_xsize() - xsize) / 2;
xmax = xmin + xsize;
- ymin = (globals->get_current_view()->get_winHeight() - ysize) / 2;
+ ymin = (globals->get_options()->get_ysize() - ysize) / 2;
ymax = ymin + ysize;
// first clear the screen;
xglMatrixMode(GL_PROJECTION);
xglPushMatrix();
xglLoadIdentity();
- gluOrtho2D(0, globals->get_current_view()->get_winWidth(),
- 0, globals->get_current_view()->get_winHeight());
+ gluOrtho2D(0, globals->get_options()->get_xsize(),
+ 0, globals->get_options()->get_ysize());
xglMatrixMode(GL_MODELVIEW);
xglPushMatrix();
xglLoadIdentity();
#include <Cockpit/panel.hxx>
#include <Scenery/scenery.hxx>
-#include "options.hxx"
+#include "globals.hxx"
#include "viewer.hxx"
view_offset = goal_view_offset = globals->get_options()->get_default_view_offset();
sgSetVec3( pilot_offset, 0.0, 0.0, 0.0 );
- winWidth = globals->get_options()->get_xsize();
- winHeight = globals->get_options()->get_ysize();
-
- set_win_ratio( winHeight / winWidth );
+ set_win_ratio( globals->get_options()->get_xsize() /
+ globals->get_options()->get_ysize() );
#ifndef USE_FAST_VIEWROT
// This never changes -- NHV
UpdateViewMath(f);
if ( ! fgPanelVisible() ) {
- xglViewport(0, 0 , (GLint)(winWidth), (GLint)(winHeight) );
+ xglViewport( 0, 0 ,
+ (GLint)(globals->get_options()->get_xsize()),
+ (GLint)(globals->get_options()->get_ysize()) );
} else {
int view_h =
int((current_panel->getViewHeight() - current_panel->getYOffset())
- * (winHeight / 768.0));
- glViewport(0, (GLint)(winHeight - view_h),
- (GLint)(winWidth), (GLint)(view_h) );
+ * (globals->get_options()->get_ysize() / 768.0));
+ glViewport( 0, (GLint)(globals->get_options()->get_ysize() - view_h),
+ (GLint)(globals->get_options()->get_xsize()),
+ (GLint)(view_h) );
}
}
#include <FDM/flight.hxx>
#include <Time/light.hxx>
-#include "options.hxx"
FG_USING_STD(list);
double win_ratio;
// width & height of window
- int winWidth, winHeight;
+ // int winWidth, winHeight;
// absolute view position in earth coordinates
Point3D abs_view_pos;
inline void set_goal_view_offset( double a) { goal_view_offset = a; }
inline double get_win_ratio() const { return win_ratio; }
inline void set_win_ratio( double r ) { win_ratio = r; }
- inline int get_winWidth() const { return winWidth; }
- inline void set_winWidth( int w ) { winWidth = w; }
- inline int get_winHeight() const { return winHeight; }
- inline void set_winHeight( int h ) { winHeight = h; }
+ // inline int get_winWidth() const { return winWidth; }
+ // inline void set_winWidth( int w ) { winWidth = w; }
+ // inline int get_winHeight() const { return winHeight; }
+ // inline void set_winHeight( int h ) { winHeight = h; }
inline Point3D get_abs_view_pos() const { return abs_view_pos; }
inline Point3D get_view_pos() const { return view_pos; }
inline float *get_pilot_offset() { return pilot_offset; }
#include <Cockpit/panel.hxx>
#include <Scenery/scenery.hxx>
-#include "options.hxx"
+#include "globals.hxx"
#include "views.hxx"
#include <FDM/flight.hxx>
#include <Time/light.hxx>
-#include "options.hxx"
-
FG_USING_STD(list);
#include <Aircraft/aircraft.hxx>
#include <GUI/gui.h>
-#include <Main/options.hxx>
#include <Scenery/scenery.hxx>
#include <Time/fg_timer.hxx>
*/
-#include <Main/options.hxx>
#include <Cockpit/hud.hxx>
#include <NetworkOLK/network.h>
#include <Aircraft/aircraft.hxx>
#include <GUI/gui.h>
-#include <Main/options.hxx>
#include <Scenery/scenery.hxx>
#include <Time/fg_timer.hxx>
#include <simgear/debug/logstream.hxx>
-#include <Main/options.hxx>
-
#include "scenery.hxx"