internal void End(LColor col) { glbase.Transform(this.primitiveType, this.numVertices, this.vertexsBuffer, this.texCoordsBuffer, this.colorsBuffer, this.hasCols, true, col); glbase.Send(this.primitiveType, this.numVertices); glbase.Clear(m_maxVertices); GLEx.GL.EnableTextures(); }
public ParticleSystem(string defaultSpriteRef, int maxParticles, LColor mask) { this.maxParticlesPerEmitter = maxParticles; this.mask = mask; SetDefaultImageName(defaultSpriteRef); dummy = CreateParticle(this); }
public static LImage CreateFontImage(LFont font, LColor color, string text) { LImage image = LImage.CreateImage(font.StringWidth(text), font.GetHeight()); LGraphics g = image.GetLGraphics(); g.SetFont(font); g.DrawString(text, 0, 0, color); g.Dispose(); return image; }
public void AdjustColor(float r, float g, float b, float a) { if (color == null) { color = new LColor(1, 1, 1, 1f); } color.r += r; color.g += g; color.b += b; color.a += a; }
public void AdjustColor(int r, int g, int b, int a) { if (color == null) { color = new LColor(1, 1, 1, 1f); } color.r += (r / 255.0f); color.g += (g / 255.0f); color.b += (b / 255.0f); color.a += (a / 255.0f); }
public void ClearDraw(LColor c) { if (c != null) { ClearDraw(c.Color); } }
public virtual void SetFontColor(LColor fontColor) { this.fontColor = fontColor; }
public void AddColorPoint(float pos, LColor col) { colors.Add(new ColorRecord(pos, col)); }
public static LTransition NewCrossRandom(LColor c) { return(NewCross(MathUtils.Random(0, 1), TextureUtils .CreateTexture(LSystem.screenRect.width, LSystem.screenRect.height, c))); }
public Loon.Core.Geom.Point.Point2i Draw(string name, float x, float y, float w, float h, LColor color) { return Draw(name, x, y, w, h, 0, color); }
public void DrawOnlyBatch(int id, float x, float y, LColor[] c) { this.Pack(); PackEntry entry = GetEntry(id); if (entry == null) { return; } if (texture.IsBatch()) { texture.Draw(x, y, entry.bounds.Width(), entry.bounds.Height(), entry.bounds.left, entry.bounds.top, entry.bounds.right, entry.bounds.bottom, c); } }
public void DrawSixStart(LColor color, int x, int y, int r) { DrawSixStart(color.Color, x, y, r); }
public _Fade(int type, LColor c) { fade = FadeEffect.GetInstance(type, c); }
public void SetFilterColor(LColor f) { this.filterColor.SetColor(f); }
private void Load(string script) { string[] op = StringUtils.Split(script, "="); if (op.Length == 2) { string key = op[0].Trim(); string value_ren = op[1].Trim(); if ("path".Equals(key, StringComparison.InvariantCultureIgnoreCase)) { path = value_ren.Replace("\"", ""); if (texture != null) { texture.Destroy(); texture = null; } if (GLEx.Self != null) { texture = new LTexture(path); imageWidth = texture.GetWidth(); imageHeight = texture.GetHeight(); } } if ("imagewidth".Equals(key, StringComparison.InvariantCultureIgnoreCase)) { if (NumberUtils.IsNan(value_ren)) { imageWidth = Int32.Parse(value_ren); } } else if ("alpha".Equals(key, StringComparison.InvariantCultureIgnoreCase)) { if (NumberUtils.IsNan(value_ren)) { alpha = Single.Parse(value_ren, JavaRuntime.NumberFormat); } } else if ("angle".Equals(key, StringComparison.InvariantCultureIgnoreCase)) { if (NumberUtils.IsNan(value_ren)) { angle = Single.Parse(value_ren, JavaRuntime.NumberFormat); } } else if ("color".Equals(key, StringComparison.InvariantCultureIgnoreCase)) { string[] p = StringUtils.Split(value_ren, ","); if (p.Length > 2 && p.Length < 5) { for (int i = 0; i < p.Length; i++) { p[i] = p[i].Replace("^[\\t ]*", "").Replace( "[\\t ]*$", ""); } if (p.Length == 3) { color = new LColor(Int32.Parse(p[0]), Int32.Parse(p[1]), Int32.Parse(p[2])); } if (p.Length == 4) { color = new LColor(Int32.Parse(p[0]), Int32.Parse(p[1]), Int32.Parse(p[2]), Int32.Parse(p[3])); } } } else if ("imageheight".Equals(key, StringComparison.InvariantCultureIgnoreCase)) { if (NumberUtils.IsNan(value_ren)) { imageHeight = Int32.Parse(value_ren); } } else if ("width".Equals(key, StringComparison.InvariantCultureIgnoreCase)) { if (NumberUtils.IsNan(value_ren)) { width = Int32.Parse(value_ren); } } else if ("height".Equals(key, StringComparison.InvariantCultureIgnoreCase)) { if (NumberUtils.IsNan(value_ren)) { height = Int32.Parse(value_ren); } } else if ("time".Equals(key, StringComparison.InvariantCultureIgnoreCase)) { if (NumberUtils.IsNan(value_ren)) { tmp_time = Int32.Parse(value_ren); } } else if ("pos".Equals(key, StringComparison.InvariantCultureIgnoreCase)) { string[] p_0 = StringUtils.Split(value_ren, ","); for (int i_1 = 0; i_1 < p_0.Length; i_1++) { p_0[i_1] = p_0[i_1].Replace("^[\\t ]*", "").Replace( "[\\t ]*$", ""); } switch (p_0.Length) { case 1: if (NumberUtils.IsNan(p_0[0])) { CollectionUtils.Add(posxTmps, Int32.Parse(p_0[0])); CollectionUtils.Add(posyTmps, Int32.Parse(p_0[0])); CollectionUtils.Add(time, tmp_time); alltime += tmp_time; } break; case 2: if (NumberUtils.IsNan(p_0[0]) && NumberUtils.IsNan(p_0[1])) { CollectionUtils.Add(posxTmps, Int32.Parse(p_0[0])); CollectionUtils.Add(posyTmps, Int32.Parse(p_0[1])); CollectionUtils.Add(time, tmp_time); alltime += tmp_time; } break; } } } }
public void NextScript() { lock (synch) { if (command != null && !IsClose() && running) { for (; isRunning = command.Next();) { string result = command.DoExecute(); if (result == null) { continue; } if (!NextScript(result)) { break; } IList commands = Command.SplitToList(result, " "); int size = commands.Count; string cmdFlag = (string)commands[0]; string mesFlag = null, orderFlag = null, lastFlag = null; if (size == 2) { mesFlag = (string)commands[1]; } else if (size == 3) { mesFlag = (string)commands[1]; orderFlag = (string)commands[2]; } else if (size == 4) { mesFlag = (string)commands[1]; orderFlag = (string)commands[2]; lastFlag = (string)commands[3]; } if (cmdFlag.Equals(CommandType.L_APLAY, StringComparison.InvariantCultureIgnoreCase)) { autoPlay = true; continue; } if (cmdFlag.Equals(CommandType.L_ASTOP, StringComparison.InvariantCultureIgnoreCase)) { autoPlay = false; continue; } if (cmdFlag.Equals(CommandType.L_ADELAY, StringComparison.InvariantCultureIgnoreCase)) { if (mesFlag != null) { if (MathUtils.IsNan(mesFlag)) { autoTimer.SetDelay(int.Parse(mesFlag)); } } continue; } if (cmdFlag.Equals(CommandType.L_WAIT, StringComparison.InvariantCultureIgnoreCase)) { scrFlag = true; break; } if (cmdFlag.Equals(CommandType.L_SNOW, StringComparison.InvariantCultureIgnoreCase) || cmdFlag.Equals(CommandType.L_RAIN, StringComparison.InvariantCultureIgnoreCase) || cmdFlag.Equals(CommandType.L_PETAL, StringComparison.InvariantCultureIgnoreCase)) { if (sprites != null) { bool flag = false; ISprite[] ss = sprites.GetSprites(); for (int i = 0; i < ss.Length; i++) { ISprite s = ss[i]; if (s is FreedomEffect) { flag = true; break; } } if (!flag) { if (cmdFlag .Equals(CommandType.L_SNOW)) { sprites.Add(FreedomEffect.GetSnowEffect()); } else if (cmdFlag .Equals(CommandType.L_RAIN)) { sprites.Add(FreedomEffect.GetRainEffect()); } else if (cmdFlag .Equals(CommandType.L_PETAL)) { sprites.Add(FreedomEffect.GetPetalEffect()); } } } continue; } if (cmdFlag.Equals(CommandType.L_SNOWSTOP) || cmdFlag.Equals(CommandType.L_RAINSTOP) || cmdFlag .Equals(CommandType.L_PETALSTOP)) { if (sprites != null) { ISprite[] ss = sprites.GetSprites(); for (int i = 0; i < ss.Length; i++) { ISprite s = ss[i]; if (s is FreedomEffect) { if (cmdFlag .Equals(CommandType.L_SNOWSTOP)) { if (((FreedomEffect)s).GetKernels()[0] is SnowKernel) { sprites.Remove(s); } } else if (cmdFlag .Equals(CommandType.L_RAINSTOP)) { if (((FreedomEffect)s).GetKernels()[0] is RainKernel) { sprites.Remove(s); } } else if (cmdFlag .Equals(CommandType.L_PETALSTOP)) { if (((FreedomEffect)s).GetKernels()[0] is PetalKernel) { sprites.Remove(s); } } } } } continue; } if (cmdFlag.Equals(CommandType.L_PLAY)) { AssetsSoundManager.GetInstance().PlaySound(mesFlag, false); continue; } if (cmdFlag.Equals(CommandType.L_PLAYLOOP)) { AssetsSoundManager.GetInstance().PlaySound(mesFlag, true); continue; } if (cmdFlag.Equals(CommandType.L_PLAYSTOP)) { if (MathUtils.IsNan(mesFlag)) { AssetsSoundManager.GetInstance().StopSound(int.Parse(mesFlag)); } else { AssetsSoundManager.GetInstance().StopSoundAll(); } continue; } if (cmdFlag.Equals(CommandType.L_FADEOUT) || cmdFlag.Equals(CommandType.L_FADEIN)) { scrFlag = true; LColor color = LColor.black; if (mesFlag.Equals("red")) { color = LColor.red; } else if (mesFlag.Equals("yellow")) { color = LColor.yellow; } else if (mesFlag.Equals("white")) { color = LColor.white; } else if (mesFlag.Equals("black")) { color = LColor.black; } else if (mesFlag.Equals("cyan")) { color = LColor.cyan; } else if (mesFlag.Equals("green")) { color = LColor.green; } else if (mesFlag.Equals("orange")) { color = LColor.orange; } else if (mesFlag.Equals("pink")) { color = LColor.pink; } if (sprites != null) { sprites.RemoveAll(); if (cmdFlag.Equals(CommandType.L_FADEIN)) { sprites.Add(FadeEffect.GetInstance( ISprite_Constants.TYPE_FADE_IN, color)); } else { sprites.Add(FadeEffect.GetInstance( ISprite_Constants.TYPE_FADE_OUT, color)); } } continue; } if (cmdFlag.Equals(CommandType.L_SELLEN)) { if (mesFlag != null) { if (MathUtils.IsNan(mesFlag)) { select.SetLeftOffset(int.Parse(mesFlag)); } } continue; } if (cmdFlag.Equals(CommandType.L_SELTOP)) { if (mesFlag != null) { if (MathUtils.IsNan(mesFlag)) { select.SetTopOffset(int.Parse(mesFlag)); } } continue; } if (cmdFlag.Equals(CommandType.L_MESLEN)) { if (mesFlag != null) { if (MathUtils.IsNan(mesFlag)) { message.SetMessageLength(int .Parse(mesFlag)); } } continue; } if (cmdFlag.Equals(CommandType.L_MESTOP)) { if (mesFlag != null) { if (MathUtils.IsNan(mesFlag)) { message.SetTopOffset(int.Parse(mesFlag)); } } continue; } if (cmdFlag.Equals(CommandType.L_MESLEFT)) { if (mesFlag != null) { if (MathUtils.IsNan(mesFlag)) { message.SetLeftOffset(int.Parse(mesFlag)); } } continue; } if (cmdFlag.Equals(CommandType.L_MESCOLOR)) { if (mesFlag != null) { if (mesFlag.Equals("red")) { message.SetFontColor(LColor.red); } else if (mesFlag.Equals("yellow")) { message.SetFontColor(LColor.yellow); } else if (mesFlag.Equals("white")) { message.SetFontColor(LColor.white); } else if (mesFlag.Equals("black")) { message.SetFontColor(LColor.black); } else if (mesFlag.Equals("cyan")) { message.SetFontColor(LColor.cyan); } else if (mesFlag.Equals("green")) { message.SetFontColor(LColor.green); } else if (mesFlag.Equals("orange")) { message.SetFontColor(LColor.orange); } else if (mesFlag.Equals("pink")) { message.SetFontColor(LColor.pink); } } continue; } if (cmdFlag.Equals(CommandType.L_MES)) { if (select.IsVisible()) { select.SetVisible(false); } scrFlag = true; string nMessage = mesFlag; message.SetMessage(StringUtils.Replace(nMessage, "&", " ")); message.SetVisible(true); break; } if (cmdFlag.Equals(CommandType.L_MESSTOP)) { scrFlag = true; message.SetVisible(false); select.SetVisible(false); continue; } if (cmdFlag.Equals(CommandType.L_SELECT)) { selectMessage = mesFlag; continue; } if (cmdFlag.Equals(CommandType.L_SELECTS)) { if (message.IsVisible()) { message.SetVisible(false); } select.SetVisible(true); scrFlag = true; isSelectMessage = true; string[] selects = command.GetReads(); select.SetMessage(selectMessage, selects); break; } if (cmdFlag.Equals(CommandType.L_SHAKE)) { scrCG.shakeNumber = int.Parse(mesFlag); continue; } if (cmdFlag.Equals(CommandType.L_CGWAIT)) { scrFlag = false; break; } if (cmdFlag.Equals(CommandType.L_SLEEP)) { scrCG.sleep = int.Parse(mesFlag); scrCG.sleepMax = int.Parse(mesFlag); scrFlag = false; break; } if (cmdFlag.Equals(CommandType.L_FLASH)) { scrFlag = true; string[] colors = null; if (mesFlag != null) { colors = StringUtils.Split(mesFlag, ","); } else { colors = new string[] { "0", "0", "0" }; } if (color == null && colors != null && colors.Length == 3) { color = new LColor(int.Parse(colors[0]) , int.Parse(colors[1]) , int.Parse(colors[2]) ); scrCG.sleep = 20; scrCG.sleepMax = scrCG.sleep; scrFlag = false; } else { color = null; } continue; } if (cmdFlag.Equals(CommandType.L_GB)) { if (mesFlag == null) { return; } if (mesFlag.Equals("none")) { scrCG.NoneBackgroundCG(); } else { scrCG.SetBackgroundCG(mesFlag); } continue; } if (cmdFlag.Equals(CommandType.L_CG)) { if (mesFlag == null) { return; } if (scrCG != null && scrCG.Count() > LSystem.DEFAULT_MAX_CACHE_SIZE) { scrCG.Dispose(); } if (mesFlag.Equals(CommandType.L_DEL)) { if (orderFlag != null) { scrCG.Remove(orderFlag); } else { scrCG.Dispose(); } } else if (lastFlag != null && CommandType.L_TO.Equals(orderFlag)) { scrCG.Replace(mesFlag, lastFlag); } else { int x = 0, y = 0; if (orderFlag != null) { x = int.Parse(orderFlag); } if (size >= 4) { y = int.Parse((string)commands[3]); } int tx = x; int ty = y; string name = mesFlag; scrCG.Add(name, tx, ty, GetWidth(), GetHeight()); } continue; } if (cmdFlag.Equals(CommandType.L_EXIT)) { scrFlag = true; running = false; OnExit(); break; } } } } }
public override void Draw(GL g) { this.m_onRunning = false; this.m_onPause = false; this.m_onDestroy = false; this.m_onResume = false; lock (m_sync) { m_onRunning = LSystem.isRunning; m_onPause = LSystem.isPaused; m_onDestroy = LSystem.isDestroy; m_onResume = LSystem.isResume; if (LSystem.isResume) { LSystem.isResume = false; } if (LSystem.isPaused) { LSystem.isPaused = false; JavaRuntime.NotifyAll(m_sync); } if (LSystem.isDestroy) { LSystem.isDestroy = false; JavaRuntime.NotifyAll(m_sync); } if (m_onResume) { m_log.I("m_onResume"); timer = LSystem.GetSystemTimer(); lastTimeMicros = timer.GetTimeMicros(); elapsedTime = 0; remainderMicros = 0; m_process.OnResume(); } if (m_onRunning) { if (LSystem.isLogo) { if (logoFlag == null) { LSystem.isLogo = false; return; } logoFlag.Draw(m_process.gl); if (logoFlag.finish) { m_process.gl.SetAlpha(1.0f); m_process.gl.DrawClear(LColor.black); LSystem.isLogo = false; logoFlag.Dispose(); logoFlag = null; return; } return; } if (!m_process.Next()) { return; } m_process.Load(); m_process.Calls(); goalTimeMicros = lastTimeMicros + 1000000L / maxFrames; currTimeMicros = timer.SleepTimeMicros(goalTimeMicros); elapsedTimeMicros = currTimeMicros - lastTimeMicros + remainderMicros; elapsedTime = MathUtils.Max(0, (elapsedTimeMicros / 1000)); remainderMicros = elapsedTimeMicros - elapsedTime * 1000; lastTimeMicros = currTimeMicros; timerContext.millisSleepTime = remainderMicros; timerContext.timeSinceLastUpdate = elapsedTime; ActionControl.Update(elapsedTime); m_process.RunTimer(timerContext); if (LSystem.AUTO_REPAINT) { GLEx gl = m_process.gl; if (gl != null) { if (!m_process.Next()) { return; } //设定graphics.PreferredBackBufferWidth和graphics.PreferredBackBufferHeight时WP会自动缩放画面, //此处无需再缩放一次。 /*if (LSystem.scaleWidth != 1f || LSystem.scaleHeight != 1f) * { * gl.Scale(LSystem.scaleWidth, * LSystem.scaleHeight); * }*/ int repaintMode = m_process.GetRepaintMode(); switch (repaintMode) { case Screen.SCREEN_BITMAP_REPAINT: gl.Reset(true); if (m_process.GetX() == 0 && m_process.GetY() == 0) { gl.DrawTexture(m_process.GetBackground(), 0, 0); } else { gl.DrawTexture(m_process.GetBackground(), m_process.GetX(), m_process.GetY()); } break; case Screen.SCREEN_COLOR_REPAINT: LColor c = m_process.GetColor(); if (c != null) { gl.DrawClear(c); } break; case Screen.SCREEN_CANVAS_REPAINT: gl.Reset(true); break; case Screen.SCREEN_NOT_REPAINT: gl.Reset(true); break; default: gl.Reset(true); if (m_process.GetX() == 0 && m_process.GetY() == 0) { gl.DrawTexture( m_process.GetBackground(), repaintMode / 2 - LSystem.random.Next(repaintMode), repaintMode / 2 - LSystem.random.Next(repaintMode)); } else { gl.DrawTexture(m_process.GetBackground(), m_process.GetX() + repaintMode / 2 - LSystem.random.Next(repaintMode), m_process.GetY() + repaintMode / 2 - LSystem.random.Next(repaintMode)); } break; } m_process.Draw(); m_process.Drawable(elapsedTime); if (isFPS) { this.TickFrames(); fpsFont.DrawString(string.Format(numformat, "FPS:{0}", frameRate), 5, 5, 0, LColor.white); } m_process.DrawEmulator(); m_process.Unload(); gl.Restore(); } } } } }
public void Color(LColor c) { colorsBuffer.Add(c); m_color.SetColor(c.r, c.g, c.b, c.a); hasCols = true; }
public void Mul(LColor mulColor) { Mul(mulColor.Color); }
public void ColorFilter(LColor color) { ColorFilter(color.Color); }
public void Color(LColor c) { batch.GLColor(c); }
public void GLColor(LColor c) { colors.Add(c.Color); this.hasCols = true; }
public void SetFontColor(LColor c) { this.fontColor = c; }
public Loon.Core.Geom.Point.Point2i Draw(int id, float dx1, float dy1, float dx2, float dy2, float sx1, float sy1, float sx2, float sy2, LColor color) { return Draw(id, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, 0, color); }
public void SetFontColor(LColor fontColor) { this.fontColor = fontColor; }
public Loon.Core.Geom.Point.Point2i Draw(string name, float dx1, float dy1, float dx2, float dy2, float sx1, float sy1, float sx2, float sy2, LColor color) { return Draw(name, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, 0, color); }
public ArcEffect(LColor c) : this(c, 0, 0, LSystem.screenRect.width, LSystem.screenRect.height) { }
public void SetColor(float r, float g, float b, float a) { if (color == LColor.white) { color = new LColor(r, g, b, a); } else { color.r = r; color.g = g; color.b = b; color.a = a; } }
public void SetColor(LColor color) { this.color = color; }
public ColorRecord(float pos, LColor col) { this.pos = pos; this.col = col; }
public static LImage CreateFontImage(string fontName, int style, int size, LColor color, string text) { return(CreateFontImage(LFont.GetFont(fontName, style, size), color, text)); }
public void SetColor(LColor c) { if (c == null) { return; } this.colorValue = c.Color; }
public void DrawString(string chars, float x, float y, float rotation, LColor color) { DrawString(x, y, 1f, 1f, 0, 0, rotation, chars, color, 0, chars.Length - 1); }
public void DrawPoint(int x, int y, LColor c) { DrawPoint(x, y, c.Color); }
public void DrawString(string chars, float x, float y, float sx, float sy, float ax, float ay, float rotation, LColor c) { DrawString(x, y, sx, sy, ax, ay, rotation, chars, null, 0, chars.Length - 1); }
public void FourCornersGradient(LColor topLeftColor, LColor topRightColor, LColor bottomRightColor, LColor bottomLeftColor) { FourCornersGradient(topLeftColor.Color, topRightColor.Color, bottomRightColor.Color, bottomLeftColor.Color); }
private void DrawString(float x, float y, float sx, float sy, float ax, float ay, float rotation, string chars, LColor c, int startIndex, int endIndex) { if (displays.Count > LSystem.DEFAULT_MAX_CACHE_SIZE) { lock (displays) { foreach (Loon.Core.Graphics.Opengl.LTextureBatch.GLCache cache in displays.Values) { if (cache != null) { cache.Dispose(); } } } displays.Clear(); } this.intObject = null; this.charCurrent = 0; this.totalWidth = 0; if (rotation != 0 && (ax == 0 && ay == 0)) { ax = font.StringWidth(chars) / 2; ay = font.GetHeight(); } if (useCache) { display = (Loon.Core.Graphics.Opengl.LTextureBatch.GLCache)CollectionUtils.Get(displays, chars); if (display == null) { fontBatch.GLBegin(); char[] charList = chars.ToCharArray(); for (int i = 0; i < charList.Length; i++) { charCurrent = charList[i]; if (charCurrent < totalCharSet) { intObject = charArray[charCurrent]; } else { intObject = (IntObject)CollectionUtils.Get(customChars, (char)charCurrent); } if (intObject != null) { if ((i >= startIndex) || (i <= endIndex)) { if (antiAlias) { fontBatch.DrawQuad(totalWidth * fontScale, 0, (totalWidth + intObject.width) * fontScale, (intObject.height * fontScale), intObject.storedX, intObject.storedY, intObject.storedX + intObject.width, intObject.storedY + intObject.height); } else { fontBatch.DrawQuad(totalWidth, 0, (totalWidth + intObject.width), intObject.height, intObject.storedX, intObject.storedY, intObject.storedX + intObject.width, intObject.storedY + intObject.height); } } totalWidth += intObject.width; } } fontBatch.CommitQuad(c, x, y, sx, sy, ax, ay, rotation); CollectionUtils.Put(displays, chars, display = fontBatch.NewGLCache()); } else if (display != null && fontBatch != null && fontBatch.GetTexture() != null) { LTextureBatch.CommitQuad(fontBatch.GetTexture(), display, c, x, y, sx, sy, ax, ay, rotation); } } else { fontBatch.GLBegin(); char[] charList = chars.ToCharArray(); for (int i = 0; i < charList.Length; i++) { charCurrent = charList[i]; if (charCurrent < totalCharSet) { intObject = charArray[charCurrent]; } else { intObject = (IntObject)CollectionUtils.Get(customChars, (char)charCurrent); } if (intObject != null) { if ((i >= startIndex) || (i <= endIndex)) { if (antiAlias) { fontBatch.DrawQuad(totalWidth * fontScale, 0, (totalWidth + intObject.width) * fontScale, (intObject.height * fontScale), intObject.storedX, intObject.storedY, intObject.storedX + intObject.width, intObject.storedY + intObject.height); } else { fontBatch.DrawQuad(totalWidth, 0, (totalWidth + intObject.width), intObject.height, intObject.storedX, intObject.storedY, intObject.storedX + intObject.width, intObject.storedY + intObject.height); } } totalWidth += intObject.width; } } fontBatch.CommitQuad(c, x, y, sx, sy, ax, ay, rotation); } }
public void Fill3DRect(int x, int y, int width, int height, bool raised) { if (isClose) { return; } Color currentARGB = colorValue; LColor col = new LColor(colorValue); LColor brighter = col.Brighter(); LColor darker = col.Darker(); if (!raised) { colorValue = darker.Color; } FillRect(x + 1, y + 1, width - 2, height - 2); colorValue = raised ? brighter.Color : darker.Color; DrawLine(x, y, x, y + height - 1); DrawLine(x + 1, y, x + width - 2, y); colorValue = raised ? darker.Color : brighter.Color; DrawLine(x + 1, y + height - 1, x + width - 1, y + height - 1); DrawLine(x + width - 1, y, x + width - 1, y + height - 2); colorValue = currentARGB; }
public static LTexture FilterColor(string res, LColor height) { return(TextureUtils.FilterColor(res, height, Loon.Core.Graphics.Opengl.LTexture.Format.DEFAULT)); }
public void DrawRTriangle(LColor color, int x, int y, int r) { DrawRTriangle(color.Color, x, y, r); }
public static LTexture FilterLimitColor(string res, LColor start, LColor end) { return(TextureUtils.FilterLimitColor(res, start, end, Loon.Core.Graphics.Opengl.LTexture.Format.DEFAULT)); }
private void Set(XMLElement Pack) { this.fileName = Pack.GetAttribute("file", null); this.name = Pack.GetAttribute("name", fileName); int r = Pack.GetIntAttribute("r", -1); int g = Pack.GetIntAttribute("g", -1); int b = Pack.GetIntAttribute("b", -1); int a = Pack.GetIntAttribute("a", -1); if (r != -1 && g != -1 && b != -1 && a != -1) { colorMask = new LColor(r, g, b, a); } if (fileName != null) { List<XMLElement> blocks = Pack.List("block"); foreach (XMLElement e in blocks) { PackEntry entry = new PackEntry(null); int id = e.GetIntAttribute("id", count); entry.id = id; entry.fileName = e.GetAttribute("name", null); entry.bounds.left = e.GetIntAttribute("left", 0); entry.bounds.top = e.GetIntAttribute("top", 0); entry.bounds.right = e.GetIntAttribute("right", 0); entry.bounds.bottom = e.GetIntAttribute("bottom", 0); if (entry.fileName != null) { temps.Put(entry.fileName, entry); } else { temps.Put(Convert.ToString(id), entry); } count++; } this.packing = false; this.packed = true; } this.useAlpha = true; }
public static void SetClearColor(GL gl10, LColor c) { GLUtils.SetColor(gl10, c.r, c.g, c.b, c.a); }
public Loon.Core.Geom.Point.Point2i Draw(int id, float x, float y, float w, float h, LColor color) { return Draw(id, x, y, w, h, 0, color); }
private void DrawMessage(GLEx gl, LColor old) { if (!visible) { return; } if (strings == null) { return; } lock (showMessages) { this.size = showMessages.Length; this.fontSize = (isEnglish) ? strings.GetSize() / 2 : gl.GetFont() .GetSize(); this.fontHeight = strings.GetHeight(); this.tmp_left = isLeft ? 0 : (width - (fontSize * messageLength)) / 2 - (int)(fontSize * 1.5); this.left = tmp_left; this.index = offset = font = tmp_font = 0; this.fontSizeDouble = fontSize * 2; int hashCode = 1; hashCode = LSystem.Unite(hashCode, size); hashCode = LSystem.Unite(hashCode, left); hashCode = LSystem.Unite(hashCode, fontSize); hashCode = LSystem.Unite(hashCode, fontHeight); if (strings == null) { return; } if (hashCode == lazyHashCade) { strings.PostCharCache(); if (iconX != 0 && iconY != 0) { gl.DrawTexture(creeseIcon, iconX, iconY); } return; } strings.StartChar(); fontColor = old; for (int i = 0; i < size; i++) { text = showMessages[i]; if (text == '\0') { continue; } if (interceptCount < interceptMaxString) { interceptCount++; continue; } else { interceptMaxString = 0; interceptCount = 0; } if (showMessages[i] == 'n' && showMessages[(i > 0) ? i - 1 : 0] == '\\') { index = 0; left = tmp_left; offset++; continue; } else if (text == '\n') { index = 0; left = tmp_left; offset++; continue; } else if (text == '<') { LColor color = GetColor(showMessages[(i < size - 1) ? i + 1 : i]); if (color != null) { interceptMaxString = 1; fontColor = color; } continue; } else if (showMessages[(i > 0) ? i - 1 : i] == '<' && GetColor(text) != null) { continue; } else if (text == '/') { if (showMessages[(i < size - 1) ? i + 1 : i] == '>') { interceptMaxString = 1; fontColor = old; } continue; } else if (index > messageLength) { index = 0; left = tmp_left; offset++; newLine = false; } else if (text == '\\') { continue; } tmp_font = strings.CharWidth(text); if (System.Char.IsLetter(text)) { if (tmp_font < fontSize) { font = fontSize; } else { font = tmp_font; } } else { font = fontSize; } left += font; if (i != size - 1) { strings.AddChar(text, vector.x + left + leftOffset, (offset * fontHeight) + vector.y + fontSizeDouble + topOffset - font - 2, fontColor); } else if (!newLine && !onComplete) { iconX = vector.x + left + leftOffset + iconWidth; iconY = (offset * fontHeight) + vector.y + fontSize + topOffset + strings.GetAscent(); if (iconX != 0 && iconY != 0) { gl.DrawTexture(creeseIcon, iconX, iconY); } } index++; } strings.StopChar(); strings.SaveCharCache(); lazyHashCade = hashCode; if (messageCount == next) { onComplete = true; } } }
public void DrawOnlyBatch(string name, float x, float y, LColor[] c) { this.Pack(); PackEntry entry = GetEntry(name); if (texture.IsBatch()) { texture.Draw(x, y, entry.bounds.Width(), entry.bounds.Height(), entry.bounds.left, entry.bounds.top, entry.bounds.right, entry.bounds.bottom, c); } }
public Loon.Core.Geom.Point.Point2i Draw(string name, float dx1, float dy1, float dx2, float dy2, float sx1, float sy1, float sx2, float sy2, float rotation, LColor color) { this.Pack(); if (GLEx.Self != null) { PackEntry entry = GetEntry(name); if (entry == null) { return null; } if (texture.IsBatch()) { texture.Draw(dx1, dy1, dx2, dy2, sx1 + entry.bounds.left, sy1 + entry.bounds.top, sx2 + entry.bounds.left, sy2 + entry.bounds.top, rotation, color); } else { GLEx.Self.DrawTexture(texture, dx1, dy1, dx2, dy2, sx1 + entry.bounds.left, sy1 + entry.bounds.top, sx2 + entry.bounds.left, sy2 + entry.bounds.top, rotation, color); } blittedSize.Set(entry.bounds.Width(), entry.bounds.Height()); } return blittedSize; }
public Loon.Core.Geom.Point.Point2i Draw(string name, float x, float y, float w, float h, float rotation, LColor color) { this.Pack(); if (GLEx.Self != null) { PackEntry entry = GetEntry(name); if (entry == null) { return null; } if (texture.IsBatch()) { texture.Draw(x, y, w, h, entry.bounds.left, entry.bounds.top, entry.bounds.right, entry.bounds.bottom, rotation, color); } else { GLEx.Self.DrawTexture(texture, x, y, w, h, entry.bounds.left, entry.bounds.top, entry.bounds.right, entry.bounds.bottom, rotation, color); } blittedSize.Set(entry.bounds.Width(), entry.bounds.Height()); } return blittedSize; }
public static LTransition NewSplitRandom(LColor c) { return(NewSplitRandom(TextureUtils.CreateTexture( LSystem.screenRect.width, LSystem.screenRect.height, c))); }
public void DrawOnlyBatch(string name, float dx1, float dy1, float dx2, float dy2, float sx1, float sy1, float sx2, float sy2, LColor[] color) { this.Pack(); PackEntry entry = GetEntry(name); if (entry == null) { return; } if (texture.IsBatch()) { texture.Draw(dx1, dy1, dx2, dy2, sx1 + entry.bounds.left, sy1 + entry.bounds.top, sx2 + entry.bounds.left, sy2 + entry.bounds.top, color); } blittedSize.Set(entry.bounds.Width(), entry.bounds.Height()); }
public _Arc(LColor c) { arc = new ArcEffect(c); }
public void SetColorMask(LColor colorMask) { this.colorMask = colorMask; }
public virtual void OnCreate(int width, int height) { this.mode = SCREEN_NOT_REPAINT; this.stageRun = true; this.width = width; this.height = height; this.halfWidth = width / 2; this.halfHeight = height / 2; this.lastTouchX = lastTouchY = touchDX = touchDY = 0; this.isLoad = isLock = isClose = isTranslate = isGravity = false; /*if (sprites != null) * { * sprites.close(); * sprites.removeAll(); * sprites = null; * } * this.sprites = new Sprites("ScreenSprites", this, width, height); * if (desktop != null) * { * desktop.close(); * desktop.clear(); * desktop = null; * } * this.desktop = new Desktop("ScreenDesktop", this, width, height);*/ this.isNext = true; this.tx = ty = 0; this.isTranslate = false; this._screenIndex = 0; this._lastTocuh.Empty(); this._keyActions.Clear(); this._visible = true; this._rotation = 0; this._scaleX = _scaleY = _alpha = 1f; this._baseColor = null; this._isExistCamera = false; this._initLoopEvents = false; this._desktopPenetrate = false; if (this.delayTimer == null) { this.delayTimer = new LTimer(0); } if (this.pauseTimer == null) { this.pauseTimer = new LTimer(LSystem.SECOND); } if (this._rect_limits == null) { this._rect_limits = new TArray <RectBox>(10); } if (this._action_limits == null) { this._action_limits = new TArray <ActionBind>(10); } if (this._touchAreas == null) { this._touchAreas = new TArray <LTouchArea>(); } if (this._conns == null) { this._conns = new loon.utils.reply.Closeable.Set(); } if (this._keyActions == null) { this._keyActions = new ArrayMap(); } }