bool
fgPanelVisible ()
{
- if(current_panel == 0)
+ if(globals->get_current_panel() == 0)
return false;
- if(current_panel->getVisibility() == 0)
+ if(globals->get_current_panel()->getVisibility() == 0)
return false;
if(globals->get_viewmgr()->get_current() != 0)
return false;
// Implementation of FGPanel.
////////////////////////////////////////////////////////////////////////
-FGPanel * current_panel = NULL;
static fntRenderer text_renderer;
static fntTexFont *default_font = 0;
static fntTexFont *led_font = 0;
GLfloat hud_row_step = 480.0 / nrows;
bool do_panel = fgPanelVisible();
- GLfloat panel_col_step = current_panel->getWidth() / ncols;
- GLfloat panel_row_step = current_panel->getHeight() / nrows;
+ GLfloat panel_col_step = globals->get_current_panel()->getWidth() / ncols;
+ GLfloat panel_row_step = globals->get_current_panel()->getHeight() / nrows;
/* Draw tiles */
int more = 1;
fgUpdateHUD( curColumn*hud_col_step, curRow*hud_row_step,
(curColumn+1)*hud_col_step, (curRow+1)*hud_row_step );
if (do_panel)
- current_panel->update( curColumn*panel_col_step, panel_col_step,
+ globals->get_current_panel()->update(
+ curColumn*panel_col_step, panel_col_step,
curRow*panel_row_step, panel_row_step );
more = trEndTile(tr);
// know what's going on.
if (mouse_mode == MOUSE_POINTER) {
if (!puMouse (button, updown, x,y)) {
- if ( current_panel != NULL ) {
- current_panel->doMouseAction(button, updown, x, y);
+ if ( globals->get_current_panel() != NULL ) {
+ globals->get_current_panel()->doMouseAction(button, updown, x, y);
}
}
}
if (mode.pass_through) {
if (puMouse(b, updown, x, y))
return;
- else if ((current_panel != 0) &&
- current_panel->getVisibility() &&
- current_panel->doMouseAction(b, updown, x, y))
+ else if ((globals->get_current_panel() != 0) &&
+ globals->get_current_panel()->getVisibility() &&
+ globals->get_current_panel()->doMouseAction(b, updown, x, y))
return;
else if (fgHandle3DPanelMouseEvent(b, updown, x, y))
return;
return false;
}
SG_LOG(SG_INPUT, SG_INFO, "Loaded new panel from " << panel_path);
- current_panel->unbind();
- delete current_panel;
- current_panel = new_panel;
- current_panel->bind();
+ globals->get_current_panel()->unbind();
+ delete globals->get_current_panel();
+ globals->set_current_panel( new_panel );
+ globals->get_current_panel()->bind();
return true;
}
static bool
do_panel_mouse_click (const SGPropertyNode * arg)
{
- if (current_panel != 0)
- return current_panel
+ if (globals->get_current_panel() != 0)
+ return globals->get_current_panel()
->doMouseAction(arg->getIntValue("button"),
arg->getBoolValue("is-down") ? PU_DOWN : PU_UP,
arg->getIntValue("x-pos"),
globals->get_AI_mgr()->init();
}
+
#ifdef ENABLE_AUDIO_SUPPORT
////////////////////////////////////////////////////////////////////
// Initialize the sound subsystem.
globals->get_io()->init();
globals->get_io()->bind();
- // Initialize the 2D panel.
+
+ ////////////////////////////////////////////////////////////////////
+ // Add a new 2D panel.
+ ////////////////////////////////////////////////////////////////////
+
string panel_path = fgGetString("/sim/panel/path",
"Panels/Default/default.xml");
- current_panel = fgReadPanel(panel_path);
- if (current_panel == 0) {
+
+ globals->set_current_panel( fgReadPanel(panel_path) );
+ if (globals->get_current_panel() == 0) {
SG_LOG( SG_INPUT, SG_ALERT,
"Error reading new panel from " << panel_path );
} else {
SG_LOG( SG_INPUT, SG_INFO, "Loaded new panel from " << panel_path );
- current_panel->init();
- current_panel->bind();
+ globals->get_current_panel()->init();
+ globals->get_current_panel()->bind();
}
class FGMultiplayRxMgr;
class FGMultiplayTxMgr;
#endif
+class FGPanel;
class FGSoundMgr;
class FGTextureLoader;
class FGTileMgr;
// Global autopilot "route"
SGRoute *route;
+ // 2D panel
+ FGPanel *current_panel;
+
// sound manager
FGSoundMgr *soundmgr;
inline FGAIMgr *get_AI_mgr() const { return AI_mgr; }
inline void set_AI_mgr( FGAIMgr *a ) {AI_mgr = a; }
+ inline FGPanel *get_current_panel() const { return current_panel; }
+ inline void set_current_panel( FGPanel *cp ) { current_panel = cp; }
+
inline FGSoundMgr *get_soundmgr() const { return soundmgr; }
inline void set_soundmgr( FGSoundMgr *sm ) { soundmgr = sm; }
if ( fgPanelVisible() ) {
GLfloat height = fgGetInt("/sim/startup/ysize");
GLfloat view_h =
- (current_panel->getViewHeight() - current_panel->getYOffset())
+ (globals->get_current_panel()->getViewHeight() - globals->get_current_panel()->getYOffset())
* (height / 768.0) + 1;
glTranslatef( 0.0, view_h, 0.0 );
}
globals->get_ATC_display()->update(delta_time_sec);
// update the panel subsystem
- if ( current_panel != NULL ) {
- current_panel->update(delta_time_sec);
+ if ( globals->get_current_panel() != NULL ) {
+ globals->get_current_panel()->update(delta_time_sec);
}
fgUpdate3DPanels();
if ( (!fgGetBool("/sim/virtual-cockpit"))
&& fgPanelVisible() && idle_state == 1000 ) {
- view_h = (int)(height * (current_panel->getViewHeight() -
- current_panel->getYOffset()) / 768.0);
+ view_h = (int)(height * (globals->get_current_panel()->getViewHeight() -
+ globals->get_current_panel()->getYOffset()) / 768.0);
} else {
view_h = height;
}