public void Initialize() { int xSpacing = 70; int ySpacing = 140; int yOffset = ySpacing / 2; int xOffset = -50; int originYOffset = -30; Vector2 center = StaticFunctions.PointToVector2(ShipManagerState.GetUpperLeftRectangle.Center); Vector2 origin = new Vector2(center.X + xOffset - BACKGROUND_SHIP_LENGTH / 2f, center.Y + originYOffset); Vector2 backOrigin = new Vector2(origin.X / 2 - 20, origin.Y); displayList = new List <ShipInventoryDisplayObject>(); Coordinate backCoord = new Coordinate(0, 0); displayList.Add(back = new ShipInventoryDisplayObject(Game, spriteSheet.GetSubSprite(new Rectangle(780, 840, 60, 60)), spriteSheet.GetSubSprite(new Rectangle(780, 901, 60, 60)), backOrigin, backCoord)); Coordinate batteryCoord = new Coordinate(1, 0); displayList.Add(cellDisplay = new ShipInventoryDisplayObject(Game, spriteSheet.GetSubSprite(new Rectangle(600, 840, 60, 60)), spriteSheet.GetSubSprite(new Rectangle(600, 901, 60, 60)), new Vector2(origin.X, origin.Y), batteryCoord)); Coordinate platingCoord = new Coordinate(2, 0); displayList.Add(platingDisplay = new ShipInventoryDisplayObject(Game, spriteSheet.GetSubSprite(new Rectangle(480, 840, 60, 60)), spriteSheet.GetSubSprite(new Rectangle(480, 901, 60, 60)), new Vector2(origin.X + xSpacing, origin.Y - yOffset), platingCoord)); Coordinate shieldCoord = new Coordinate(2, 1); displayList.Add(shieldDisplay = new ShipInventoryDisplayObject(Game, spriteSheet.GetSubSprite(new Rectangle(540, 840, 60, 60)), spriteSheet.GetSubSprite(new Rectangle(540, 901, 60, 60)), new Vector2(origin.X + xSpacing, origin.Y - yOffset + ySpacing), shieldCoord)); Coordinate secondaryCoord = new Coordinate(3, 0); displayList.Add(secondaryDisplay = new ShipInventoryDisplayObject(Game, spriteSheet.GetSubSprite(new Rectangle(720, 840, 60, 60)), spriteSheet.GetSubSprite(new Rectangle(720, 901, 60, 60)), new Vector2(origin.X + xSpacing * 2, origin.Y), secondaryCoord)); Coordinate primaryCoord1 = new Coordinate(4, 0); displayList.Add(primaryDisplay = new ShipInventoryDisplayObject(Game, spriteSheet.GetSubSprite(new Rectangle(660, 840, 60, 60)), spriteSheet.GetSubSprite(new Rectangle(660, 901, 60, 60)), new Vector2(origin.X + xSpacing * 3, origin.Y - yOffset), primaryCoord1)); Coordinate primaryCoord2 = new Coordinate(4, 1); displayList.Add(primaryDisplay2 = new ShipInventoryDisplayObject(Game, spriteSheet.GetSubSprite(new Rectangle(660, 840, 60, 60)), spriteSheet.GetSubSprite(new Rectangle(660, 901, 60, 60)), new Vector2(origin.X + xSpacing * 3, origin.Y - yOffset + ySpacing), primaryCoord2)); //Coordinate inventoryCoord = new Coordinate(5, 0); //displayList.Add(inventoryDisplay = new ShipInventoryDisplayObject(Game, spriteSheet.GetSubSprite(new Rectangle(225, 15, 40, 40)), // spriteSheet.GetSubSprite(new Rectangle(305, 15, 40, 40)), // new Vector2(origin.X + xSpacing * 5, origin.Y), inventoryCoord)); }
private void DrawBackground(SpriteBatch spriteBatch) { //Backdrop spriteBatch.Draw(background.Texture, Vector2.Zero, background.SourceRectangle, Color.White, 0f, Vector2.Zero, new Vector2(Game.Resolution.X / background.Width, Game.Resolution.Y / background.Height), SpriteEffects.None, 0.0f); // Ship spriteBatch.Draw(ship.Texture, StaticFunctions.PointToVector2(upperLeftRectangle.Center), ship.SourceRectangle, Color.White, 0f, ship.CenterPoint, 1f, SpriteEffects.None, 0.0f); }