Ver código fonte

Reverted back changes in UI.cpp. Reapplied back the logic to Window.cpp so it could shade other UI elements as well.

Wei Tjong Yao 12 anos atrás
pai
commit
ec0658f1fe
2 arquivos alterados com 13 adições e 8 exclusões
  1. 1 8
      Engine/UI/UI.cpp
  2. 12 0
      Engine/UI/Window.cpp

+ 1 - 8
Engine/UI/UI.cpp

@@ -273,14 +273,7 @@ void UI::RenderUpdate()
     batches_.Clear();
     vertexData_.Clear();
     const IntVector2& rootSize = rootElement_->GetSize();
-    IntRect currentScissor(0, 0, rootSize.x_, rootSize.y_);
-    if (modalElement_)
-    {
-        UIBatch batch(rootElement_, BLEND_ALPHA, currentScissor, 0, &vertexData_);
-        batch.AddQuad(0, 0, rootSize.x_, rootSize.y_, 0, 0, 0, 0, Color(0.0f, 0.0f, 0.0f, 0.25f));
-        UIBatch::AddOrMerge(batch, batches_);
-    }
-    GetBatches(rootElement_, currentScissor);
+    GetBatches(rootElement_, IntRect(0, 0, rootSize.x_, rootSize.y_));
 
     // Restore UI cursor visibility state
     if (osCursorVisible && cursor_)

+ 12 - 0
Engine/UI/Window.cpp

@@ -72,10 +72,22 @@ void Window::RegisterObject(Context* context)
 
 void Window::GetBatches(PODVector<UIBatch>& batches, PODVector<float>& vertexData, const IntRect& currentScissor)
 {
+    if (modal_)
+    {
+        // Shade
+        UIElement* rootElement = GetRoot();
+        const IntVector2& rootSize = rootElement->GetSize();
+        IntRect currentScissor(0, 0, rootSize.x_, rootSize.y_);
+        UIBatch batch(rootElement, BLEND_ALPHA, IntRect(0, 0, rootSize.x_, rootSize.y_), 0, &vertexData);
+        batch.AddQuad(0, 0, rootSize.x_, rootSize.y_, 0, 0, 0, 0, Color(0.0f, 0.0f, 0.0f, 0.25f));
+        UIBatch::AddOrMerge(batch, batches);
+    }
+
     BorderImage::GetBatches(batches, vertexData, currentScissor);
 
     if (modal_)
     {
+        // Modal frame
         UIBatch batch(this, BLEND_ALPHA, currentScissor, 0, &vertexData);
 
         int x = GetIndentWidth();