public override void Draw(DrawBatch drawBatch) { if (sprite != null) { sprite.Draw(drawBatch, DrawBatch.DrawCall.Tag.GameObject, PositionXY + new Vector2(0, -position.Z), 0f, sprite.Measurements.ToVector2() / 2, scale, DrawBatch.CalculateDepth(PositionXY)); } }
protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); drawBatch = new DrawBatch(); pixel = Content.Load <Texture2D>("pixel"); fader = Content.Load <Texture2D>("Fader"); fontDebug = Content.Load <SpriteFont>("debug"); Terrain.LoadContent(Content); Projectile.LoadContent(Content); EffectObject.LoadContent(Content); Particle.LoadContent(Content); Ability.LoadContent(Content); GUI.LoadContent(Content); Item.LoadContent(Content); FXDepthMask = Content.Load <Effect>("Shaders\\FXDepthMask"); FXApplyShadowsToLights = Content.Load <Effect>("Shaders\\FXApplyShadowsToLight"); Rig.LoadContent(Content); RigAnimation.LoadContent(Content); RigLimbDrawer.LoadContent(GraphicsDevice, Content); agents.Add(new Player(new Vector2(100))); agents.Add(new Agent(new Vector2(40), "Könet", Agent.Tag.Enemy, CharacterStats.Default)); agents.Add(new Agent(new Vector2(60), "Gypsit", Agent.Tag.Enemy, CharacterStats.Default)); agents[1].collider.SetActiveAreaCircle(0, 3.14f); TileObject.LoadContent(Content); for (int i = 0; i < 100; i++) { terrain.TryCreateTileObject(new Tree(new Point(random.Next(terrain.size.X), random.Next(terrain.size.Y)))); } }
public override void Draw(DrawBatch drawBatch) { drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, Game1.pixel, new Rectangle((int)PositionXY.X - 3, (int)(position.Y - position.Z) - 3, 6, 6), Color.Purple, DrawBatch.CalculateDepth(PositionXY)); drawBatch.Draw(DrawBatch.DrawCall.Tag.Light, Game1.fader, new Vector2(PositionXY.X, PositionXY.Y), .2f, 0f, new Vector2(Game1.fader.Width * .5f), Color.Purple, DrawBatch.CalculateDepth(PositionXY)); base.Draw(drawBatch); }
public static void DrawRectangle(DrawBatch drawBatch, Rectangle rect, float thickness, Color color, float depth) { Game1.DrawLine(drawBatch, new Vector4(rect.X, rect.Y, rect.X + rect.Width, rect.Y), thickness, color, depth); Game1.DrawLine(drawBatch, new Vector4(rect.X + rect.Width, rect.Y, rect.X + rect.Width, rect.Y + rect.Height), thickness, color, depth); Game1.DrawLine(drawBatch, new Vector4(rect.X + rect.Width, rect.Y + rect.Height, rect.X, rect.Y + rect.Height), thickness, color, depth); Game1.DrawLine(drawBatch, new Vector4(rect.X, rect.Y + rect.Height, rect.X, rect.Y), thickness, color, depth); }
public override void Draw(DrawBatch drawBatch, float thickness, Color color) { Vector2 first, second; if (!useAngles) { for (int i = 0; i < 10; i++) { first = Position + Extensions.GetVector2(i * 2 * (float)Math.PI / 10, vector4.Z); second = Position + Extensions.GetVector2((i + 1) * 2 * (float)Math.PI / 10, vector4.Z); Game1.DrawLine(drawBatch, first, second, thickness, color, DrawBatch.CalculateDepth(Position)); } } else { for (int i = 0; i < 10; i++) { float activeLength = activeArea.Y - activeArea.X; first = Position + Extensions.GetVector2(activeArea.X + i * activeLength / 10, vector4.Z); second = Position + Extensions.GetVector2(activeArea.X + (i + 1) * activeLength / 10, vector4.Z); Game1.DrawLine(drawBatch, first, second, thickness, color, DrawBatch.CalculateDepth(Position)); } Game1.DrawLine(drawBatch, Position, Position + Extensions.GetVector2(activeArea.X, vector4.Z), thickness, color, DrawBatch.CalculateDepth(Position)); Game1.DrawLine(drawBatch, Position, Position + Extensions.GetVector2(activeArea.Y, vector4.Z), thickness, color, DrawBatch.CalculateDepth(Position)); } }
public override void Draw(DrawBatch drawBatch, float thickness, Color color) { Game1.DrawLine(drawBatch, new Vector4(Position.X, Position.Y, Position.X + Width, Position.Y), thickness, color, DrawBatch.CalculateDepth(Position)); Game1.DrawLine(drawBatch, new Vector4(Position.X + Width, Position.Y, Position.X + Width, Position.Y + Height), thickness, color, DrawBatch.CalculateDepth(Position)); Game1.DrawLine(drawBatch, new Vector4(Position.X + Width, Position.Y + Height, Position.X, Position.Y + Height), thickness, color, DrawBatch.CalculateDepth(Position)); Game1.DrawLine(drawBatch, new Vector4(Position.X, Position.Y + Height, Position.X, Position.Y), thickness, color, DrawBatch.CalculateDepth(Position)); }
public override void Draw(DrawBatch drawBatch, float orientation, string selectedLimb, Vector2 offset, float depth) { drawPos = new Vector2(position.X, position.Y); drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, Game1.pixel, new Rectangle((int)position.X, (int)position.Y, 4, 4), Color.AliceBlue, DrawBatch.CalculateDepth(new Vector2(position.X, position.Y))); Dictionary <string, Vector4> lines = Get2DLines(orientation); Vector4 value; foreach (KeyValuePair <string, Vector4> pair in lines) { value = new Vector4(pair.Value.X + drawPos.X + offset.X, pair.Value.Y + drawPos.Y + offset.Y, pair.Value.Z + drawPos.X + offset.X, pair.Value.W + drawPos.Y + offset.Y); if ("X" == pair.Key) { Game1.DrawLine(drawBatch, value, 3f, Color.Blue, 0f); } else if ("Y" == pair.Key) { Game1.DrawLine(drawBatch, value, 3f, Color.Red, 0f); } else if ("Z" == pair.Key) { Game1.DrawLine(drawBatch, value, 3f, Color.Green, 0f); } } }
public virtual void DrawName(DrawBatch drawBatch, float scale) { Vector2 measurements = (Game1.fontDebug.MeasureString(item.name) * scale); float depth = DrawBatch.CalculateDepth(PositionXY); drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, Game1.pixel, new Rectangle((int)(position.X - measurements.X / 2), (int)(position.Y + 20 - position.Z - measurements.Y / 2), (int)measurements.X, (int)measurements.Y), Color.DarkBlue, depth); drawBatch.DrawString(DrawBatch.DrawCall.Tag.GameObject, item.name, Game1.fontDebug, new Vector2(position.X, position.Y + 20 - position.Z), scale, 0f, measurements / 2, Color.White, depth); }
public override void Draw(DrawBatch drawBatch) { Color newColor = Color.Lerp(color, Color.Transparent, MathTransformations.Transform(MathTransformations.Type.NormalizedSmoothStart2, timeAlive / (float)timeToLive) + .4f); drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, Game1.pixel, new Rectangle((int)(PositionXY.X - 1 * scale), (int)((position.Y - position.Z) - 1 * scale), (int)(2 * scale), (int)(2 * scale)), new Rectangle(0, 0, 1, 1), newColor, DrawBatch.CalculateDepth(PositionXY), (short)2, 1); drawBatch.Draw(DrawBatch.DrawCall.Tag.Light, Game1.fader, new Vector2(PositionXY.X, PositionXY.Y - position.Z), .35f * scale, 0f, new Vector2(Game1.fader.Width * .5f), Color.Lerp(newColor, Color.DarkGray, .05f), DrawBatch.CalculateDepth(PositionXY)); base.Draw(drawBatch); }
public void Draw(bool drawLines, Vector2 offset, RigLimb rigLimb, DrawBatch drawBatch, float depth, float orientation) { Vector4 line = rigLimb.Get2DLine(orientation); Vector3 scaleAngle = Texture.GetScaleAndAngle(line); int index = Texture.GetIndex(GetAngleToDisplay(rigLimb.rotation, orientation)); Color color = Color.White; //if (rigLimb.name == Game1.selectedLimb) //{ // color = Color.Green; //} //else // color = Color.White; //spriteBatch.Draw(Texture.Texture, new Vector2(line.X + offset.X, line.Y + offset.Y), Texture.GetSourceRectangle(index), color, scaleAngle.Z, new Vector2(8, 8), new Vector2(scaleAngle.X, scaleAngle.Y), SpriteEffects.None, depth); if (Game1.rigDrawTextures && rigLimb.drawTexture) { Rectangle rectangleToDraw = new Rectangle(new Vector2(line.X + offset.X, line.Y + offset.Y).ToPoint(), new Vector2(Texture.Width * scaleAngle.X + Texture.Origin.X * 2, Texture.Height * scaleAngle.Y).ToPoint()); //float fuckScale = (((rectangleToDraw.Width * 2 - Texture.Origin.X * 2))) / (Texture.Width * 2 + Texture.Origin.X * 2); //float fuckOrigin = (Texture.Width / 2) * (1-fuckScale) + ((fuckScale) * Texture.Origin.X); float fuckOrigin; if (scaleAngle.X < .5f) { fuckOrigin = ((Texture.Width / 2f) - (Texture.Width / 4f) * scaleAngle.X) * (1 - scaleAngle.X);// + 8 * (scaleAngle.X); } else { fuckOrigin = Texture.Origin.X + (Texture.Origin.X / 2) * ((1 - scaleAngle.X) * 2); } if (scaleAngle.X > 1) { drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, Texture.Texture, rectangleToDraw, Texture.GetSourceRectangle(index), scaleAngle.Z, new Vector2(Texture.Origin.X / scaleAngle.X, Texture.Origin.Y), color, depth, SpriteEffects.None); } else { drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, Texture.Texture, rectangleToDraw, Texture.GetSourceRectangle(index), scaleAngle.Z, new Vector2(fuckOrigin, Texture.Origin.Y), color, depth, SpriteEffects.None); } } //Game1.DrawLine(spriteBatch, new Vector2(line.X + offset.X, line.Y + offset.Y), new Vector2(line.X + offset.X, line.Y + offset.Y) + Extensions.GetVector2(Texture.Texture.Width * scaleAngle.X, scaleAngle.Z), 2, Color.Lerp(Color.Blue, Color.Transparent, .5f), 0f); if (drawLines) { if (rigLimb.name == Game1.selectedLimb) { Game1.DrawLine(drawBatch, new Vector2(line.X + offset.X, line.Y + offset.Y), new Vector2(line.Z + offset.X, line.W + offset.Y), 2, Color.Lerp(Color.Red, Color.Transparent, 0f), depth); } else { Game1.DrawLine(drawBatch, new Vector2(line.X + offset.X, line.Y + offset.Y), new Vector2(line.Z + offset.X, line.W + offset.Y), 2, Color.Lerp(Color.Black, Color.Transparent, 0f), depth); } } }
public override void Draw(DrawBatch drawBatch) { float flack = (float)Math.Cos(timeAlive / 4.3f); //sprite.Draw(drawBatch, DrawBatch.DrawCall.Tag.GameObject, PositionXY + new Vector2(0), MovementXY.GetAngle(), new Vector2(56, 16), new Vector2(.5f), Color.Lerp(Color.Black, Color.Transparent, .5f), DrawBatch.CalculateDepth(PositionXY)); sprite.Draw(drawBatch, DrawBatch.DrawCall.Tag.GameObject, PositionXY + new Vector2(0, -position.Z), MovementXY.GetAngle(), new Vector2(56, 16), DrawBatch.CalculateDepth(PositionXY)); drawBatch.Draw(DrawBatch.DrawCall.Tag.Light, Game1.fader, PositionXY + new Vector2(0, -position.Z), Extensions.LerpFloat(.3f, .6f, flack * flack), 0f, new Vector2(Game1.fader.Width / 2, Game1.fader.Height / 2), Color.Lerp(Color.OrangeRed, new Color(240, 220, 0), .1f + flack * .8f), DrawBatch.CalculateDepth(PositionXY) + .0001f); drawBatch.Draw(DrawBatch.DrawCall.Tag.Light, Game1.fader, PositionXY + new Vector2(0, -position.Z), .6f, 0f, new Vector2(Game1.fader.Width / 2, Game1.fader.Height / 2), Color.Lerp(Color.LightGoldenrodYellow, Color.Black, .4f), DrawBatch.CalculateDepth(PositionXY) + .0001f); }
public virtual void Draw(DrawBatch drawBatch, float orientation, string selectedLimb, Vector2 offset, float depth) { drawPos = new Vector2(position.X, position.Y); List <float> internalDepths = new List <float>(); List <string> internalKeys = new List <string>(); int i; float depthToAdd; foreach (var item in limbDrawerCollection) { i = 0; depthToAdd = limbCollection[item.Key].GetInternalDepth(orientation); if (internalDepths.Count == 0) { internalDepths.Add(depthToAdd); internalKeys.Add(item.Key); } else { while (i < internalDepths.Count && depthToAdd >= internalDepths[i]) { i++; } internalDepths.Insert(i, depthToAdd); internalKeys.Insert(i, item.Key); } } for (i = 0; i < internalDepths.Count; i++) { limbDrawerCollection[internalKeys[i]].Draw(drawLines, drawPos + offset, limbCollection[internalKeys[i]], drawBatch, depth, orientation); } /* * * spriteBatch.Draw(Game1.pixel, new Rectangle((int)position.X, (int)position.Y, 4, 4), Color.AliceBlue); * * Dictionary<string, Vector4> lines = Get2DLines(orientation); * Vector4 value; * * foreach (KeyValuePair<string, Vector4> pair in lines) * { * value = new Vector4(pair.Value.X + drawPos.X + offset.X, pair.Value.Y + drawPos.Y + offset.Y, pair.Value.Z + drawPos.X + offset.X, pair.Value.W + drawPos.Y + offset.Y); * if(selectedLimb == pair.Key) * Game1.DrawLine(spriteBatch, value, 2f, Color.Red, 0f); * else * Game1.DrawLine(spriteBatch, value, 2f, Color.Black, 0f); * } */ }
public override void Draw(DrawBatch drawBatch) { sprite.Draw(drawBatch, DrawBatch.DrawCall.Tag.GameObject, PositionXY + new Vector2(0), 0f, new Vector2(16, 16), new Vector2(.5f), Color.Lerp(Color.Black, Color.Transparent, .5f), DrawBatch.CalculateDepth(PositionXY)); if (nextFrameRed) { sprite.Draw(drawBatch, DrawBatch.DrawCall.Tag.GameObject, PositionXY + new Vector2(0, -position.Z), MovementXY.GetAngle(), new Vector2(16, 16), new Vector2(.5f), Color.Red, DrawBatch.CalculateDepth(PositionXY)); nextFrameRed = false; } else { sprite.Draw(drawBatch, DrawBatch.DrawCall.Tag.GameObject, PositionXY + new Vector2(0, -position.Z), MovementXY.GetAngle(), new Vector2(16, 16), .5f, DrawBatch.CalculateDepth(PositionXY)); } }
public override void Draw(DrawBatch drawBatch) { if (SelectionHandler.TileObjectsContains(Position)) { drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, texture, (hitBox.Location.ScaleRet(World.tileSize) + new Point(World.tileSize / 2) - origin).ToVector2(), Color.Red, DrawBatch.CalculateDepth(new Vector2(Position.X * 16 + 8, Position.Y * 16 + 8))); } else { drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, texture, (hitBox.Location.ScaleRet(World.tileSize) + new Point(World.tileSize / 2) - origin).ToVector2(), Color.White, DrawBatch.CalculateDepth(new Vector2(Position.X * 16 + 8, Position.Y * 16 + 8))); } base.Draw(drawBatch); }
public override void Draw(DrawBatch drawBatch) { sprite.Draw(drawBatch, DrawBatch.DrawCall.Tag.GameObject, PositionXY + new Vector2(0, -position.Z), rotation, origin, scale, DrawBatch.CalculateDepth(PositionXY)); //sprite.frame -= sprite.speed; //sprite.Draw(drawBatch, DrawBatch.DrawCall.Tag.Light, PositionXY + new Vector2(0, -position.Z), rotation, origin, scale, DrawBatch.CalculateDepth(PositionXY) + .01f); if (hasLight) { SpriteLights.Draw(drawBatch, DrawBatch.DrawCall.Tag.Light, PositionXY + new Vector2(0, -position.Z), rotation, origin * 2, scale * 2, Color.Lerp(Color.LightGoldenrodYellow, Color.OrangeRed, sprite.frame / sprite.frames), DrawBatch.CalculateDepth(PositionXY) + .01f); } base.Draw(drawBatch); }
public virtual void Draw(DrawBatch drawBatch) { sprite.Draw(drawBatch, DrawBatch.DrawCall.Tag.GameObject, PositionXY + new Vector2(0, -position.Z), rotation, origin, scale, DrawBatch.CalculateDepth(PositionXY)); if (hasLight) { SpriteLights.Draw(drawBatch, DrawBatch.DrawCall.Tag.Light, PositionXY + new Vector2(0, -position.Z), rotation, origin, scale, DrawBatch.CalculateDepth(PositionXY) - .0000001f); } if (sprite.Finished) { remove = true; } }
private void DrawHUD() { //Draw HUD here spriteBatch.DrawString(fontDebug, "Selected: " + SelectionHandler.selectedTile.ToString(), new Vector2(20, 40), Color.White); spriteBatch.DrawString(fontDebug, "Rect: " + SelectionHandler.TileRectangle.ToString(), new Vector2(20, 80), Color.White); spriteBatch.DrawString(fontDebug, "Second: " + SelectionHandler.selectedTileSecond.ToString(), new Vector2(20, 120), Color.White); spriteBatch.DrawString(fontDebug, "Select Target: " + SelectionHandler.CurrentTarget.ToString(), new Vector2(20, 140), Color.White); spriteBatch.DrawString(fontDebug, "SelectionRect: " + SelectionHandler.SelectionRectangle.ToString(), new Vector2(20, 180), Color.White); spriteBatch.DrawString(fontDebug, "Selected: " + SelectionHandler.selectionPoint.ToString(), new Vector2(20, 200), Color.White); spriteBatch.DrawString(fontDebug, "Second: " + SelectionHandler.selectionPointSecond.ToString(), new Vector2(20, 220), Color.White); spriteBatch.DrawString(fontDebug, "MouseTile: " + mouseTile.ToString(), new Vector2(20, 260), Color.White); spriteBatch.DrawString(fontDebug, "MousePosInWrld: " + mousePosInWorld.ToString(), new Vector2(20, 280), Color.White); spriteBatch.DrawString(fontDebug, "Cam.pos: " + camera.pos.ToString(), new Vector2(20, 320), Color.White); spriteBatch.DrawString(fontDebug, "Cam.Position: " + camera.Position.ToString(), new Vector2(20, 340), Color.White); spriteBatch.DrawString(fontDebug, "MouseDepth: " + DrawBatch.CalculateDepth(mousePosInWorld).ToString(), new Vector2(20, 380), Color.Red); spriteBatch.DrawString(fontDebug, "Drawcalls: " + drawBatch.DrawCallCount.ToString(), new Vector2(20, 400), Color.Red); spriteBatch.DrawString(fontDebug, "Average Time per Frame: " + millisecondsPerFrameAverage, new Vector2(20, 450), Color.Red); spriteBatch.DrawString(fontDebug, "Average Time per Frame (Upd): " + millisecondsPerFrameAverageUpdate, new Vector2(20, 480), Color.Red); spriteBatch.DrawString(fontDebug, "Average Time per Frame (Drw): " + millisecondsPerFrameAverageDraw, new Vector2(20, 500), Color.Red); spriteBatch.DrawString(fontDebug, "Time Budget Total: " + millisecondBudget, new Vector2(20, 550), Color.Red); spriteBatch.DrawString(fontDebug, "Time Budget Left: " + (millisecondBudget - millisecondsPerFrameAverage), new Vector2(20, 580), Color.Red); spriteBatch.DrawString(fontDebug, "AbilityHandler: ", new Vector2(400, 450), Color.Red); int i = 0; foreach (var item in ((Player)agents[0]).abilityHandler.executers) { spriteBatch.DrawString(fontDebug, i.ToString() + ": " + item.Value.type + ", " + item.Value.Ready, new Vector2(400, 480), Color.Red); i++; } spriteBatch.DrawString(fontDebug, "Time Budget Left: " + (millisecondBudget - millisecondsPerFrameAverage), new Vector2(20, 580), Color.Red); //if (agents.Count > 1) // drawBatch.DrawString(fontDebug, "Colliding Circles: " + agents[0].collider.CollisionCheck(agents[1].collider, false), new Vector2(20, 320), Color.White); GUI.Draw(spriteBatch); spriteBatch.Draw(pixel, new Rectangle((int)(mouseState.X * ((float)screenWidth / displayWidth)) - 2, (int)(mouseState.Y * ((float)screenHeight / displayHeight)) - 2, 4, 4), Color.Brown); }
public override void Draw(DrawBatch drawBatch) { if (SelectionHandler.selectedID == ID) { drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, texture, SelectionHitBox, Color.Blue, DrawBatch.CalculateDepth(PositionXY)); } else if (tag == Tag.Enemy) { drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, texture, SelectionHitBox, Color.Red, DrawBatch.CalculateDepth(PositionXY)); } else if (tag == Tag.Player) { drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, texture, SelectionHitBox, Color.White, DrawBatch.CalculateDepth(PositionXY)); } drawBatch.DrawString(DrawBatch.DrawCall.Tag.GameObject, GetCurrentHealth().ToString(), Game1.fontDebug, PositionXY - new Vector2(10), Color.Red, DrawBatch.CalculateDepth(PositionXY)); healthBar.drawRectangle = new Rectangle((int)(position.X - 16), (int)(position.Y + 10), 32, 8); healthBar.Draw(DrawBatch.DrawCall.Tag.GameObject, drawBatch, DrawBatch.CalculateDepth(PositionXY), (short)2, 0f); //collider.Draw(spriteBatch, 2f, Color.Cyan); }
public void Draw(DrawBatch drawBatch, DrawBatch.DrawCall.Tag tag, Vector2 position, float rotation, Vector2 origin, Vector2 scale, Color color, float depth) { drawBatch.Draw(tag, texture, position, GetSourceRectangle(), scale, rotation, origin, color, depth, SpriteEffects.None, affectedByLight, lightBleedThrough); Increment(); }
public override void Draw(DrawBatch drawBatch, float thickness, Color color) { Game1.DrawLine(drawBatch, vector4, thickness, color, DrawBatch.CalculateDepth(Position)); }
public override void Draw(DrawBatch drawBatch, float thickness, Color color) { drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, Game1.pixel, Position, thickness, 0f, new Vector2(.5f), color, DrawBatch.CalculateDepth(Position)); }
public void Draw(DrawBatch drawBatch) { Point edgeOffset = Point.Zero; float rotation = 0f; //Draw Materials for (int i = 0; i < size.X; i++) { for (int j = 0; j < size.Y; j++) { if (Game1.camera.Rectangle.Contains(new Rectangle(i * World.tileSize, j * World.tileSize, size.X, size.Y))) { drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, sheet, new Rectangle(i * World.tileSize, j * World.tileSize, World.tileSize, World.tileSize), GetMaterialTextureSrcRect(materials[i, j]), 0, Vector2.Zero, Color.White, 0f, SpriteEffects.None, 1, 0f); /* * //Draw edges * if (i > 0 && j > 0 && i < size.X - 1 && j < size.Y - 1) * { * for (int k = 0; k < 4; k++) * { * switch (k) * { * case 0: * edgeOffset = new Point(1, 0); * break; * case 1: * edgeOffset = new Point(0, -1); * break; * case 2: * edgeOffset = new Point(-1, 0); * break; * case 3: * edgeOffset = new Point(0, 1); * break; * default: * break; * } * * if (materialEdgePriority[(int)materials[i, j]] > materialEdgePriority[(int)materials[i + edgeOffset.X, j + edgeOffset.Y]]) * switch (k) * { * case 0: * rotation = 0f; * drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, sheetEdges, new Rectangle(i * World.tileSize + World.tileSize, j * World.tileSize, 4, World.tileSize), GetMaterialEdgeTextureSrcRect(materials[i, j]), rotation, Vector2.Zero, Color.White, 0f, SpriteEffects.None, 1, 0f); * break; * case 1: * rotation = 4.71f; * drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, sheetEdges, new Rectangle(i * World.tileSize, j * World.tileSize, 4, World.tileSize), GetMaterialEdgeTextureSrcRect(materials[i, j]), rotation, Vector2.Zero, Color.White, 0f, SpriteEffects.None, 1, 0f); * break; * case 2: * rotation = 0f; * drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, sheetEdges, new Rectangle(i * World.tileSize - 4, j * World.tileSize, 4, World.tileSize), GetMaterialEdgeTextureSrcRect(materials[i, j]), rotation, Vector2.Zero, Color.White, 0f, SpriteEffects.FlipHorizontally, 1, 0f); * break; * case 3: * rotation = 4.71f; * drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, sheetEdges, new Rectangle(i * World.tileSize, j * World.tileSize + World.tileSize + 4, 4, World.tileSize), GetMaterialEdgeTextureSrcRect(materials[i, j]), rotation, Vector2.Zero, Color.White, 0f, SpriteEffects.FlipHorizontally, 1, 0f); * break; * default: * break; * } * } * } */ } } } /* * for (int i = 0; i < tileReferences.GetLength(0); i++) * { * for (int j = 0; j < tileReferences.GetLength(1); j++) * { * if (tileReferences[i, j] != null && tileReferences[i, j] != new Point(-1, -1)) * { * if (tileReferences[i, j] == new Point(i, j)) * spriteBatch.Draw(Game1.pixel, new Rectangle(i * World.tileSize, j * World.tileSize, World.tileSize, World.tileSize), Color.Lerp(Color.Cyan, Color.Transparent, .5f)); * else * spriteBatch.Draw(Game1.pixel, new Rectangle(i * World.tileSize, j * World.tileSize, World.tileSize, World.tileSize), Color.Lerp(Color.ForestGreen, Color.Transparent, .5f)); * } * } * } */ //Draw TileObjects for (int i = 0; i < tileObjects.GetLength(0); i++) { for (int j = 0; j < tileObjects.GetLength(1); j++) { if (tileObjects[i, j] != null) { tileObjects[i, j].Draw(drawBatch); } } } }
public virtual void Draw(DrawBatch drawBatch, float Thickness, Color color) { }
/// <summary> /// /// </summary> /// <param name="tag"></param> /// <param name="drawBatch"></param> /// <param name="depth"></param> /// <param name="affectedByLight">0 - always dark, 1 - dynamic, 2 - always bright</param> /// <param name="lightBleedThrough"></param> internal void Draw(DrawBatch.DrawCall.Tag tag, DrawBatch drawBatch, float depth, short affectedByLight, float lightBleedThrough) { Rectangle sourceOffsets = GetSourceRectangleOffsets(); drawBatch.Draw(tag, texture, GetRectangleToDraw(drawRectangle), sourceOffsets, color, depth, affectedByLight, lightBleedThrough); }
public override void Draw(DrawBatch drawBatch) { DrawName(drawBatch, .6f); item.DrawIcon(drawBatch, new Rectangle(PositionXY.ToPoint() - new Point(8), new Point(16)), DrawBatch.CalculateDepth(PositionXY)); base.Draw(drawBatch); }
public virtual void Draw(DrawBatch drawBatch) { }
private void DrawLights() { drawBatch.Draw(DrawBatch.DrawCall.Tag.Light, fader, new Vector2(150, 100), Color.Orange, DrawBatch.CalculateDepth(new Vector2(150, 100))); drawBatch.Draw(DrawBatch.DrawCall.Tag.Light, fader, new Vector2(570, 290), Color.Cyan, DrawBatch.CalculateDepth(new Vector2(570, 290))); drawBatch.Draw(DrawBatch.DrawCall.Tag.Light, fader, new Vector2(344, 320), Color.Purple, DrawBatch.CalculateDepth(new Vector2(344, 320))); if (KeyDown(Keys.F)) { drawBatch.Draw(DrawBatch.DrawCall.Tag.Light, fader, mousePosInWorld, new Vector2(2, 2), 0f, new Vector2(128), Color.White, DrawBatch.CalculateDepth(mousePosInWorld)); } }
public override void Draw(DrawBatch drawBatch) { sprite.Draw(drawBatch, DrawBatch.DrawCall.Tag.GameObject, PositionXY + new Vector2(0, -position.Z), DrawBatch.CalculateDepth(PositionXY)); }
internal void DrawIcon(DrawBatch drawBatch, Rectangle rectangle, float depth) { drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, iconSheet, rectangle, new Rectangle(new Point(iconSize.X * iconSheetPosition.X, iconSheetPosition.Y * iconSize.Y), iconSize), Color.White, depth); }
public static void DrawLine(DrawBatch drawBatch, Vector4 v, float thickness, Color color, float depth) { Vector2 delta = new Vector2(v.Z - v.X, v.W - v.Y); drawBatch.Draw(DrawBatch.DrawCall.Tag.GameObject, pixel, new Vector2(v.X, v.Y), new Vector2(delta.Length(), thickness), Extensions.GetAngle(delta), Vector2.Zero, color, depth); }