示例#1
0
		public void DrawWidth(GLEx g, int x, int y) {
			try {
				if (drawTexWidth == null) {
					LImage img = LImage.CreateImage(width, height, true);
					LGraphics gl = img.GetLGraphics();
					for (int i = 0; i < width; i++) {
						gl.SetColor(
								(start.GetRed() * (width - i)) / width
										+ (end.GetRed() * i) / width,
								(start.GetGreen() * (width - i)) / width
										+ (end.GetGreen() * i) / width,
								(start.GetBlue() * (width - i)) / width
										+ (end.GetBlue() * i) / width, alpha);
						gl.DrawLine(i, 0, i, height);
					}
					drawTexWidth = new LTexture(GLLoader.GetTextureData(img),
							Loon.Core.Graphics.Opengl.LTexture.Format.SPEED);
					gl.Dispose();
					gl = null;
				}
				g.DrawTexture(drawTexWidth, x, y);
			} catch (Exception) {
				for (int i = 0; i < width; i++) {
					g.SetColorValue(
							(start.GetRed() * (width - i)) / width
									+ (end.GetRed() * i) / width,
							(start.GetGreen() * (width - i)) / width
									+ (end.GetGreen() * i) / width,
							(start.GetBlue() * (width - i)) / width
									+ (end.GetBlue() * i) / width, alpha);
					g.DrawLine(i + x, y, i + x, y + height);
				}
			}
		}
示例#2
0
 public virtual void Draw(GLEx g)
 {
     if (exist)
     {
         rain.Draw(x, y);
     }
 }
示例#3
0
        public override void Draw(GLEx g)
        {
            if (IsOnLoadComplete())
            {
                batch.Begin();

                gameCollection.Draw(batch, gameTime);
                if (drawablesToDraw.Count > 0)
                {
                    CollectionUtils.Clear(drawablesToDraw);
                }

                foreach (Drawable drawable in drawables)
                {
                    CollectionUtils.Add(drawablesToDraw, drawable);
                }

                foreach (Drawable drawable in drawablesToDraw)
                {
                    if (drawable._enabled)
                    {
                        if (drawable.GetDrawableState() == Painting.DrawableState.Hidden)
                        {
                            continue;
                        }
                        drawable.Draw(batch, gameTime);
                    }
                }
                Draw(batch);
                batch.End();
            }
        }
示例#4
0
 public override void Draw(Loon.Core.Graphics.Opengl.GLEx g)
 {
     if (IsOnLoadComplete())
     {
         map.Draw(g, 5, 5);
         g.DrawString("默认支持(DLL中自带)完整中文字库", 26, 66);
     }
 }
示例#5
0
		public override void CreateUI(GLEx g, int x, int y, LComponent component,
				LTexture[] buttonImage) {
			if (visible && goalPath != null) {
				g.SetLineWidth(lineWidth);
				g.SetColor(color);
				g.Draw(goalPath);
				g.ResetLineWidth();
				g.ResetColor();
			}
		}
示例#6
0
		public virtual void CreateUI(GLEx g) {
			if (visible) {
				if (alpha > 0 && alpha < 1) {
					g.SetAlpha(alpha);
				}
				g.DrawTexture(image, X(), Y());
				if (alpha > 0 && alpha < 1) {
					g.SetAlpha(1.0f);
				}
			}
		}
示例#7
0
 // 绘制
 public void Draw(GLEx g)
 {
     if (!visible)
     {
         return;
     }
     alpha = startTime / 255f;
     g.SetAlpha(alpha);
     g.DrawTexture(texture, info.offsetX + x, info.offsetY + y, width, height);
     g.SetAlpha(1f);
 }
示例#8
0
 public override void DrawScreen(GLEx g)
 {
     switch (type)
     {
         case 1:
             g.SetAntiAlias(true);
             g.DrawSixStart(LColor.yellow, 130, 100, 100);
             g.SetAntiAlias(false);
             break;
     }
     g.ResetColor();
 }
示例#9
0
文件: Game1.cs 项目: zhwk022/LGame
        public override void Draw(Loon.Core.Graphics.Opengl.GLEx g)
        {
            if (IsOnLoadComplete())
            {
                map.Draw(g, 5, 5);
                g.DrawString("默认支持(DLL中自带)完整中文字库", 26, 66);

                /*this.renderer.Begin(GLType.Filled);
                 * this.renderer.SetColor(LColor.red);
                 * this.renderer.Oval(166, 166, 20);
                 * this.renderer.End();*/
            }
        }
示例#10
0
		public void CreateUI(GLEx g) {
			if (!visible) {
				return;
			}
			int size = barCaches.Count;
			if (size > 0) {
				 lock (barCaches) {
								StatusBar.GLBegin();
								for (int i = 0; i < size; i++) {
									StatusBar bar = barCaches[i];
									if (bar != null && bar.visible) {
										bar.CreateUI(g);
									}
								}
								StatusBar.GLEnd();
							}
			}
		}
示例#11
0
 public void Draw(GLEx gl)
 {
     if (logo == null || finish)
     {
         return;
     }
     if (!logo.IsLoaded())
     {
         this.logo.LoadTexture();
     }
     if (centerX == 0 || centerY == 0)
     {
         this.centerX = (int)(LSystem.screenRect.width)
              / 2 - logo.GetWidth() / 2;
         this.centerY = (int)(LSystem.screenRect.height)
                 / 2 - logo.GetHeight() / 2;
     }
     if (logo == null || !logo.IsLoaded())
     {
         return;
     }
     alpha = (curFrame / curTime);
     if (inToOut)
     {
         curFrame++;
         if (curFrame == curTime)
         {
             alpha = 1f;
             inToOut = false;
         }
     }
     else if (!inToOut)
     {
         curFrame--;
         if (curFrame == 0)
         {
             alpha = 0f;
             finish = true;
         }
     }
     gl.Reset(true);
     gl.SetAlpha(alpha);
     gl.DrawTexture(logo, centerX, centerY);
 }
示例#12
0
		public void CreateUI(GLEx g) {
			if (visible) {
				LFont oldFont = g.GetFont();
				uint oldColor = g.GetColorRGB();
				g.SetFont(font);
				g.SetColor(color);
				this.width = font.StringWidth(label);
				this.height = font.GetSize();
				if (alpha > 0 && alpha < 1) {
					g.SetAlpha(alpha);
					g.DrawString(label, X(), Y());
					g.SetAlpha(1.0F);
				} else {
					g.DrawString(label, X(), Y());
				}
				g.SetFont(oldFont);
				g.SetColor(oldColor);
			}
		}
示例#13
0
 public override void CreateUI(GLEx g)
 {
     base.CreateUI(g);
     switch (type)
     {
         case 0:
             if (a1 == null)
             {
                 a1 = Animation.GetDefaultAnimation("assets/s.png", 3, 48, 48,
                         100);
             }
             animation = a1;
             break;
         case 2:
             if (a2 == null)
             {
                 a2 = Animation
                         .GetDefaultAnimation("assets/s1.png", 48, 48, 100);
             }
             animation = a2;
             break;
         default:
             break;
     }
     if (animation == null)
     {
         return;
     }
     if (type == 0 || type == 2)
     {
         LTexture img = animation.GetSpriteImage();
         if (img != null)
         {
             g.DrawTexture(img, X() + (GetWidth() - img.GetWidth()) / 2, Y()
                     + (GetHeight() - img.GetHeight()) / 2);
         }
     }
 }
示例#14
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);
 }
示例#15
0
 internal void Paint(GLEx g)
 {
     switch (type)
     {
         case DRAW_USER:
             lock (this)
             {
                 screen.Draw(g);
             }
             break;
         case DRAW_SPRITE:
             lock (this)
             {
                 if (screen.spriteRun)
                 {
                     screen.sprites.CreateUI(g);
                 }
                 else if (screen.spriteRun = (screen.sprites != null && screen.sprites.Size() > 0))
                 {
                     screen.sprites.CreateUI(g);
                 }
             }
             break;
         case DRAW_DESKTOP:
             lock (this)
             {
                 if (screen.desktopRun)
                 {
                     screen.desktop.CreateUI(g);
                 }
                 else if (screen.desktopRun = (screen.desktop != null && screen.desktop.Size() > 0))
                 {
                     screen.desktop.CreateUI(g);
                 }
             }
             break;
     }
 }
示例#16
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);
     }
 }
示例#17
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);
         }
     }
 }
示例#18
0
        protected internal virtual void BeforeUI(GLEx g)
        {

        }
示例#19
0
        protected internal virtual void AfterUI(GLEx g)
        {

        }
示例#20
0
 private void DrawBar(GLEx g, float v1, float v2, float size, float x,
         float y)
 {
     float cv1 = (width * v1) / size;
     float cv2;
     if (v1 == v2)
     {
         cv2 = cv1;
     }
     else
     {
         cv2 = (width * v2) / size;
     }
     if (!useBegin)
     {
         texture.GLBegin();
     }
     if (cv1 < width || cv2 < height)
     {
         texture.Draw(x, y, width, height, backPos[0], backPos[1],
                 backPos[2], backPos[3]);
     }
     if (valueMin < value_ren)
     {
         if (cv1 == width)
         {
             texture.Draw(x, y, cv1, height, beforePos[0], beforePos[1],
                     beforePos[2], beforePos[3]);
         }
         else
         {
             if (!dead)
             {
                 texture.Draw(x, y, cv2, height, afterPos[0], afterPos[1],
                         afterPos[2], afterPos[3]);
             }
             texture.Draw(x, y, cv1, height, beforePos[0], beforePos[1],
                     beforePos[2], beforePos[3]);
         }
     }
     else
     {
         if (cv2 == width)
         {
             texture.Draw(x, y, cv2, height, beforePos[0], beforePos[1],
                     beforePos[2], beforePos[3]);
         }
         else
         {
             texture.Draw(x, y, cv1, height, afterPos[0], afterPos[1],
                     afterPos[2], afterPos[3]);
             texture.Draw(x, y, cv2, height, beforePos[0], beforePos[1],
                     beforePos[2], beforePos[3]);
         }
     }
     if (!useBegin)
     {
         texture.GLEnd();
     }
 }
示例#21
0
 public void Draw(GLEx g, int minX, int minY, int maxX, int maxY)
 {
     if (!visible)
     {
         return;
     }
     lock (values)
     {
         batch.Begin();
         if (alpha > 0 && alpha < 1)
         {
             batch.SetAlpha(alpha);
         }
         for (int i = 0; i < count; i++)
         {
             LTextureObject tex2d = this.values[i];
             if (tex2d == null || !tex2d.visible)
             {
                 continue;
             }
             nx = minX + tex2d.x;
             ny = minY + tex2d.y;
             if (nx + tex2d.width < minX || nx > maxX
                     || ny + tex2d.height < minY || ny > maxY)
             {
                 continue;
             }
             LTexture texture = tex2d.texture;
             if (texture == null)
             {
                 continue;
             }
             if (tex2d.width != 0 && tex2d.height != 0)
             {
                 batch.Draw(texture, tex2d.x, tex2d.y, tex2d.width,
                         tex2d.height);
             }
             else
             {
                 batch.Draw(texture, tex2d.x, tex2d.y);
             }
         }
         if (alpha > 0 && alpha < 1)
         {
             batch.ResetColor();
         }
         batch.End();
     }
 }
示例#22
0
 internal void Draw(GLEx g)
 {
     if (listener != null)
     {
         listener.Draw(g);
     }
 }
示例#23
0
            public void Draw(GLEx g)
            {

            }
示例#24
0
 public void Draw(GLEx g)
 {
     effect.CreateUI(g);
 }
示例#25
0
 public void Draw(GLEx g)
 {
     wait.CreateUI(g);
 }
示例#26
0
 public void Draw(GLEx g)
 {
     split.CreateUI(g);
 }
示例#27
0
 public void CreateUI(GLEx g)
 {
     if (visible)
     {
         if (showValue)
         {
             hpString = "" + value_ren;
             g.SetColor(LColor.white);
             int cur = g.GetFont().StringWidth(hpString);
             int h = g.GetFont().GetSize();
             g.DrawString("" + value_ren, (X() + width / 2 - cur / 2) + 2,
                     (Y() + height / 2 + h / 2));
         }
         DrawBar(g, goal, current, width, GetX(), GetY());
     }
 }
示例#28
0
 public abstract void Draw(GLEx g);
示例#29
0
 public void Draw(GLEx g)
 {
     Draw(g, 0, 0, width, height);
 }
示例#30
0
 public void Draw(GLEx g)
 {
     cross.CreateUI(g);
 }
示例#31
0
 public void Draw(GLEx g)
 {
     fade.CreateUI(g);
 }
示例#32
0
 public void Draw(GLEx g)
 {
     arc.CreateUI(g);
 }