public GuiInventory() : base() { container = new GuiItemContainer(50); container.SetBackground("Player/Inventory", Color.White); container.SetBackgroundPosition(new Vector2(Main.ScreenSize.X / 2, Main.ScreenSize.Y / 2)); container.SetBackgroundSource(new Rectangle(0, 0, 245, 231)); container.SetOrigin(new Vector2(container.background.Width / 2, container.background.Height / 2)); for (int index = 0; index < container.slots.Length; index++) { int xOffset = (int)((((index % 10) * 24) + 9) * Main.guiScale); int yOffset; if (index < 10) { yOffset = (int)(10 * Main.guiScale); } else { yOffset = (int)((((index / 10) * 24) + 42) * Main.guiScale); } Vector2 position = new Vector2((this.container.backgroundPosition.X - (container.background.Width * Main.guiScale) / 2) + xOffset, (this.container.backgroundPosition.Y - (container.background.Height * Main.guiScale) / 2) + yOffset); container.slots[index] = new GuiSlot((int)position.X, (int)position.Y, Item.SpriteSize, Item.SpriteSize); } }
public GuiHotbar() { int height = 244, width = 32; boundingBox = new Rectangle(0, (int)(Main.ScreenSize.Y / 2) - height, height, width); position = new Vector2(boundingBox.X, boundingBox.Y); container = new GuiItemContainer(10); container.SetBackground("Player/Hotbar", Color.White); container.SetBackgroundPosition(position); for (int index = 0; index < container.slots.Length; index++) { int xOffset = (int)(9 * Main.guiScale); int yOffset = (int)((index * 24) * Main.guiScale); Vector2 pos = new Vector2(container.backgroundPosition.X + xOffset, container.backgroundPosition.Y + yOffset); container.slots[index] = new GuiSlot((int)pos.X, (int)pos.Y, Item.SpriteSize, Item.SpriteSize); } selector = new GuiSelection(new Vector2(position.X + 9, position.Y + (24 * 9) /*Temporary to fix scrolling inverted*/)); }