Преглед на файлове

Merge pull request #885 from ablake/next

Small UI bug fixes.
Sean Paul Taylor преди 13 години
родител
ревизия
300fbfe7cd
променени са 3 файла, в които са добавени 16 реда и са изтрити 8 реда
  1. 4 1
      gameplay/src/Container.cpp
  2. 3 3
      gameplay/src/Control.cpp
  3. 9 4
      gameplay/src/Form.cpp

+ 4 - 1
gameplay/src/Container.cpp

@@ -434,7 +434,10 @@ void Container::update(const Control* container, const Vector2& offset)
     }
 
     // Sort controls by Z-Order.
-    std::sort(_controls.begin(), _controls.end(), &sortControlsByZOrder);
+    if (_layout->getType() == Layout::LAYOUT_ABSOLUTE)
+    {
+        std::sort(_controls.begin(), _controls.end(), &sortControlsByZOrder);
+    }
 
     GP_ASSERT(_layout);
     if (_scroll != SCROLL_NONE)

+ 3 - 3
gameplay/src/Control.cpp

@@ -951,9 +951,9 @@ void Control::update(const Control* container, const Vector2& offset)
  
     _viewportClipBounds.set(x, y, width, height);
 
-    _absoluteClipBounds.set(x - border.left - padding.left, y - border.top - padding.top,
-        width + border.left + padding.left + border.right + padding.right,
-        height + border.top + padding.top + border.bottom + padding.bottom);
+    width += border.left + padding.left + border.right + padding.right;
+    height += border.top + padding.top + border.bottom + padding.bottom;
+    _absoluteClipBounds.set(x - border.left - padding.left, y - border.top - padding.top, max(width, 0.0f), max(height, 0.0f));
     if (_clearBounds.isEmpty())
     {
         _clearBounds.set(_absoluteClipBounds);

+ 9 - 4
gameplay/src/Form.cpp

@@ -546,20 +546,25 @@ void Form::draw()
 
         GP_ASSERT(_theme);
         _theme->setProjectionMatrix(_projectionMatrix);
+        
+        // By setting needsClear to true here, an optimization meant to clear and redraw only areas of the form
+        // that have changed is disabled.  Currently, repositioning controls can result in areas of the screen being cleared
+        // after another control has been drawn there.  This should probably be done in two passes -- one to clear areas where
+        // dirty controls were last frame, and another to draw them where they are now.
         Container::draw(_theme->getSpriteBatch(), Rectangle(0, 0, _bounds.width, _bounds.height),
-                        _skin != NULL, false, _bounds.height);
+                        /*_skin != NULL*/ true, false, _bounds.height);
         _theme->setProjectionMatrix(_defaultProjectionMatrix);
 
-        // restore the previous game viewport
+        // Restore the previous game viewport.
         game->setViewport(prevViewport);
         // Rebind the previous framebuffer and game viewport.
         previousFrameBuffer->bind();
     }
 
-    // Draw either with a 3D quad or sprite batch
+    // Draw either with a 3D quad or sprite batch.
     if (_node)
     {
-         // If we have the node set, then draw a 3D quad model
+         // If we have the node set, then draw a 3D quad model.
         _nodeQuad->draw();
     }
     else