public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, PrimitiveDrawer primitiveDrawer, FontHandler fontHandler, Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice) { Rectangle numRect = this.ToRectangle(); numRect.Width = numWidth; Rectangle rect = this.ToRectangle(); this.width = (rect.Width = (int)fontHandler.GetVerdana().MeasureString(" " + this.text + " ").X + 3) + numWidth; rect.X += numWidth; if(this.text.Length > 0 || this.GetSelected()) if (selected) { primitiveDrawer.DrawRoundedRectangle(graphicsDevice, rect, colorB); } else { primitiveDrawer.DrawRoundedRectangle(graphicsDevice, rect, colorA); } primitiveDrawer.DrawRoundedRectangle(graphicsDevice, numRect, new Color(0x3D, 0x70, 0xBC)); Vector2 vector = this.GetVector(); vector.X += 3; vector.Y += 3; spriteBatch.DrawString(fontHandler.GetVerdana(), " # ", vector + TetrisGameRunner.GetOffsetVector(), Color.White); vector.X += numWidth - 3; spriteBatch.DrawString(fontHandler.GetVerdana(), " " + this.text + " ", vector + TetrisGameRunner.GetOffsetVector(), Color.White); spriteBatch.End(); spriteBatch.Begin(); }
public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, PrimitiveDrawer primitiveDrawer, FontHandler fontHandler, Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice) { String text = mode ? "True" : "False"; Color color = !GetSelected() ? colorA : colorB; Rectangle numRect = this.ToRectangle(); numRect.Width = boolWidth; Rectangle rect = this.ToRectangle(); this.width = (rect.Width = (int)fontHandler.GetVerdana().MeasureString(" " + text + " ").X + 3) + boolWidth; rect.X += boolWidth; primitiveDrawer.DrawRoundedRectangle(graphicsDevice, rect, color); primitiveDrawer.DrawRoundedRectangle(graphicsDevice, numRect, new Color(0x3D, 0x70, 0xBC)); Vector2 vector = this.GetVector(); vector.X += 3; vector.Y += 3; spriteBatch.DrawString(fontHandler.GetVerdana(), " Bool ", vector + TetrisGameRunner.GetOffsetVector(), Color.White); vector.X += boolWidth - 3; spriteBatch.DrawString(fontHandler.GetVerdana(), " " + text + " ", vector + TetrisGameRunner.GetOffsetVector(), Color.White); spriteBatch.End(); spriteBatch.Begin(); }
public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, PrimitiveDrawer primitiveDrawer, FontHandler fontHandler, Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice) { if(varLink != null) { Vector2 vec = this.GetVector(); this.varLink.SetVector(ref vec); this.SetWidth(varLink.GetWidth()); this.SetHeight(varLink.GetHeight()); varLink.Draw(spriteBatch, primitiveDrawer, fontHandler, graphicsDevice); } else { primitiveDrawer.DrawRoundedRectangle(graphicsDevice, this, colorA); Vector2 ve = fontHandler.GetVerdana().MeasureString(this.typeOfVariable); this.width = (int)ve.X + 3; this.height = 30; Vector2 vec = this.GetVector(); vec.Y += 3; vec.X += 3; spriteBatch.DrawString(fontHandler.GetVerdana(), this.typeOfVariable, vec + TetrisGameRunner.GetOffsetVector(), Color.White); spriteBatch.End(); spriteBatch.Begin(); } }
public void Draw(GraphicsDevice graphicsDevice, SpriteBatch batch, PrimitiveDrawer drawer, FontHandler font) { Vector2 headPlacement = testingRectangle.GetVector(); headPlacement.Y -= 46; headPlacement.X += (testingRectangle.GetWidth() / 2); if(textBox.GetSelected()) textBox.Draw(batch, drawer, font, graphicsDevice); drawer.DrawRoundedRectangle(graphicsDevice, testingRectangle.ScalePosition(-1,-1).ScaleSize(2,2), Color.Black); drawer.DrawRoundedRectangle(graphicsDevice, testingRectangle, color); drawer.DrawCircle(graphicsDevice, headPlacement, 50, Color.Black, sides); drawer.DrawCircle(graphicsDevice, headPlacement, 49, Color.Wheat, sides); Vector2 lower = testingRectangle.GetVector(); lower.Y += 30; lower.X += testingRectangle.GetWidth(); headPlacement.Y += -16; headPlacement.X += -28; // e e\n , ____ , string face = " l l\n"; if (squareOrCircle) face = " n n\n"; bool blinking = false; string face2 = " ____ "; if ((blink > 43 && blink < 56) ) { face = " _ _\n"; blinking = true; } if(blink == 110) { blink = 0; } if(blink % 140 < 15 ) { face2 = " ____ "; } left.Draw(graphicsDevice, batch, drawer, font); right.Draw(graphicsDevice, batch, drawer, font); lleft.Draw(graphicsDevice, batch, drawer, font); lright.Draw(graphicsDevice, batch, drawer, font); Vector2 dis = new Vector2(TetrisGameRunner.GetOffsetX(), TetrisGameRunner.GetOffsetY()); batch.DrawString(font.GetVerdana(), "Frame : " + ff + " "+"S: Save Frame C: Correct Frame V: Correct Frame Dynamic\nH: Hide Dots", new Vector2(300, 0) + dis, Color.White); batch.DrawString(((!blinking) ? font.GetWingdings() : font.GetVerdana()), face, headPlacement + dis, Color.Black); batch.DrawString(font.GetVerdana(), "\n\n", testingRectangle.GetVector(), Color.Black, 0, dis + new Vector2(), .82f, SpriteEffects.None, 0); batch.DrawString(font.GetVerdana(), "\n"+face2, dis + headPlacement, Color.Black); }
public void Draw(GraphicsDevice graphicsDevice, SpriteBatch batch, PrimitiveDrawer drawer, FontHandler font) { if(showMode && !neverEditAgain) { drawer.DrawRoundedRectangle(graphicsDevice, a.ScalePosition(start), Color.White); drawer.DrawRoundedRectangle(graphicsDevice, b.ScalePosition(start), Color.Red); drawer.DrawRoundedRectangle(graphicsDevice, c.ScalePosition(start), Color.Blue); } drawer.DrawCurve(graphicsDevice, start, a.ScalePosition(start).GetVector(), b.ScalePosition(start).GetVector(), c.ScalePosition(start).GetVector(), 1, 0, Color.Black); }
public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, PrimitiveDrawer primitiveDrawer, FontHandler fontHandler, Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice) { SetWidth((int)fontHandler.GetVerdana().MeasureString(this.eventName).X + 8); Vector2 adjust = GetVector(); adjust.X += 4; spriteBatch.DrawString(fontHandler.GetVerdana(), this.eventName, adjust + TetrisGameRunner.GetOffsetVector(), Color.White); primitiveDrawer.DrawRoundedRectangle(graphicsDevice, this, Color.Green); spriteBatch.End(); spriteBatch.Begin(); }
public override void Draw(PrimitiveDrawer drawer, GraphicsDevice graphics, SpriteBatch batch, FontHandler font) { Vector2 headPlacement = GetVector(); headPlacement.Y -= 46; headPlacement.X += (GetWidth() / 2); base.Draw(drawer, graphics, batch, font); drawer.DrawCircle(graphics, headPlacement, 50, Color.Black, 60); drawer.DrawCircle(graphics, headPlacement, 49, Color.Wheat, 60); Vector2 lower = GetVector(); lower.Y += 30; lower.X += GetWidth(); headPlacement.Y += -16; headPlacement.X += -28; // e e\n , ____ , string face = " l l\n"; bool blinking = false; string face2 = " ____ "; if ((blink > 43 && blink < 56)) { face = " _ _\n"; blinking = true; } if (blink == 110) { blink = 0; } if (blink % 140 < 15) { face2 = " ____ "; } if (left != null) { left.Draw(graphics, batch, drawer, font); right.Draw(graphics, batch, drawer, font); leg_left.Draw(graphics, batch, drawer, font); leg_right.Draw(graphics, batch, drawer, font); } Vector2 dis = new Vector2(TetrisGameRunner.GetOffsetX(), TetrisGameRunner.GetOffsetY()); batch.DrawString(((!blinking) ? font.GetWingdings() : font.GetVerdana()), face, headPlacement + dis, Color.Black); batch.DrawString(font.GetVerdana(), "\n\n", GetVector(), Color.Black, 0, dis + new Vector2(), .82f, SpriteEffects.None, 0); batch.DrawString(font.GetVerdana(), "\n" + face2, dis + headPlacement, Color.Black); }
public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, PrimitiveDrawer primitiveDrawer, FontHandler fontHandler, Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice) { if (width == 0) { Vector2 measure = fontHandler.GetLucidaSansTypewriter().MeasureString(" New Class "); this.width = (int)measure.X; this.height = (int)measure.Y; } primitiveDrawer.DrawRoundedRectangle(graphicsDevice, this, Color.Orange); spriteBatch.DrawString(fontHandler.GetLucidaSansTypewriter(), " New Class ", TetrisGameRunner.GetOffsetVector() +this.GetVector(), Color.White); spriteBatch.End(); spriteBatch.Begin(); }
public override void Draw(PrimitiveDrawer drawer, Microsoft.Xna.Framework.Graphics.GraphicsDevice graphics, SpriteBatch batch, FontHandler font) { if(borderMode) { drawer.DrawCircle(graphics, GetVector(), GetWidth(), border); drawer.DrawCircle(graphics, GetVector(), GetWidth()-1, color); } else { drawer.DrawCircle(graphics, GetVector(), GetWidth(), color); } if(editing) { drawer.DrawFilledRectangle(graphics, point, Color.White); } }
public void Draw(GraphicsDevice graphicsDevice, SpriteBatch batch, PrimitiveDrawer drawer, FontHandler font) { foreach (LevelObject o in objects) { if (o is LightLevelCircle) continue; o.Draw(drawer, graphicsDevice, batch, font); } drawer.DrawFilledRectangle(graphicsDevice, (Rectangle)(new GameRectangle(0, 0, 2000, 1000)), new Color(0, 0, 0, 220), false); foreach (LevelObject o in objects) { if (o is LightLevelCircle) o.Draw(drawer, graphicsDevice, batch, font); } }
public override void Draw(PrimitiveDrawer drawer, Microsoft.Xna.Framework.Graphics.GraphicsDevice graphics, SpriteBatch batch, FontHandler font) { if(!normal) graphics.BlendState = TetrisGameRunner.LightState(); for (int i = 0;i < 2;i++) { if(culled) drawer.DrawCulledCircle(graphics, GetVector(), GetWidth(), color, Color.Black, 60, new GameRectangle(320, 0, 1024 - 320, 768)); else { drawer.DrawCircle(graphics, GetVector(), GetWidth(), color, Color.Black, 60); } } graphics.BlendState = TetrisGameRunner.OriginalState(); if (editing) { drawer.DrawFilledRectangle(graphics, point, Color.White); } }
public override void Draw(SpriteBatch spriteBatch, PrimitiveDrawer pd, FontHandler fontHandler, GraphicsDevice graphicsDevice) { vector.X = x; vector.Y = y; if(true) { Vector2 measurement = fontHandler.GetSourceCodePro().MeasureString(" " + text + " "); width = (int)measurement.X; height = (int)measurement.Y; } if(selected) pd.DrawFilledRectangle(graphicsDevice, this, colorOne); else pd.DrawFilledRectangle(graphicsDevice, this, colorTwo); spriteBatch.DrawString(fontHandler.GetSourceCodePro(), " " + text + " ", vector + TetrisGameRunner.GetOffsetVector(), Color.White); spriteBatch.End(); spriteBatch.Begin(); }
public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, PrimitiveDrawer primitiveDrawer, FontHandler fontHandler, Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice) { Vector2 vec = this.GetVector(); holderA.SetVector(ref vec); vec.X += holderA.GetWidth() + 1; Rectangle rect = this.ToRectangle(); rect.X = (int)vec.X; rect.Y = (int)vec.Y; rect.Width = 28; vec.X += 29; spriteBatch.DrawString(fontHandler.GetVerdana(), modes[mode], new Vector2(rect.X, rect.Y) + TetrisGameRunner.GetOffsetVector(), Color.White); holderB.SetVector(ref vec); this.width = holderA.GetWidth() + holderB.GetWidth() + 30; primitiveDrawer.DrawRoundedRectangle(graphicsDevice, rect, storedColor); holderA.Draw(spriteBatch, primitiveDrawer, fontHandler, graphicsDevice); holderB.Draw(spriteBatch, primitiveDrawer, fontHandler, graphicsDevice); }
public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, PrimitiveDrawer primitiveDrawer, FontHandler fontHandler, Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice) { Rectangle numRect = this.ToRectangle(); numRect.Width = notWidth; this.width = notWidth + holder.GetWidth(); primitiveDrawer.DrawRoundedRectangle(graphicsDevice, numRect, storedColor); Vector2 vector = this.GetVector(); vector.X += 3; vector.Y += 3; spriteBatch.DrawString(fontHandler.GetVerdana(), modes[mode], vector + TetrisGameRunner.GetOffsetVector(), Color.White); vector.X += notWidth - 2; vector.Y -= 3; holder.SetVector(ref vector); holder.Draw(spriteBatch, primitiveDrawer, fontHandler, graphicsDevice); spriteBatch.End(); spriteBatch.Begin(); }
public void Draw(GraphicsDevice graphicsDevice, SpriteBatch batch, PrimitiveDrawer drawer, FontHandler font) { if(animationMode) { tool.Draw(graphicsDevice, batch, drawer, font); return; } //batch.DrawString(font.GetLucidaSansTypewriter(), "Hey" + (couldDrag == null), new Vector2(0, 100), Color.Red); foreach (LevelObject o in objects) { if (o is LightLevelCircle) continue; o.Draw(drawer, graphicsDevice, batch, font); } if (colorize != null) { drawer.DrawFilledRectangle(graphicsDevice, new Rectangle(originX, originY, 5, 5), Color.Magenta); drawer.DrawFilledRectangle(graphicsDevice, r, Color.Red); drawer.DrawFilledRectangle(graphicsDevice, g, Color.Green); drawer.DrawFilledRectangle(graphicsDevice, b, Color.Blue); } drawer.DrawFilledRectangle(graphicsDevice, (Rectangle)(new GameRectangle(0, 0, 2000, 1000)), new Color(0, 0, 0, 220), false); foreach (LevelObject o in objects) { if (o is LightLevelCircle) { o.Draw(drawer, graphicsDevice, batch, font); ((LightLevelCircle)o).SetCulled(cullMode); } } if (textBox.GetSelected()) { textBox.Draw(batch, drawer, font, graphicsDevice); } }
public void Draw(GraphicsDevice graphicsDevice, SpriteBatch batch, PrimitiveDrawer drawer, FontHandler font) { world.Draw(graphicsDevice, batch, drawer, font); game.Draw(graphicsDevice, drawer, batch, font); if(GameEnded) { if(GameLost) batch.DrawString(font.GetVerdana(), "You Lost!", new Vector2(320,0) + TetrisGameRunner.GetOffsetVector(), Color.White); else batch.DrawString(font.GetVerdana(), "You Win!", new Vector2(320, 0) + TetrisGameRunner.GetOffsetVector(), Color.White); } batch.DrawString(font.GetVerdana(), text, new Vector2(320, 0) + TetrisGameRunner.GetOffsetVector(), Color.White); }
public abstract void Draw(SpriteBatch spriteBatch, PrimitiveDrawer primitiveDrawer, FontHandler fontHandler, GraphicsDevice graphicsDevice);
public void Draw(SpriteBatch spriteBatch, PrimitiveDrawer primitiveDrawer, FontHandler fontHandler, GraphicsDevice graphics) { #region Draw the Background of the Interface widthOfMenu = modes[0].GetWidth() + modes[1].GetWidth() + modes[2].GetWidth(); primitiveDrawer.DrawFilledRectangle(graphics, new Rectangle(0, 0, widthOfMenu, height), background); DrawSuggestions(spriteBatch, primitiveDrawer, fontHandler, graphics); primitiveDrawer.DrawFilledRectangle(graphics, new Rectangle(widthOfMenu, 0, width - widthOfMenu, height), background2); primitiveDrawer.DrawFilledRectangle(graphics, new Rectangle(widthOfMenu, 0, width - widthOfMenu, modes[0].GetHeight()), background); #endregion #region Draw the Text in the Top Right Corner String str = safeFileName; if(classManager != null) { str = classManager.GetName(); } int wdt = (int)fontHandler.GetVerdana().MeasureString(str).X + 3; primitiveDrawer.DrawFilledRectangle(graphics, new Rectangle(width - wdt - 6, 0, wdt + 6, modes[0].GetHeight()), new Color(0x29, 0x80, 0xb9)); spriteBatch.DrawString(fontHandler.GetVerdana(), str, new Vector2(width - wdt, 6) + TetrisGameRunner.GetOffsetVector(), Color.White); #endregion #region Set the Position of the Scroll Buttons scrollDown.SetY(height - scrollDown.GetHeight()); scrollUp.SetY(height - scrollUp.GetHeight()); scrollDown.SetWidth(widthOfMenu / 2 - 2); scrollDown.SetX(1); scrollUp.SetWidth(widthOfMenu / 2 - 2); scrollUp.SetX(widthOfMenu / 2 + 1); #endregion #region Set the Position of the Mode Buttons modes[1].SetX(modes[0].GetWidth()); modes[2].SetX(modes[0].GetWidth() + modes[1].GetWidth()); #endregion #region Draw the Elements and Modes and Such DrawModes(spriteBatch, primitiveDrawer, fontHandler, graphics); DrawElements(spriteBatch, primitiveDrawer, fontHandler, graphics); #endregion #region Draw the Scroll Buttons scrollDown.Draw(spriteBatch, primitiveDrawer, fontHandler, graphics); scrollUp.Draw(spriteBatch, primitiveDrawer, fontHandler, graphics); #endregion }
private void DrawModes(SpriteBatch spriteBatch, PrimitiveDrawer primitiveDrawer, FontHandler fontHandler, GraphicsDevice graphics) { foreach (DragDropElement element in modes) { element.Draw(spriteBatch, primitiveDrawer, fontHandler, graphics); } }
private void DrawElements(SpriteBatch spriteBatch, PrimitiveDrawer primitiveDrawer, FontHandler fontHandler, GraphicsDevice graphics) { foreach (LooseDragDropLink element in elements) { element.Draw(spriteBatch, primitiveDrawer, fontHandler, graphics); } }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); fontHandler = new FontHandler(); Logger.Load(); mainMenu = new WorldRenderer(SaveFileSystem.LoadObjectFromFile<World>("Levels/MainMenuLevel.taj", new GameLoader())); optionsMenu = new WorldRenderer(SaveFileSystem.LoadObjectFromFile<World>("Levels/OptionMenuLevel.taj", new GameLoader())); fontHandler.LoadContent(Content); SoundEffectInstance song =Content.Load<SoundEffect>("NewTetris").CreateInstance(); song.IsLooped = true; song.Play(); // TODO: use this.Content to load your game content here }
private void DrawSuggestions(SpriteBatch spriteBatch, PrimitiveDrawer primitiveDrawer, FontHandler fontHandler, GraphicsDevice graphics) { int helperY = 50; foreach (LooseDragDropLink element in suggestions) { element.SetY(helperY); element.SetX(20); element.Draw(spriteBatch, primitiveDrawer, fontHandler, graphics); helperY += 31; } }
public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, PrimitiveDrawer primitiveDrawer, FontHandler fontHandler, Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice) { if(selected) { primitiveDrawer.DrawRoundedRectangle(graphicsDevice, this, colorB); } else { primitiveDrawer.DrawRoundedRectangle(graphicsDevice, this, colorA); } Vector2 vector = this.GetVector() + new Vector2(TetrisGameRunner.GetOffsetX(), TetrisGameRunner.GetOffsetY()); vector.X += 3; vector.Y += 3; spriteBatch.DrawString(fontHandler.GetVerdana(), formatText(fontHandler), vector, Color.White); spriteBatch.End(); spriteBatch.Begin(); }
protected String formatText(FontHandler font) { String textA; if (selected) { #region Format the String with the Underscore in the person's current position of the text. textA = this.text.Substring(0, position) + "_" + this.text.Substring(position); #endregion } else { #region Shows the string from the end. textA = this.text.Substring(0, position) + "" + this.text.Substring(position); position = this.text.Length; #endregion } #region Measures the String Repeatedly and cuts off text until it will fit. Vector2 vector = font.GetVerdana().MeasureString(textA); int count = 0; while(vector.X > width) { if (position >= textA.Length - count - 1) break; vector = font.GetVerdana().MeasureString(textA.Substring(0, textA.Length - count++)); } textA = textA.Substring(0, textA.Length - count); while(vector.X > width) { textA = textA.Substring(1); vector = font.GetVerdana().MeasureString(textA); } #endregion return textA; }
public void Draw(SpriteBatch batch, FontHandler handler, GraphicsDevice graphics, PrimitiveDrawer drawer) { drawer.DrawRoundedRectangle(graphics, this, col); batch.DrawString(handler.GetVerdana(), text, GetVector() + new Vector2(20, 10), Color.Black); }
public void Draw(SpriteBatch spriteBatch, PrimitiveDrawer primitiveDrawer, FontHandler fontHandler, GraphicsDevice graphicsDevice) { element.Draw(spriteBatch, primitiveDrawer, fontHandler, graphicsDevice); }
abstract public void Draw(PrimitiveDrawer drawer, GraphicsDevice graphics, SpriteBatch batch, FontHandler font);