Kaynağa Gözat

Fixes setVisible(false) for 2D controls without forcing all controls to be re-drawn.

Adam Blake 13 yıl önce
ebeveyn
işleme
c2f35d25e8
2 değiştirilmiş dosya ile 4 ekleme ve 4 silme
  1. 3 3
      gameplay/src/Control.cpp
  2. 1 1
      gameplay/src/Form.cpp

+ 3 - 3
gameplay/src/Control.cpp

@@ -1033,9 +1033,6 @@ void Control::drawText(const Rectangle& position)
 
 void Control::draw(SpriteBatch* spriteBatch, const Rectangle& clip, bool needsClear, bool cleared, float targetHeight)
 {
-    if (!_visible)
-        return;
-
     if (needsClear)
     {
         GL_ASSERT( glEnable(GL_SCISSOR_TEST) );
@@ -1044,6 +1041,9 @@ void Control::draw(SpriteBatch* spriteBatch, const Rectangle& clip, bool needsCl
         GL_ASSERT( glDisable(GL_SCISSOR_TEST) );
     }
 
+    if (!_visible)
+        return;
+
     spriteBatch->start();
     drawBorder(spriteBatch, clip);
     drawImages(spriteBatch, clip);

+ 1 - 1
gameplay/src/Form.cpp

@@ -544,7 +544,7 @@ void Form::draw()
         GP_ASSERT(_theme);
         _theme->setProjectionMatrix(_projectionMatrix);
         Container::draw(_theme->getSpriteBatch(), Rectangle(0, 0, _bounds.width, _bounds.height),
-                        true/*WAS _skin!=NULL*/, false, _bounds.height);
+                        _skin != NULL, false, _bounds.height);
         _theme->setProjectionMatrix(_defaultProjectionMatrix);
 
         // Rebind the default framebuffer and game viewport.