Esempio n. 1
0
        public DebugPixel(int xOffset, int yOffset, CowMouseGame game, Color c, InWorldObject parent)
            : base(game.WorldManager)
        {
            this.xOffset = xOffset;
            this.yOffset = yOffset;

            this.parent = parent;

            loadTexture(game, c);
        }
Esempio n. 2
0
        public SideMenu(CowMouseGame game)
            : base(game)
        {
            this.Game = game;
            this.Visible = false;

            batch = new SpriteBatch(game.GraphicsDevice);

            setupButtons();
        }
Esempio n. 3
0
        public SideMenuButton(int width, int height, int leftX, int topY, CowMouseGame game, Action action,
            String text, SpriteFont font)
        {
            this.Width = width;
            this.Height = height;
            this.Left = leftX;
            this.Top = topY;

            this.Action = action;
            this.Text = text;
            this.Font = font;

            LoadImage(game);
        }
Esempio n. 4
0
        /// <summary>
        /// These pixels are for debugging purposes; they allow one to see the
        /// bounding box of an object.
        /// </summary>
        /// <param name="game"></param>
        /// <returns></returns>
        public IEnumerable<DebugPixel> BoundingPixels(CowMouseGame game)
        {
            Rectangle box = this.InWorldPixelBoundingBox;

            //top side is BLUE
            //bottom side is YELLOW
            for (int x = box.Left + 1; x < box.Right - 1; x++)
            {
                yield return new DebugPixel(
                    x - xPositionWorld,
                    box.Top - yPositionWorld,
                    game,
                    Color.Blue,
                    this
                    );

                yield return new DebugPixel(
                    x - xPositionWorld,
                    box.Bottom - 1 - yPositionWorld,
                    game,
                    Color.Yellow,
                    this
                    );
            }

            //left side is WHITE
            //right side is BLACK
            for (int y = box.Top + 1; y < box.Bottom - 1; y++)
            {
                yield return new DebugPixel(
                    box.Left - xPositionWorld,
                    y - yPositionWorld,
                    game,
                    Color.White,
                    this
                    );

                yield return new DebugPixel(
                    box.Right - 1 - xPositionWorld,
                    y - yPositionWorld,
                    game,
                    Color.Black,
                    this
                    );
            }
        }
Esempio n. 5
0
 private void loadTexture(CowMouseGame game, Color c)
 {
     texture = new Texture2D(game.GraphicsDevice, 1, 1);
     texture.SetData<Color>(new Color[] { c });
 }
Esempio n. 6
0
        private void LoadImage(CowMouseGame game)
        {
            int length = Width * Height;

            Blank = new Texture2D(game.GraphicsDevice, Width, Height);

            Color[] colors = new Color[length];
            for (int i = 0; i < length; i++)
                colors[i] = Color.White;

            Blank.SetData<Color>(colors);
        }