Forráskód Böngészése

Added check for setting cursor to current

Modanung 6 éve
szülő
commit
5bec664bad
1 módosított fájl, 13 hozzáadás és 10 törlés
  1. 13 10
      Source/Urho3D/UI/UI.cpp

+ 13 - 10
Source/Urho3D/UI/UI.cpp

@@ -153,6 +153,9 @@ UI::~UI() = default;
 
 void UI::SetCursor(Cursor* cursor)
 {
+    if (cursor_ == cursor)
+        return;
+
     // Remove old cursor (if any) and set new
     if (cursor_)
     {
@@ -1061,7 +1064,7 @@ void UI::Render(VertexBuffer* buffer, const PODVector<UIBatch>& batches, unsigne
             }
         } else
         {
-            vs = diffTextureVS;
+            vs = diffTextureVS;
             ps = diffTexturePS;
 
             Technique* technique = batch.custom_material_->GetTechnique(0);
@@ -1121,16 +1124,16 @@ void UI::Render(VertexBuffer* buffer, const PODVector<UIBatch>& batches, unsigne
             if (graphics_->NeedParameterUpdate(SP_MATERIAL, reinterpret_cast<const void*>(batch.custom_material_->GetShaderParameterHash())))
             {
                 auto shader_parameters = batch.custom_material_->GetShaderParameters();
-                for (auto it = shader_parameters.Begin(); it != shader_parameters.End(); ++it)
-                {
-                    graphics_->SetShaderParameter(it->second_.name_, it->second_.value_);
+                for (auto it = shader_parameters.Begin(); it != shader_parameters.End(); ++it)
+                {
+                    graphics_->SetShaderParameter(it->second_.name_, it->second_.value_);
                 }
             }
             // Apply custom shader textures
             auto textures = batch.custom_material_->GetTextures();
-            for (auto it = textures.Begin(); it != textures.End(); ++it)
-            {
-                graphics_->SetTexture(it->first_, it->second_);
+            for (auto it = textures.Begin(); it != textures.End(); ++it)
+            {
+                graphics_->SetTexture(it->first_, it->second_);
             }
         }
 
@@ -1141,9 +1144,9 @@ void UI::Render(VertexBuffer* buffer, const PODVector<UIBatch>& batches, unsigne
         {
             // Reset textures used by the batch custom material
             auto textures = batch.custom_material_->GetTextures();
-            for (auto it = textures.Begin(); it != textures.End(); ++it)
-            {
-                graphics_->SetTexture(it->first_, 0);
+            for (auto it = textures.Begin(); it != textures.End(); ++it)
+            {
+                graphics_->SetTexture(it->first_, 0);
             }
         }
     }