Fix little bug

Jun 22, 2012 at 5:53 AM

There is a bug in class Contol in function

 private void DrawChildControls(Renderer renderer, GameTime gameTime, bool firstDetachedLevel)

after 

  if (controls != null)
          {
              foreach (Control c in controls)
              {
                  // We skip detached controls for first level after root (they are rendered separately in Draw() method)
                  if (((c.Root == c.Parent && !c.Detached) || c.Root != c.Parent) && AbsoluteRect.Intersects(c.AbsoluteRect) && c.visible)
                  {

should be added

                     Rectangle oldRect = Manager.GraphicsDevice.ScissorRectangle;

                                       ...

and at the end of this bloc

                     Manager.GraphicsDevice.ScissorRectangle = oldRect;
                  }
              }
          }

Jul 14, 2012 at 3:16 PM

And what does this fix?

Jul 17, 2012 at 12:59 AM
Edited Jul 17, 2012 at 1:01 AM

To reproduce bug behavior:

 

Window mainWindow = new Window(uiManager);
   mainWindow.Init();
   mainWindow.Width = 300;
   mainWindow.Height = 200;
   mainWindow.Left = 0;
   mainWindow.Top = 20;
   mainWindow.StayOnBack = true; //!!!!important feature   
   uiManager.Add(mainWindow);

   string[] colors = new string[] {"Red", "Green", "Blue"};


  ComboBox cmb = new ComboBox(uiManager);
  cmb.Init();
  cmb.Parent = mainWindow;
  cmb.Left = 5;
  cmb.Top = 5;
  cmb.Width = 100;
  cmb.Items.AddRange(colors);
  
  Window additionalWindow1 = new Window(uiManager);
  additionalWindow1.Init();
  additionalWindow1.Left = 400;
  additionalWindow1.Top = 20;
  additionalWindow1.Width = 300;
  additionalWindow1.Height = 200;
  uiManager.Add(additionalWindow1);
  
  Window additionalWindow2 = new Window(uiManager);
  additionalWindow2.Init();
  additionalWindow2.Left = 200;
  additionalWindow2.Top = 250;
  additionalWindow2.Width = 300;
  additionalWindow2.Height = 200;
  uiManager.Add(additionalWindow2); 

Pressing the ComboBox causes disappearance of other windows