#include <GUI/gui.h>
#include "panel.hxx"
-#include "steam.hxx"
#include "panel_io.hxx"
+//built-in layers
+#include "built_in/FGMagRibbon.hxx"
+
#if !defined (SG_HAVE_NATIVE_SGI_COMPILERS)
SG_USING_STD(istream);
SG_USING_STD(ifstream);
SG_USING_STD(string);
-\f
-////////////////////////////////////////////////////////////////////////
-// Built-in layer for the magnetic compass ribbon layer.
-//
-// TODO: move this out into a special directory for built-in
-// layers of various sorts.
-////////////////////////////////////////////////////////////////////////
-
-class FGMagRibbon : public FGTexturedLayer
-{
-public:
- FGMagRibbon (int w, int h);
- virtual ~FGMagRibbon () {}
-
- virtual void draw ();
-};
-
-FGMagRibbon::FGMagRibbon (int w, int h)
- : FGTexturedLayer(w, h)
-{
- FGCroppedTexture texture("Aircraft/Instruments/Textures/compass-ribbon.rgb");
- setTexture(texture);
-}
-
-void
-FGMagRibbon::draw ()
-{
- double heading = FGSteam::get_MH_deg();
- double xoffset, yoffset;
-
- while (heading >= 360.0) {
- heading -= 360.0;
- }
- while (heading < 0.0) {
- heading += 360.0;
- }
-
- if (heading >= 60.0 && heading <= 180.0) {
- xoffset = heading / 240.0;
- yoffset = 0.75;
- } else if (heading >= 150.0 && heading <= 270.0) {
- xoffset = (heading - 90.0) / 240.0;
- yoffset = 0.50;
- } else if (heading >= 240.0 && heading <= 360.0) {
- xoffset = (heading - 180.0) / 240.0;
- yoffset = 0.25;
- } else {
- if (heading < 270.0)
- heading += 360.0;
- xoffset = (heading - 270.0) / 240.0;
- yoffset = 0.0;
- }
-
- xoffset = 1.0 - xoffset;
- // Adjust to put the number in the centre
- xoffset -= 0.25;
-
- FGCroppedTexture &t = getTexture();
- t.setCrop(xoffset, yoffset, xoffset + 0.5, yoffset + 0.25);
- FGTexturedLayer::draw();
-}
-
-
\f
////////////////////////////////////////////////////////////////////////
// Read and construct a panel.
FGPanelAction * action = new FGPanelAction(button, x, y, w, h);
- vector<const SGPropertyNode *>bindings = node->getChildren("binding");
+ vector<SGPropertyNode_ptr>bindings = node->getChildren("binding");
for (unsigned int i = 0; i < bindings.size(); i++) {
SG_LOG(SG_INPUT, SG_INFO, "Reading binding "
<< bindings[i]->getStringValue("command"));
static FGPanelInstrument *
readInstrument (const SGPropertyNode * node)
{
- const string &name = node->getStringValue("name");
+ const string name = node->getStringValue("name");
int x = node->getIntValue("x", -1);
int y = node->getIntValue("y", -1);
int real_w = node->getIntValue("w", -1);