Beispiel #1
0
 private void Repaint(GLEx g)
 {
     if (!isClose)
     {
         if (isTranslate)
         {
             g.Translate(tx, ty);
         }
         AfterUI(g);
         if (fristPaintFlag)
         {
             fristOrder.Paint(g);
         }
         if (secondPaintFlag)
         {
             secondOrder.Paint(g);
         }
         if (lastPaintFlag)
         {
             lastOrder.Paint(g);
         }
         BeforeUI(g);
         if (isTranslate)
         {
             g.Translate(-tx, -ty);
         }
     }
 }
Beispiel #2
0
 public virtual void CreateUI(GLEx g)
 {
     if (isClose)
     {
         return;
     }
     if (replaceLoading)
     {
         if (replaceDstScreen == null
                 || !replaceDstScreen.IsOnLoadComplete())
         {
             Repaint(g);
         }
         else if (replaceDstScreen.IsOnLoadComplete())
         {
             if (isScreenFrom)
             {
                 Repaint(g);
                 if (replaceDstScreen.color != null)
                 {
                     g.SetColor(replaceDstScreen.color);
                     g.FillRect(dstPos.X(), dstPos.Y(), GetWidth(),
                             GetHeight());
                     g.ResetColor();
                 }
                 if (replaceDstScreen.currentScreen != null)
                 {
                     g.DrawTexture(replaceDstScreen.currentScreen,
                             dstPos.X(), dstPos.Y(), GetWidth(), GetHeight());
                 }
                 if (dstPos.X() != 0 || dstPos.Y() != 0)
                 {
                     g.SetClip(dstPos.X(), dstPos.Y(), GetWidth(),
                             GetHeight());
                     g.Translate(dstPos.X(), dstPos.Y());
                 }
                 replaceDstScreen.CreateUI(g);
                 if (dstPos.X() != 0 || dstPos.Y() != 0)
                 {
                     g.Translate(-dstPos.X(), -dstPos.Y());
                     g.ClearClip();
                 }
             }
             else
             {
                 if (replaceDstScreen.color != null)
                 {
                     g.SetColor(replaceDstScreen.color);
                     g.FillRect(0, 0, GetWidth(), GetHeight());
                     g.ResetColor();
                 }
                 if (replaceDstScreen.currentScreen != null)
                 {
                     g.DrawTexture(replaceDstScreen.currentScreen, 0, 0,
                             GetWidth(), GetHeight());
                 }
                 replaceDstScreen.CreateUI(g);
                 if (color != null)
                 {
                     g.SetColor(color);
                     g.FillRect(dstPos.X(), dstPos.Y(), GetWidth(),
                             GetHeight());
                     g.ResetColor();
                 }
                 if (GetBackground() != null)
                 {
                     g.DrawTexture(currentScreen, dstPos.X(), dstPos.Y(),
                             GetWidth(), GetHeight());
                 }
                 if (dstPos.X() != 0 || dstPos.Y() != 0)
                 {
                     g.SetClip(dstPos.X(), dstPos.Y(), GetWidth(),
                             GetHeight());
                     g.Translate(dstPos.X(), dstPos.Y());
                 }
                 Repaint(g);
                 if (dstPos.X() != 0 || dstPos.Y() != 0)
                 {
                     g.Translate(-dstPos.X(), -dstPos.Y());
                     g.ClearClip();
                 }
             }
         }
     }
     else
     {
         Repaint(g);
     }
 }
Beispiel #3
0
		protected internal override void CreateCustomUI(GLEx g, int x, int y, int w, int h) {
			if (visible) {
				if (animation.GetSpriteImage() != null) {
					g.DrawTexture(animation.GetSpriteImage(), x, y);
				}
				if (x != 0 && y != 0) {
					g.Translate(x, y);
					Paint(g);
					g.Translate(-x, -y);
				} else {
					Paint(g);
				}
			}
		}
Beispiel #4
0
        public virtual void PaintObjects(GLEx g, int minX, int minY, int maxX, int maxY)
        {
            lock (objects)
            {
                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 (thing.isAnimation)
                        {

                            if (isBitmapFilter)
                            {
                                g.DrawTexture(actorImage, actorX, actorY, width,
                                        height, angle, thing.filterColor);
                            }
                            else
                            {
                                if (colorAlpha != 1f)
                                {
                                    g.SetAlpha(colorAlpha);
                                }
                                g.DrawTexture(actorImage, actorX, actorY, width,
                                        height, angle);
                                if (colorAlpha != 1f)
                                {
                                    g.SetAlpha(1f);
                                }
                            }

                        }
                        else
                        {

                            int texId = actorImage.GetTextureID();

                            LTextureBatch batch = (LTextureBatch)textures
                                    .GetValue(texId);

                            if (batch == null)
                            {
                                LTextureBatch pBatch = LTextureBatch
                                        .BindBatchCache(this, texId,
                                                actorImage);
                                batch = pBatch;
                                batch.GLBegin();

                                textures.Put(texId, batch);

                            }

                            batch.SetTexture(actorImage);

                            if (isBitmapFilter)
                            {
                                batch.Draw(actorX, actorY, width, height, angle,
                                        thing.filterColor);
                            }
                            else
                            {
                                if (colorAlpha != 1f)
                                {
                                    alphaColor.a = colorAlpha;
                                }
                                batch.Draw(actorX, actorY, width, height, angle,
                                        alphaColor);
                                if (colorAlpha != 1f)
                                {
                                    alphaColor.a = 1;
                                }
                            }

                        }
                    }
                    if (thing.isConsumerDrawing)
                    {
                        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);
                        }
                    }
                }

                int size = textures.Size();
                if (size > 0)
                {
                    for (int i = 0; i < size; i++)
                    {
                        LTextureBatch batch = (LTextureBatch)textures.Get(i);
                        batch.GLEnd();
                    }
                    textures.Clear();
                }
            }
        }
Beispiel #5
0
 protected internal override void CreateCustomUI(GLEx g, int x, int y, int w, int h)
 {
     if (!visible)
     {
         return;
     }
     PaintObjects(g, x, y, x + w, y + h);
     if (x == 0 && y == 0)
     {
         Paint(g);
     }
     else
     {
         g.Translate(x, y);
         Paint(g);
         g.Translate(-x, -y);
     }
 }
Beispiel #6
0
 public void Draw(GLEx g, int x, int y)
 {
     LColor oldColor = g.GetColor();
     g.SetColor(color);
     switch (style)
     {
         case 0:
             float alpha = 0.0f;
             int nx = x + width / 2 - (int)r * 4,
             ny = y + height / 2 - (int)r * 4;
             g.Translate(nx, ny);
             for (IIterator it = new IteratorAdapter(list.GetEnumerator()); it.HasNext(); )
             {
                 RectBox s = (RectBox)it.Next();
                 alpha = alpha + 0.1f;
                 g.SetAlpha(alpha);
                 g.FillOval(s.x, s.y, s.width, s.height);
             }
             g.SetAlpha(1.0F);
             g.Translate(-nx, -ny);
             break;
         case 1:
             g.SetLineWidth(10);
             g.Translate(x, y);
             g.SetColor(Fill);
             g.DrawOval(0, 0, width, height);
             int sa = angle % 360;
             g.FillArc(x + (width - paintWidth) / 2, y
                     + (height - paintHeight) / 2, paintWidth, paintHeight,
                     sa, sa + ANGLE_STEP);
             g.Translate(-x, -y);
             g.ResetLineWidth();
             break;
     }
     g.SetColor(oldColor);
 }
Beispiel #7
0
		public void CreateUI(GLEx g) {
			if (!visible) {
				return;
			}
			if (GetX() != 0 || GetY() != 0) {
				g.Translate(GetX(), GetY());
			}
			Draw(g);
			if (GetX() != 0 || GetY() != 0) {
				g.Translate(-GetX(), -GetY());
			}
		}