]> git.mxchange.org Git - flightgear.git/blobdiff - src/GUI/CanvasWidget.cxx
Fix windows build
[flightgear.git] / src / GUI / CanvasWidget.cxx
index b505aa5eab425a64de0c60d6d7c2f570f4f79bc6..b2aeb59c48b6b969ebc8e5507e42f4f2bd7f2b5d 100644 (file)
@@ -28,8 +28,6 @@ CanvasWidget::CanvasWidget( int x, int y,
                             const std::string& module ):
   puObject(x, y, width, height),
   _canvas_mgr( dynamic_cast<CanvasMgr*>(globals->get_subsystem("Canvas")) ),
-  _tex_id(0),
-  _no_tex_cnt(0),
   _last_x(0),
   _last_y(0)
 {
@@ -58,11 +56,6 @@ CanvasWidget::CanvasWidget( int x, int y,
   cprops->setBoolValue("render-always", true);
   cprops->setStringValue( "name",
                            props->getStringValue("name", "gui-anonymous") );
-  SGPropertyNode* input = cprops->getChild("input", 0, true);
-  _mouse_x = input->getChild("mouse-x", 0, true);
-  _mouse_y = input->getChild("mouse-y", 0, true);
-  _mouse_down = input->getChild("mouse-down", 0, true);
-  _mouse_drag = input->getChild("mouse-drag", 0, true);
 
   SGPropertyNode *nasal = props->getNode("nasal");
   if( !nasal )
@@ -179,14 +172,6 @@ void CanvasWidget::doHit(int button, int updown, int x, int y)
   }
 
   _canvas->handleMouseEvent(event);
-
-  _mouse_x->setIntValue(x - abox.min[0]);
-  _mouse_y->setIntValue(abox.max[1] - y);
-
-  if( updown == PU_DRAG )
-    _mouse_drag->setIntValue(button);
-  else if( updown == PU_DOWN )
-    _mouse_down->setIntValue(button);
 }
 
 //------------------------------------------------------------------------------
@@ -207,34 +192,8 @@ void CanvasWidget::setSize(int w, int h)
 //------------------------------------------------------------------------------
 void CanvasWidget::draw(int dx, int dy)
 {
-  if( !_tex_id )
-  {
-    _tex_id = _canvas_mgr->getCanvasTexId( _canvas->getProps()->getIndex() );
-
-    // Normally we should be able to get the texture after one frame. I don't
-    // know if there are circumstances where it can take longer, so we don't
-    // log a warning message until we have tried a few times.
-    if( !_tex_id )
-    {
-      if( ++_no_tex_cnt == 5 )
-        SG_LOG(SG_GENERAL, SG_WARN, "CanvasWidget: failed to get texture!");
-      return;
-    }
-    else
-    {
-      if( _no_tex_cnt >= 5 )
-        SG_LOG
-        (
-          SG_GENERAL,
-          SG_INFO,
-          "CanvasWidget: got texture after " << _no_tex_cnt << " tries."
-        );
-      _no_tex_cnt = 0;
-    }
-  }
-
   glEnable(GL_TEXTURE_2D);
-  glBindTexture(GL_TEXTURE_2D, _tex_id);
+  glBindTexture(GL_TEXTURE_2D, _canvas_mgr->getCanvasTexId(_canvas));
   glBegin( GL_QUADS );
     glColor3f(1,1,1);
     glTexCoord2f(0,0); glVertex2f(dx + abox.min[0], dy + abox.min[1]);