FGPanel * current_panel = NULL;
static fntRenderer text_renderer;
-static fntTexFont *default_font;
-static fntTexFont *led_font;
+
/**
* Constructor.
void
FGPanel::init ()
{
- SGPath base_path;
- char* envp = ::getenv( "FG_FONTS" );
- if ( envp != NULL ) {
- base_path.set( envp );
- } else {
- base_path.set( globals->get_fg_root() );
- base_path.append( "Fonts" );
- }
-
- SGPath fntpath;
-
- // Install the default font
- fntpath = base_path;
- fntpath.append( "typewriter.txf" );
- default_font = new fntTexFont ;
- default_font -> load ( (char *)fntpath.c_str() ) ;
-
- // Install the LED font
- fntpath = base_path;
- fntpath.append( "led.txf" );
- led_font = new fntTexFont ;
- led_font -> load ( (char *)fntpath.c_str() ) ;
+ // NO-OP
}
} else {
glColor4f(0.7, 0.2, 0.2, 1.0);
}
- glBindTexture(GL_TEXTURE_2D, _bg->getHandle());
- // glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
- // glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
- glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
- glBegin(GL_POLYGON);
- glTexCoord2f(0.0, 0.0); glVertex3f(WIN_X, WIN_Y, 0);
- glTexCoord2f(1.0, 0.0); glVertex3f(WIN_X + _width, WIN_Y, 0);
- glTexCoord2f(1.0, 1.0); glVertex3f(WIN_X + _width, WIN_Y + _height, 0);
- glTexCoord2f(0.0, 1.0); glVertex3f(WIN_X, WIN_Y + _height, 0);
- glEnd();
+ if (_bg != 0) {
+ glBindTexture(GL_TEXTURE_2D, _bg->getHandle());
+ // glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+ // glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+ glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+ glBegin(GL_POLYGON);
+ glTexCoord2f(0.0, 0.0); glVertex3f(WIN_X, WIN_Y, 0);
+ glTexCoord2f(1.0, 0.0); glVertex3f(WIN_X + _width, WIN_Y, 0);
+ glTexCoord2f(1.0, 1.0); glVertex3f(WIN_X + _width, WIN_Y + _height, 0);
+ glTexCoord2f(0.0, 1.0); glVertex3f(WIN_X, WIN_Y + _height, 0);
+ glEnd();
+ } else {
+ for (int i = 0; i < 4; i ++) {
+ // top row of textures...(1,3,5,7)
+ glBindTexture(GL_TEXTURE_2D, _mbg[i*2]->getHandle());
+ glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+ glBegin(GL_POLYGON);
+ glTexCoord2f(0.0, 0.0); glVertex3f(WIN_X + (_width/4) * i, WIN_Y + (_height/2), 0);
+ glTexCoord2f(1.0, 0.0); glVertex3f(WIN_X + (_width/4) * (i+1), WIN_Y + (_height/2), 0);
+ glTexCoord2f(1.0, 1.0); glVertex3f(WIN_X + (_width/4) * (i+1), WIN_Y + _height, 0);
+ glTexCoord2f(0.0, 1.0); glVertex3f(WIN_X + (_width/4) * i, WIN_Y + _height, 0);
+ glEnd();
+ // bottom row of textures...(2,4,6,8)
+ glBindTexture(GL_TEXTURE_2D, _mbg[(i*2)+1]->getHandle());
+ glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+ glBegin(GL_POLYGON);
+ glTexCoord2f(0.0, 0.0); glVertex3f(WIN_X + (_width/4) * i, WIN_Y, 0);
+ glTexCoord2f(1.0, 0.0); glVertex3f(WIN_X + (_width/4) * (i+1), WIN_Y, 0);
+ glTexCoord2f(1.0, 1.0); glVertex3f(WIN_X + (_width/4) * (i+1), WIN_Y + (_height/2), 0);
+ glTexCoord2f(0.0, 1.0); glVertex3f(WIN_X + (_width/4) * i, WIN_Y + (_height/2), 0);
+ glEnd();
+ }
+
+ }
// Draw the instruments.
instrument_list_type::const_iterator current = _instruments.begin();
_bg = texture;
}
+/**
+ * Set the panel's multiple background textures.
+ */
+void
+FGPanel::setMultiBackground (ssgTexture * texture, int idx)
+{
+ _bg = 0;
+ _mbg[idx] = texture;
+}
/**
* Set the panel's x-offset.
////////////////////////////////////////////////////////////////////////
FGTextLayer::FGTextLayer (int w, int h)
- : FGInstrumentLayer(w, h), _pointSize(14.0), _font_name("default")
+ : FGInstrumentLayer(w, h), _pointSize(14.0)
{
_then.stamp();
_color[0] = _color[1] = _color[2] = 0.0;
glPushMatrix();
glColor4fv(_color);
transform();
- if ( _font_name == "led" ) {
- text_renderer.setFont(led_font);
- } else {
- text_renderer.setFont(guiFntHandle);
- }
+ text_renderer.setFont(guiFntHandle);
text_renderer.setPointSize(_pointSize);
text_renderer.begin();
text_renderer.start3f(0, 0, 0);
_pointSize = size;
}
-void
-FGTextLayer::setFontName(const string &name)
-{
- _font_name = name;
-}
-
-
void
FGTextLayer::setFont(fntFont * font)
{
\f
// end of panel.cxx
+
+
tlayer->setPointSize(pointSize);
// Set the font.
- string fontName = node->getStringValue("font", "default");
- tlayer->setFontName(fontName);
+ // TODO
const SGPropertyNode * chunk_group = node->getNode("chunks");
if (chunk_group != 0) {
if (!fgHasNode("/sim/panel/x-offset"))
fgSetInt("/sim/panel/x-offset", root->getIntValue("x-offset", 0));
- if (!fgHasNode("/sim/panel/y-offset"))
+ // conditional removed by jim wilson to allow panel xml code
+ // with y-offset defined to work...
+ // if (!fgHasNode("/sim/panel/y-offset"))
fgSetInt("/sim/panel/y-offset", root->getIntValue("y-offset", 0));
//
panel->setBackground(FGTextureManager::createTexture(bgTexture.c_str()));
SG_LOG( SG_COCKPIT, SG_INFO, "Set background texture to " << bgTexture );
+ //
+ // Get multibackground if any...
+ //
+ string mbgTexture = root->getStringValue("multibackground[0]");
+ if (mbgTexture != "") {
+ panel->setMultiBackground(FGTextureManager::createTexture(mbgTexture.c_str()), 0);
+ SG_LOG( SG_COCKPIT, SG_INFO, "Set background texture to " << mbgTexture );
+
+ mbgTexture = root->getStringValue("multibackground[1]");
+ if (mbgTexture == "")
+ mbgTexture = "FOO";
+ panel->setMultiBackground(FGTextureManager::createTexture(mbgTexture.c_str()), 1);
+ SG_LOG( SG_COCKPIT, SG_INFO, "Set background texture to " << mbgTexture );
+
+ mbgTexture = root->getStringValue("multibackground[2]");
+ if (mbgTexture == "")
+ mbgTexture = "FOO";
+ panel->setMultiBackground(FGTextureManager::createTexture(mbgTexture.c_str()), 2);
+ SG_LOG( SG_COCKPIT, SG_INFO, "Set background texture to " << mbgTexture );
+
+ mbgTexture = root->getStringValue("multibackground[3]");
+ if (mbgTexture == "")
+ mbgTexture = "FOO";
+ panel->setMultiBackground(FGTextureManager::createTexture(mbgTexture.c_str()), 3);
+ SG_LOG( SG_COCKPIT, SG_INFO, "Set background texture to " << mbgTexture );
+
+ mbgTexture = root->getStringValue("multibackground[4]");
+ if (mbgTexture == "")
+ mbgTexture = "FOO";
+ panel->setMultiBackground(FGTextureManager::createTexture(mbgTexture.c_str()), 4);
+ SG_LOG( SG_COCKPIT, SG_INFO, "Set background texture to " << mbgTexture );
+
+ mbgTexture = root->getStringValue("multibackground[5]");
+ if (mbgTexture == "")
+ mbgTexture = "FOO";
+ panel->setMultiBackground(FGTextureManager::createTexture(mbgTexture.c_str()), 5);
+ SG_LOG( SG_COCKPIT, SG_INFO, "Set background texture to " << mbgTexture );
+
+ mbgTexture = root->getStringValue("multibackground[6]");
+ if (mbgTexture == "")
+ mbgTexture = "FOO";
+ panel->setMultiBackground(FGTextureManager::createTexture(mbgTexture.c_str()), 6);
+ SG_LOG( SG_COCKPIT, SG_INFO, "Set background texture to " << mbgTexture );
+
+ mbgTexture = root->getStringValue("multibackground[7]");
+ if (mbgTexture == "")
+ mbgTexture = "FOO";
+ panel->setMultiBackground(FGTextureManager::createTexture(mbgTexture.c_str()), 7);
+ SG_LOG( SG_COCKPIT, SG_INFO, "Set background texture to " << mbgTexture );
+
+ }
+
+
//
// Create each instrument.
// end of panel_io.cxx
+
+
+