コード例 #1
0
 void checkClicked(Drawable drw, float x, float y)
 {
     if (!drw.checkPoint(x, y))
     {
         return;
     }
     //loop backward
     if (drw is CompositeDrawable)
     {
         CompositeDrawable cd = (CompositeDrawable)drw;
         //todo: apply inverse transformation
         for (int i = cd.clickables.Count - 1; i >= 0; i--)
         {
             checkClicked(cd.clickables[i], x, y);
             if (clickHandled)
             {
                 return;                                   //don't continue looping
             }
         }
     }
     //fire
     if (clickHandled)
     {
         return;
     }
     clickHandled = drw.fireClick(x, y);
 }
コード例 #2
0
 public DrawablePoint scaleToParent(CompositeDrawable parent)
 {
     trnsX = (int)((float)Vx * ((float)parent.absWidth / (float)parent.maxX));
     absX  = parent.absX + trnsX;
     //
     trnsY = (int)((float)Vy * ((float)parent.absHeight / (float)parent.maxY));
     absY  = parent.absY + trnsY;
     //
     return(this);
 }
コード例 #3
0
 void checkHovered(Drawable drw, float x, float y)
 {
     if (!drw.checkPoint(x, y))
     {
         return;
     }
     //loop backward
     if (drw is CompositeDrawable)
     {
         CompositeDrawable cd = (CompositeDrawable)drw;
         //todo: apply inverse transformation
         for (int i = cd.clickables.Count - 1; i >= 0; i--)
         {
             checkHovered(cd.clickables[i], x, y);
             if (hoverHandled)
             {
                 return;
             }
         }
     }
     //fire
     hoverHandled = drw.fireHover();
 }
コード例 #4
0
 /// <summary>
 /// adds this instance to the param parent, just equivalent to parent.add(this)
 /// </summary>
 public Drawable addTo(CompositeDrawable parent)
 {
     parent.add(this);
     return(this);
 }