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 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 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(); } }
protected virtual void DrawXNA(float totalSeconds) { GLEx gl = process.GL; if (gl != null) { if (!process.Next()) { return; } if (isScale) { gl.Scale(LSystem.scaleWidth, LSystem.scaleHeight); } int repaintMode = process.GetRepaintMode(); switch (repaintMode) { case Screen.SCREEN_BITMAP_REPAINT: gl.Reset(clear); if (process.GetX() == 0 && process.GetY() == 0) { gl.DrawTexture(process.GetBackground(), 0, 0); } else { gl.DrawTexture(process.GetBackground(), process.GetX(), process.GetY()); } break; case Screen.SCREEN_COLOR_REPAINT: LColor c = process.GetColor(); if (c != null) { gl.DrawClear(c); } break; case Screen.SCREEN_CANVAS_REPAINT: gl.Reset(clear); break; case Screen.SCREEN_NOT_REPAINT: gl.Reset(clear); break; default: gl.Reset(clear); if (process.GetX() == 0 && process.GetY() == 0) { gl.DrawTexture( process.GetBackground(), repaintMode / 2 - LSystem.random.Next(repaintMode), repaintMode / 2 - LSystem.random.Next(repaintMode)); } else { gl.DrawTexture(process.GetBackground(), process.GetX() + repaintMode / 2 - LSystem.random.Next(repaintMode), process.GetY() + repaintMode / 2 - LSystem.random.Next(repaintMode)); } break; } process.Draw(); process.Drawable(elapsedTime); if (isFPS) { gl.Reset(false); framecount++; timeSinceLastUpdate += totalSeconds; if (timeSinceLastUpdate > updateInterval) { frameRate = Convert.ToInt16(framecount / timeSinceLastUpdate); framecount = 0; timeSinceLastUpdate -= updateInterval; } fps = string.Format(numformat, "FPS:{0}", frameRate); if (gl.UseFont) { gl.DrawString(fps, 5, 5, LColor.white); } else { if (XNAConfig.IsActive() && font == null) { font = XNAConfig.LoadFnt(LSystem.FRAMEWORK_IMG_NAME + "system"); } if (font != null) { font.DrawBatchString(5, 5, fps, LColor.white); } } } process.DrawEmulator(); gl.RestoreMatrix(); } }