public void Draw(SpriteBatch _spriteBatch) { _spriteBatch.Draw(emptyTexture, sourceManagerWindow, Color.AliceBlue * .10f); SpriteBatchAssist.DrawBox(_spriteBatch, emptyTexture, sourceManagerWindow, Color.DarkSlateBlue, 2); int showX = Math.Min(viewStartX + viewSizeX, xTiles); int showY = Math.Min(viewStartY + viewSizeY, yTiles); for (int x = viewStartX; x < showX; x++) { for (int y = viewStartY; y < showY; y++) { Tile tile = tiles[x, y]; if (tile != null) { int xPosition = (int)(position.X + tile.Destination.X - (viewStartX * tileDistanceX)); int yPosition = (int)(position.Y + tile.Destination.Y - (viewStartY * tileDistanceY)); Vector2 tilePosition = new Vector2(xPosition, yPosition); _spriteBatch.Draw(texture, tilePosition, tile.Source, Color.White); } } } cursor.Draw(_spriteBatch); }
internal void Draw(Vector2 _vector2, SpriteBatch _spriteBatch) { SpriteBatchAssist.DrawBox(_spriteBatch, emptyTexture, sourceWindow, Color.Red, 2); if (selected != null) { Rectangle drawPosition = new Rectangle((int)_vector2.X, (int)_vector2.Y, selected.Source.Width * 2, selected.Source.Height * 2); SpriteBatchAssist.DrawBox(_spriteBatch, emptyTexture, drawPosition, Color.Red); _spriteBatch.Draw(texture, drawPosition, selected.Source, Color.White); } }
public void Draw(SpriteBatch _spriteBatch) { _spriteBatch.DrawString(MapManager.Instance.DebugFont, "Collision Types", position - new Vector2(0, 20), Color.White); foreach (CollisionTypeButton colButton in colButtons) { _spriteBatch.Draw(emptyTexture, colButton.Destination, Constant.GetCollisionColor(colButton.Type)); _spriteBatch.DrawString(MapManager.Instance.DebugFont, colButton.Type.ToString(), new Vector2(colButton.Destination.Right + 5, colButton.Destination.Top + 5), Color.White); cursor.Draw(_spriteBatch); SpriteBatchAssist.DrawBox(_spriteBatch, emptyTexture, colButton.Destination); } }
public void Draw(SpriteBatch _spriteBatch) { objectSourceManager.Draw(_spriteBatch); enemyManager.Draw(_spriteBatch); map.Draw(_spriteBatch); saveFile.Draw(_spriteBatch); loadFile.Draw(_spriteBatch); clearMap.Draw(_spriteBatch); increaseY.Draw(_spriteBatch); decreaseY.Draw(_spriteBatch); increaseX.Draw(_spriteBatch); decreaseX.Draw(_spriteBatch); setDrawType.Draw(_spriteBatch); typeManager.Draw(_spriteBatch); setMusicFile.Draw(_spriteBatch); playerStart.Draw(_spriteBatch, buttonSelected == MapButtonType.PlayerPosition); mapTransitionStart.Draw(_spriteBatch, buttonSelected == MapButtonType.MapTransition); Texture2D texture = objectSourceManager.getTexture(); Texture2D texture2 = typeManager.getTexture(); Rectangle selectedSource = objectSourceManager.Cursor.Selected.Source; Rectangle collisionSection = new Rectangle(1290, 100, 32, 32); Rectangle tileBox = new Rectangle(1250, 100, 32, 32); _spriteBatch.DrawString(debugFont, "Selected", new Vector2(1250, 5), Color.Pink); if (!enemySelected) { if (drawTypeSelected != DrawType.Collision) { _spriteBatch.Draw(texture, new Rectangle(1250, 25, 64, 64), selectedSource, Color.White); SpriteBatchAssist.DrawBox(_spriteBatch, texture2, tileBox); } if (drawTypeSelected != DrawType.Tile) { _spriteBatch.Draw(texture2, new Rectangle(1250, 25, 64, 64), Constant.GetCollisionColor(typeManager.Cursor.Selected.Type)); SpriteBatchAssist.DrawBox(_spriteBatch, texture2, collisionSection); } _spriteBatch.Draw(texture, new Vector2(1250, 100), selectedSource, Color.White * (drawTypeSelected != DrawType.Collision ? 1f : .33f)); _spriteBatch.Draw(texture2, collisionSection, Constant.GetCollisionColor(typeManager.Cursor.Selected.Type) * (drawTypeSelected != DrawType.Tile ? 1f : .66f)); } else { enemyManager.Draw(new Vector2(1250, 25), _spriteBatch); } }
public void Draw(SpriteBatch _spriteBatch) { foreach (EnemyObjectInfo enm in objectInformation["Default"]) { Rectangle drawPosition = new Rectangle((int)position.X + enm.Source.X, (int)position.Y + enm.Source.Y, enm.Source.Width, enm.Source.Height); _spriteBatch.Draw(texture, drawPosition, enm.Source, Color.White); } _spriteBatch.Draw(emptyTexture, sourceWindow, Color.AliceBlue * .10f); SpriteBatchAssist.DrawBox(_spriteBatch, emptyTexture, sourceWindow, Color.Red, 2); if (hover != null) { Rectangle drawPosition = new Rectangle((int)position.X + hover.Source.X, (int)position.Y + hover.Source.Y, hover.Source.Width, hover.Source.Height); SpriteBatchAssist.DrawBox(_spriteBatch, emptyTexture, drawPosition, Color.LightGoldenrodYellow); } if (selected != null) { Rectangle drawPosition = new Rectangle((int)position.X + selected.Source.X, (int)position.Y + selected.Source.Y, selected.Source.Width, selected.Source.Height); SpriteBatchAssist.DrawBox(_spriteBatch, emptyTexture, drawPosition, Color.Red); } }
public void Draw(SpriteBatch _spriteBatch) { _spriteBatch.Draw(emptyBlockTexture, mapBorder, Color.AliceBlue * .2f); SpriteBatchAssist.DrawBox(_spriteBatch, emptyBlockTexture, mapBorder, Color.Yellow); int showX = Math.Min(mapInfo.DefaultWidth, viewSizeStartX + viewSizeX); int showY = Math.Min(mapInfo.DefaultHeight, viewSizeStartY + viewSizeY); for (int x = viewSizeStartX; x < showX; x++) { for (int y = viewSizeStartY; y < showY; y++) { //Initializing an empty array of screen width and height Rectangle drawDestination = new Rectangle(); Tile tile = mapInfo.Tiles[x, y]; drawDestination.X = ((x - viewSizeStartX) * 32) + (int)Position.X; drawDestination.Y = ((y - viewSizeStartY) * 32) + (int)Position.Y; drawDestination.Width = mapInfo.Tiles[x, y].Destination.Width; drawDestination.Height = mapInfo.Tiles[x, y].Destination.Height; if (tile.Source != Rectangle.Empty) { _spriteBatch.Draw(texture, drawDestination, tile.Source, Color.White * (MapManager.Instance.ShowTypes != DrawType.Collision? 1f : .66f)); } SpriteBatchAssist.DrawBox(_spriteBatch, emptyBlockTexture, drawDestination, .33f); if (tile.Type != TileType.None) { _spriteBatch.Draw(emptyBlockTexture, drawDestination, Constant.GetCollisionColor(tile.Type) * (MapManager.Instance.ShowTypes != DrawType.Tile ? 1f : .33f)); } } } foreach (MapObject mapObj in mapInfo.MapObjects) { int calcTileX = mapObj.DestinationBox.X / 32; int calcTileY = mapObj.DestinationBox.Y / 32; bool withinX = calcTileX > viewSizeStartX && calcTileX < showX; bool withinY = calcTileY > viewSizeStartY && calcTileY < showY; if (withinX && withinY) { Rectangle drawRect = new Rectangle(mapObj.DestinationBox.X + (int)Position.X - (viewSizeStartX * 32), mapObj.DestinationBox.Y + (int)Position.Y - (viewSizeStartY * 32), mapObj.DestinationBox.Width, mapObj.DestinationBox.Height); _spriteBatch.Draw(emptyBlockTexture, drawRect, mapObj.GetDrawColor()); } } foreach (EnemyObjectInfo enm in mapInfo.EnemyObjects) { int calcTileX = enm.Destination.X / 32; int calcTileY = enm.Destination.Y / 32; bool withinX = calcTileX >= viewSizeStartX && calcTileX < showX; bool withinY = calcTileY >= viewSizeStartY && calcTileY < showY; if (withinX && withinY) { Rectangle drawRect = new Rectangle(enm.Destination.X + (int)Position.X - (viewSizeStartX * 32), enm.Destination.Y + (int)Position.Y - (viewSizeStartY * 32), enm.Destination.Width, enm.Destination.Height); _spriteBatch.Draw(enemyTexture, drawRect, enm.Source, Color.White); } } _spriteBatch.DrawString(MapManager.Instance.DebugFont, $"Tiles(x,y):{showX},{showY} out of (x,y):{mapInfo.DefaultWidth},{mapInfo.DefaultHeight}", new Vector2(750, 2), Color.Yellow); _spriteBatch.DrawString(MapManager.Instance.DebugFont, "Song:" + mapInfo.Music, Position - new Vector2(0, 20), Color.LightSkyBlue); Rectangle startPosition = mapInfo.Tiles[viewSizeStartX, viewSizeStartY].Destination; Rectangle endPosition = mapInfo.Tiles[showX - 1, showY - 1].Destination; if (new Rectangle(startPosition.X, startPosition.Y, endPosition.X + endPosition.Width, endPosition.Y + endPosition.Height).Contains(mapInfo.PlayerPosition)) { _spriteBatch.Draw(texturePlayerPosition, Position + mapInfo.PlayerPosition - new Vector2(viewSizeStartX * 32, viewSizeStartY * 32), Color.White); } cursor.Draw(_spriteBatch); _spriteBatch.DrawString(MapManager.Instance.DebugFont, debugString, new Vector2(0, 0), Color.AliceBlue); }