Example #1
0
 /// <summary>
 /// Adds a 2D UI component to be rendered on the screen.
 /// </summary>
 /// <remarks>You should only add top-level components that do not have a parent component.</remarks>
 /// <param name="comp2d">A top-level G2DComponent object</param>
 public void Add2DComponent(G2DComponent comp2d)
 {
     if (!comp2Ds.Contains(comp2d))
     {
         if (comp2d.HasParent)
         {
             throw new GoblinException("You should only add root components to this list. "
                                       + "Any component with parents are automatically rendered by its parent " +
                                       "component");
         }
         else
         {
             comp2Ds.Add(comp2d);
             comp2d.RegisterKeyInput();
             comp2d.RegisterMouseInput();
         }
     }
 }