Esempio n. 1
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            cursor      = new MagicTexture(Content.Load <Texture2D>("cursor"), new Rectangle(0, 0, 100, 100), Facing.L, 0);
            tex         = Content.Load <Texture2D>("grad");

            buttons = new List <Button>();

            string str = "abcdefghijklmnopqrstuvwxyz0123456789.!?,':;() ";

            fDrawer = new FontDrawer(LoadFont());

            overlay = new MagicTexture(Content.Load <Texture2D>("overlay"), new Rectangle(0, 0, 200, 100), Facing.N, 0);

            SetupMenu();

            Texture2D           frameSrc = Content.Load <Texture2D>("frame");
            List <MagicTexture> style1   = new List <MagicTexture>();

            style1.Add(new MagicTexture(frameSrc, new Rectangle(0, 0, 30, 30), Facing.N, 0, "UL"));
            style1.Add(new MagicTexture(frameSrc, new Rectangle(270, 0, 30, 30), Facing.N, 0, "UR"));
            style1.Add(new MagicTexture(frameSrc, new Rectangle(0, 30, 30, 240), Facing.N, 0, "L"));
            style1.Add(new MagicTexture(frameSrc, new Rectangle(270, 30, 30, 240), Facing.N, 0, "R"));
            style1.Add(new MagicTexture(frameSrc, new Rectangle(0, 270, 30, 30), Facing.N, 0, "DL"));
            style1.Add(new MagicTexture(frameSrc, new Rectangle(270, 270, 30, 30), Facing.N, 0, "DR"));
            style1.Add(new MagicTexture(frameSrc, new Rectangle(30, 0, 240, 30), Facing.N, 0, "U"));
            style1.Add(new MagicTexture(frameSrc, new Rectangle(30, 270, 240, 30), Facing.N, 0, "D"));
            style1.Add(new MagicTexture(frameSrc, new Rectangle(30, 30, 240, 240), Facing.N, 0, "M"));
            //style1.Add(new MagicTexture(frameSrc, new Rectangle(0, 90, 90, 30), Facing.N, 0,"UC"));
            frDrawer = new FrameDrawer();
            frDrawer.GetStyle(style1.ToArray());

            inv = new Inventory(10);
        }
Esempio n. 2
0
        public void Draw(SpriteBatch sb_, FontDrawer fd_, FrameDrawer frd_)
        {
            frd_.Draw(new Rectangle(0, 0, frameW, frameH), sb_);
            Rectangle interior = frd_.getInteriorDim(new Rectangle((int)pos.X, (int)pos.Y, frameW, frameH));
            int       iconPerW = 0;

            for (int x = 0; x *iconW < interior.Width; x++)
            {
                iconPerW = x + 1;
            }
            int y = 0;

            for (int x = 0; x < items.Count; x++)
            {
                if ((x - y * iconPerW) >= iconPerW)
                {
                    y++;
                }
                items[x].DrawIcon(sb_, iconW, new Vector2((x - y * iconPerW) * iconW + interior.X, interior.Y + y * iconW));
            }
        }