コード例 #1
0
        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*/));
        }
コード例 #2
0
        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*/));
        }