public virtual void CreateUI(GLEx g) { if (!visible) { return; } image = animation.GetSpriteImage(); if (image == null) { return; } float width = (image.GetWidth() * scaleX); float height = (image.GetHeight() * scaleY); if (filterColor == null) { if (alpha > 0 && alpha < 1) { g.SetAlpha(alpha); } if (LTrans.TRANS_NONE == transform) { g.DrawTexture(image, X(), Y(), width, height, rotation); } else { g.DrawRegion(image, 0, 0, GetWidth(), GetHeight(), transform, X(), Y(), LTrans.TOP | LTrans.LEFT); } if (alpha > 0 && alpha < 1) { g.SetAlpha(1); } return; } else { Color old = g.GetColor(); if (alpha > 0 && alpha < 1) { g.SetAlpha(alpha); } g.SetColor(filterColor); if (LTrans.TRANS_NONE == transform) { g.DrawTexture(image, X(), Y(), width, height, rotation); } else { g.DrawRegion(image, 0, 0, GetWidth(), GetHeight(), transform, X(), Y(), LTrans.TOP | LTrans.LEFT); } g.SetColor(old); if (alpha > 0 && alpha < 1) { g.SetAlpha(1); } return; } }
protected internal override void CreateCustomUI(GLEx g, int x, int y, int w, int h) { if (!visible) { return; } LColor oldColor = g.GetColor(); LFont oldFont = g.GetFont(); g.SetColor(fontColor); g.SetFont(messageFont); sizeFont = messageFont.GetSize(); doubleSizeFont = sizeFont * 2; if (doubleSizeFont == 0) { doubleSizeFont = 20; } messageLeft = (x + doubleSizeFont + sizeFont / 2) + tmpOffset + left + doubleSizeFont; // g.setAntiAlias(true); if (message != null) { messageTop = y + doubleSizeFont + top + 2; g.DrawString(message, messageLeft, messageTop); } else { messageTop = y + top + 2; } nTop = messageTop; if (selects != null) { nLeft = messageLeft - sizeFont / 4; for (int i = 0; i < selects.Length; i++) { nTop += 30; type = i + 1; isSelect = (type == ((selectFlag > 0) ? selectFlag : 1)); if ((buoyage != null) && isSelect) { g.SetAlpha(autoAlpha); g.DrawTexture(buoyage, nLeft, nTop - (int)(buoyage.GetHeight() / 1.5f)); g.SetAlpha(1.0F); } g.DrawString(selects[i], messageLeft, nTop); if ((cursor != null) && isSelect) { g.DrawTexture(cursor, nLeft, nTop - cursor.GetHeight() / 2, LColor.white); } } } // g.setAntiAlias(false); g.SetColor(oldColor); g.SetFont(oldFont); }
public override void Draw(GLEx g) { if (!running || !IsOnLoadComplete() || IsClose()) { return; } if (scrCG == null) { return; } if (scrCG.sleep == 0) { scrCG.Paint(g); DrawScreen(g); if (desktop != null) { desktop.CreateUI(g); } if (sprites != null) { sprites.CreateUI(g); } } else { scrCG.sleep--; if (color != null) { float alpha = (float)(scrCG.sleepMax - scrCG.sleep) / scrCG.sleepMax; if (alpha > 0 && alpha < 1.0) { if (scrCG.getBackgroundCG() != null) { g.DrawTexture(scrCG.getBackgroundCG(), 0, 0); } Color c = g.GetColor(); g.SetColor(color.R, color.G, color.B, (byte)(alpha * 255)); g.FillRect(0, 0, GetWidth(), GetHeight()); g.SetColor(c); } else { Color c = g.GetColor(); g.SetColor(color); g.FillRect(0, 0, GetWidth(), GetHeight()); g.SetColor(c); } } if (scrCG.sleep <= 0) { scrCG.sleep = 0; color = null; } g.SetAlpha(1.0f); } }
public override void Draw(GLEx g) { if (selected) { g.SetColor(255, 0, 0, 100); g.FillOval(-(range * 2 - Field.GetTileWidth()) / 2, -(range * 2 - Field.GetTileHeight()) / 2, this.range * 2 - 1, this.range * 2 - 1); g.SetColor(LColor.red); g.DrawOval(-(range * 2 - Field.GetTileWidth()) / 2, -(range * 2 - Field.GetTileHeight()) / 2, this.range * 2 - 1, this.range * 2 - 1); g.ResetColor(); } }
public override void Paint(GLEx g) { if (selectTurret == 3) { g.SetColor(LColor.red); g.DrawRect(2, 2, this.GetWidth() - 4, this.GetHeight() - 4); g.ResetColor(); } }
public virtual void DrawRectangle(RectBox rect, float r, float g, float b, float a) { GLEx gl = GLEx.Self; if (gl != null) { gl.SetColor(r, g, b, a); gl.FillRect(rect.x, rect.y, rect.width, rect.height); gl.ResetColor(); } }
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(); } }
public void CreateUI(GLEx g) { if (!visible) { return; } if (complete) { return; } if (alpha > 0 && alpha < 1) { g.SetAlpha(alpha); } if (count <= 1) { g.SetColor(color); g.FillRect(X(), Y(), width, height); g.ResetColor(); } else { g.SetColor(color); int length = (int)MathUtils.Sqrt(MathUtils.Pow(width / 2, 2.0f) + MathUtils.Pow(height / 2, 2.0f)); float x = X() + (width / 2 - length); float y = Y() + (height / 2 - length); float w = width / 2 + length - x; float h = height / 2 + length - y; float deg = 360f / this.div * this.count; g.FillArc(x, y, w, h, 0, this.sign[this.turn] * deg); g.ResetColor(); } if (alpha > 0 && alpha < 1) { g.SetAlpha(1f); } }
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); }
public virtual void CreateUI(GLEx g) { if (visible) { LFont oldFont = g.GetFont(); Color oldColor = g.GetColor(); 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() - font.GetAscent()); g.SetAlpha(1.0F); } else { g.DrawString(label, X(), Y() - font.GetAscent()); } g.SetFont(oldFont); g.SetColor(oldColor); } }
public void Draw(GLEx g, int x, int y) { switch (style) { case 0: Color oldColor = g.GetColor(); g.SetColor(color); float alpha = 0.0f; int nx = x + width / 2 - (int)r * 4, ny = y + height / 2 - (int)r * 4; g.Translate(nx, ny); for (IEnumerator <RectBox> it = list.GetEnumerator(); it.MoveNext();) { RectBox s = it.Current; 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); g.SetColor(oldColor); break; case 1: g.SetLineWidth(10); g.Translate(x, y); g.FillOval(0, 0, width, height, fill.Color); int sa = angle % 360; g.FillArc(x + (width - paintWidth) / 2, y + (height - paintHeight) / 2, paintWidth, paintHeight, sa, sa + ANGLE_STEP, Color.Red); g.Translate(-x, -y); g.ResetLineWidth(); break; } }
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()); } }
public override void CreateUI(GLEx g, int x, int y, LComponent component, LTexture[] buttonImage) { LButton button = (LButton)component; if (buttonImage != null) { if (!button.IsEnabled()) { g.DrawTexture(buttonImage[3], x, y); } else if (button.IsTouchPressed()) { g.DrawTexture(buttonImage[2], x, y); } else if (button.IsTouchOver()) { g.DrawTexture(buttonImage[1], x, y); } else { if (type == 1) { g.DrawTexture(buttonImage[0], x, y, LColor.gray); } else { g.DrawTexture(buttonImage[0], x, y); } } } if (text != null) { LFont old = g.GetFont(); g.SetFont(font); g.SetColor(fontColor); g.DrawString( text, x + button.GetOffsetLeft() + (button.GetWidth() - font.StringWidth(text)) / 2, y + button.GetOffsetTop() + (button.GetHeight() - font.GetLineHeight()) / 2 + font.GetLineHeight()); g.SetFont(old); g.ResetColor(); } }
public void CreateUI(GLEx g) { if (!visible) { return; } if (stop) { return; } float alpha = (currentFrame / time); SetOpacity(alpha); if (alpha > 0f) { g.SetColor(color.R, color.G, color.B, (byte)(color.A * alpha)); g.FillRect(offsetX + this.X(), offsetY + this.Y(), width, height); g.ResetColor(); } }
public virtual void CreateUI(GLEx g) { if (!visible) { return; } if (alpha > 0 && alpha < 1) { g.SetAlpha(alpha); } g.SetColor(color); for (int i = 0; i < drops.Length; ++i) { g.FillOval((int)drops[i].x, (int)drops[i].y, 2, 2); } g.ResetColor(); if (alpha > 0 && alpha < 1) { g.SetAlpha(1); } }
public void DrawWidth(GLEx g, int x, int y) { try { if (drawTexWidth == null) { LPixmap img = new LPixmap(width, height, true); for (int i = 0; i < width; i++) { img.SetColor( (byte)((start.R * (width - i)) / width + (end.R * i) / width), (byte)((start.G * (width - i)) / width + (end.G * i) / width), (byte)((start.B * (width - i)) / width + (end.B * i) / width), (byte)alpha); img.DrawLine(i, 0, i, height); } drawTexWidth = img.Texture; } g.DrawTexture(drawTexWidth, x, y); } catch { for (int i = 0; i < width; i++) { g.SetColor( (byte)((start.R * (width - i)) / width + (end.R * i) / width), (byte)((start.G * (width - i)) / width + (end.G * i) / width), (byte)((start.B * (width - i)) / width + (end.B * i) / width), (byte)alpha); g.DrawLine(i + x, y, i + x, y + height); } } }
public void DrawHeight(GLEx g, int x, int y) { try { if (drawTexHeight == null) { LPixmap img = new LPixmap(width, height, true); for (int i = 0; i < height; i++) { img.SetColor((byte)( (start.R * (height - i)) / height + (end.R * i) / height), (byte)((start.G * (height - i)) / height + (end.G * i) / height), (byte)((start.B * (height - i)) / height + (end.B * i) / height), (byte)(alpha)); img.DrawLine(0, i, width, i); } drawTexHeight = img.Texture; } g.DrawTexture(drawTexHeight, x, y); } catch { for (int i = 0; i < height; i++) { g.SetColor( (byte)((start.R * (height - i)) / height + (end.R * i) / height), (byte)((start.G * (height - i)) / height + (end.G * i) / height), (byte)((start.B * (height - i)) / height + (end.B * i) / height), (byte)alpha); g.DrawLine(x, i + y, x + width, i + y); } } }
public virtual void CreateUI(GLEx g) { if (!isVisible) { return; } this.Setup(); int pointsLength = points.Count; CycleProgress point; int index; int frameD; int indexD; float size = (pointsLength * this.trailLength); for (float i = -1, l = size; ++i < l && !this.stopped;) { index = (int)(frame + i); if (index < pointsLength) { point = points[index]; } else { point = points[index - pointsLength]; } this.alpha = (i / (l - 1)); frameD = frame / (pointsLength - 1); indexD = (int)alpha; if (lineWidth > 0) { g.SetLineWidth(lineWidth); } if (scaleX != 1 || scaleY != 1) { g.Scale(scaleX, scaleY); } if (alpha > 0 && alpha < 1) { g.SetAlpha(alpha); } g.SetColor(color); Step(g, point, indexD, frameD, color, alpha); g.ResetColor(); if (alpha > 0 && alpha < 1) { g.SetAlpha(1); } if (lineWidth > 0) { g.ResetLineWidth(); } if (scaleX != 1 || scaleY != 1) { g.Restore(); } } }