Example #1
0
        public void PaintObjects(GLEx g, int minX, int minY, int maxX, int maxY)
        {
            lock (objects)
            {
                g.BeginBatch();
                IIterator it = objects.Iterator();
                for (; it.HasNext(); )
                {
                    thing = (Actor)it.Next();
                    if (!thing.visible)
                    {
                        continue;
                    }
                    isListener = (thing.actorListener != null);

                    if (isVSync)
                    {
                        if (isListener)
                        {
                            thing.actorListener.Update(elapsedTime);
                        }
                        thing.Update(elapsedTime);
                    }

                    RectBox rect = thing.GetRectBox();
                    actorX = minX + thing.GetX();
                    actorY = minY + thing.GetY();
                    actorWidth = rect.width;
                    actorHeight = rect.height;
                    if (actorX + actorWidth < minX || actorX > maxX
                            || actorY + actorHeight < minY || actorY > maxY)
                    {
                        continue;
                    }
                    LTexture actorImage = thing.GetImage();
                    if (actorImage != null)
                    {
                        width = (actorImage.GetWidth() * thing.scaleX);
                        height = (actorImage.GetHeight() * thing.scaleY);
                        isBitmapFilter = (thing.filterColor != null);
                        thing.SetLastPaintSeqNum(paintSeq++);
                        angle = thing.GetRotation();
                        colorAlpha = thing.alpha;

                        if (isBitmapFilter)
                        {
                            g.DrawBatch(actorImage, actorX, actorY, width,
                                    height, angle, thing.filterColor.Color);
                        }
                        else
                        {
                            if (colorAlpha != 1f)
                            {
                                g.SetAlpha(colorAlpha);
                            }
                            g.DrawBatch(actorImage, actorX, actorY, width,
                                    height, angle);
                            if (colorAlpha != 1f)
                            {
                                g.SetAlpha(1f);
                            }
                        }
                    }
                    if (actorX == 0 && actorY == 0)
                    {
                        thing.Draw(g);
                        if (isListener)
                        {
                            thing.actorListener.Draw(g);
                        }
                    }
                    else
                    {
                        g.Translate(actorX, actorY);
                        thing.Draw(g);
                        if (isListener)
                        {
                            thing.actorListener.Draw(g);
                        }
                        g.Translate(-actorX, -actorY);
                    }
                }
                g.EndBatch();
            }
        }
Example #2
0
 public override void CreateUI(GLEx g, int x, int y, LComponent component,
         LTexture[] buttonImage)
 {
     if (Touch.IsUp())
     {
         FreeClick();
     }
     g.BeginBatch(BlendState.NonPremultiplied);
     g.DrawBatch(back, x, y, backWidth, backHeight);
     if (isClick)
     {
         if (angle < 360)
         {
             angle += 1;
         }
         else
         {
             angle = 1;
         }
         g.DrawBatch(dot, x + centerX , y + centerY , dotWidth, dotHeight,
                 angle);
     }
     g.DrawBatch(fore, (x + (backWidth - baseWidth) * 0.5f),
             (y + (backHeight - baseHeight) * 0.5f), baseWidth,
             baseHeight);
     g.EndBatch();
 }