Ejemplo n.º 1
0
        /// <summary>
        /// Creates a button with background image
        /// </summary>
        /// <param name="imageName">The name you used on Monogame Content Manager</param>
        public Button(int x, int y, int width, int height, float rotation, string imageName, float layerDepth)
        {
            transform   = new TransformComponent(new Vector2(x, y), rotation);
            this.width  = width;
            this.height = height;
            color       = Color.White;

            primitiveDrawing = null;
            backgroundImage  = new SpriteComponent(imageName);

            this.layerDepth = layerDepth;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a monocolored button
        /// </summary>
        public Button(int x, int y, int width, int height, float rotation, Color color, float layerDepth)
        {
            transform   = new TransformComponent(new Vector2(x, y), rotation);
            this.width  = width;
            this.height = height;
            this.color  = color;

            primitiveDrawing = new PrimitiveDrawing(Game.Instance.GraphicsDevice);
            backgroundImage  = null;
            vertices         = new Vector2[4];
            vertices[0]      = new Vector2(x, y);
            vertices[1]      = new Vector2(x, y + height);
            vertices[2]      = new Vector2(x + width, y + height);
            vertices[3]      = new Vector2(x + width, y);

            this.layerDepth = layerDepth;
        }