protected override void HandleDraw(SpriteBatch spriteBatch, Rectangle scissorRectangle, DrawSpecifics drawSpecifics) { //Draw tiles spriteBatch.End(); spriteBatch.Begin(samplerState: SamplerState.PointClamp); for (int i = 0; i < tileWidth; i++) { for (int j = 0; j < tileHeight; j++) { bool isEdge = false; EdgeTexture edgeTexture = EdgeTexture.DownLeft; if (i == 0) { isEdge = true; if (j == 0) { edgeTexture = EdgeTexture.UpLeft; } else if (j == tileHeight - 1) { edgeTexture = EdgeTexture.DownLeft; } else { edgeTexture = EdgeTexture.LeftMiddle; } } else if (i == tileWidth - 1) { isEdge = true; if (j == 0) { edgeTexture = EdgeTexture.UpRight; } else if (j == tileHeight - 1) { edgeTexture = EdgeTexture.DownRight; } else { edgeTexture = EdgeTexture.RightMiddle; } } else if (j == 0) { isEdge = true; if (i == 1) { edgeTexture = EdgeTexture.UpTextLeft; } else if (i == tileWidth - 2) { edgeTexture = EdgeTexture.UpTextRight; } else { edgeTexture = EdgeTexture.UpMiddle; } } else if (j == tileHeight - 1) { isEdge = true; if (i == 1) { edgeTexture = EdgeTexture.DownTextLeft; } else if (i == tileWidth - 2) { edgeTexture = EdgeTexture.DownTextRight; } else { edgeTexture = EdgeTexture.DownMiddle; } } if (isEdge) { spriteBatch.Draw(edgeTextures[(int)edgeTexture], new Vector2(xOffset + (tileSize * (i + .5F)), yOffset + (tileSize * (j + .5F))), null, Color.White, 0, new Vector2(edgeTextures[(int)edgeTexture].Width / 2, edgeTextures[(int)edgeTexture].Height / 2), (float)tileSize / edgeTextures[(int)edgeTexture].Width, SpriteEffects.None, 0); } else { spriteBatch.Draw(inventorySlot, new Vector2(xOffset + (tileSize * (i + .5F)), yOffset + (tileSize * (j + .5F))), null, Color.White, 0, new Vector2(edgeTextures[(int)edgeTexture].Width / 2, edgeTextures[(int)edgeTexture].Height / 2), (float)tileSize / edgeTextures[(int)edgeTexture].Width, SpriteEffects.None, 0); } } } base.HandleDraw(spriteBatch, scissorRectangle, drawSpecifics); }
protected override void HandleDraw(SpriteBatch spriteBatch, Rectangle scissorRectangle, DrawSpecifics drawSpecifics) { spriteBatch.End(); float focusPointScale = (float)MapStandards.MAP_SIZE / Math.Min(scissorRectangle.Width, scissorRectangle.Height); parallaxBackground.Draw(spriteBatch, new Vector2(PastMouseState.Position.X * focusPointScale, PastMouseState.Position.Y * focusPointScale), MapStandards.MAP_SIZE / Math.Min(scissorRectangle.Width, scissorRectangle.Height), gameSession.graphicsDevice); spriteBatch.Begin(); base.HandleDraw(spriteBatch, scissorRectangle, drawSpecifics); }
protected override void HandleDraw(SpriteBatch spriteBatch, Rectangle scissorRectangle, DrawSpecifics drawSpecifics) { //Draw health indicator Texture2D texture = healthIndicator.CurrentTexture; spriteBatch.Draw(texture, new Vector2(elementRectangle.Center.X, elementRectangle.Center.Y), null, Color.White, 0, new Vector2(texture.Width / 2, texture.Height / 2), indicatorScale, SpriteEffects.None, 0); base.HandleDraw(spriteBatch, scissorRectangle, drawSpecifics); }
protected override void HandleDraw(SpriteBatch spriteBatch, Rectangle scissorRectangle, DrawSpecifics drawSpecifics) { Color drawColor = new Color(drawSpecifics.Opacity, drawSpecifics.Opacity, drawSpecifics.Opacity, drawSpecifics.Opacity); //Draw panel for (int i = 0; i < panelDimensions.X; i++) { for (int j = 0; j < panelDimensions.Y; j++) { bool top = j == 0, bottom = j == panelDimensions.Y - 1, left = i == 0, right = i == panelDimensions.X - 1; if (top) { if (left) { spriteBatch.Draw(PanelCorners[0].Texture, new Rectangle(elementRectangle.X + (panelTileSize * i), elementRectangle.Y + (panelTileSize * j), panelTileSize, panelTileSize), null, drawColor, 0, Vector2.Zero, PanelCorners[0].SpriteEffect, 0); } else if (right) { spriteBatch.Draw(PanelCorners[1].Texture, new Rectangle(elementRectangle.X + (panelTileSize * i), elementRectangle.Y + (panelTileSize * j), panelTileSize, panelTileSize), null, drawColor, 0, Vector2.Zero, PanelCorners[1].SpriteEffect, 0); } else { spriteBatch.Draw(PanelSides[2].Texture, new Rectangle(elementRectangle.X + (panelTileSize * i), elementRectangle.Y + (panelTileSize * j), panelTileSize, panelTileSize), null, drawColor, 0, Vector2.Zero, PanelSides[2].SpriteEffect, 0); } } else if (bottom) { if (left) { spriteBatch.Draw(PanelCorners[2].Texture, new Rectangle(elementRectangle.X + (panelTileSize * i), elementRectangle.Y + (panelTileSize * j), panelTileSize, panelTileSize), null, drawColor, 0, Vector2.Zero, PanelCorners[2].SpriteEffect, 0); } else if (right) { spriteBatch.Draw(PanelCorners[3].Texture, new Rectangle(elementRectangle.X + (panelTileSize * i), elementRectangle.Y + (panelTileSize * j), panelTileSize, panelTileSize), null, drawColor, 0, Vector2.Zero, PanelCorners[3].SpriteEffect, 0); } else { spriteBatch.Draw(PanelSides[3].Texture, new Rectangle(elementRectangle.X + (panelTileSize * i), elementRectangle.Y + (panelTileSize * j), panelTileSize, panelTileSize), null, drawColor, 0, Vector2.Zero, PanelSides[3].SpriteEffect, 0); } } else if (left) { spriteBatch.Draw(PanelSides[0].Texture, new Rectangle(elementRectangle.X + (panelTileSize * i), elementRectangle.Y + (panelTileSize * j), panelTileSize, panelTileSize), null, drawColor, 0, Vector2.Zero, PanelSides[0].SpriteEffect, 0); } else if (right) { spriteBatch.Draw(PanelSides[1].Texture, new Rectangle(elementRectangle.X + (panelTileSize * i), elementRectangle.Y + (panelTileSize * j), panelTileSize, panelTileSize), null, drawColor, 0, Vector2.Zero, PanelSides[1].SpriteEffect, 0); } else { spriteBatch.Draw(PanelMiddle.Texture, new Rectangle(elementRectangle.X + (panelTileSize * i), elementRectangle.Y + (panelTileSize * j), panelTileSize, panelTileSize), null, drawColor, 0, Vector2.Zero, PanelMiddle.SpriteEffect, 0); } } } base.HandleDraw(spriteBatch, scissorRectangle, drawSpecifics); }
protected override void HandleDraw(SpriteBatch spriteBatch, Rectangle scissorRectangle, DrawSpecifics drawSpecifics) { drawSpecifics.Opacity = FadeOpacity; base.HandleDraw(spriteBatch, scissorRectangle, drawSpecifics); }