Esempio n. 1
0
        public override void Draw()
        {
            Globals.spriteBatch.Begin();

            //Posicionamiento del texto
            textPos = new Vector2(
                PaintToWinUtils.centerTextX(new Vector2(0, Globals.gameSize.X), font, text),
                PaintToWinUtils.centerTextY(new Vector2(0, Globals.gameSize.Y), font, text));

            //Dibujado del texto
            Globals.spriteBatch.DrawString(font, text, textPos, Color.White);

            Globals.spriteBatch.End();
        }
Esempio n. 2
0
        public Button(Rectangle rectangle, Texture2D texture, Texture2D hoverTexture, String method, Object[] param, String codeText, Boolean border) : base(rectangle, texture)
        {
            content    = typeof(T).GetMethod(method);
            this.param = param;
            hover      = false;
            font       = Fonts.arial_12;

            if (codeText != null)
            {
                this.text = new Language().getMessage(codeText);
                textPos   = new Vector2(
                    PaintToWinUtils.centerTextX(new Vector2(rectangle.X, rectangle.X + rectangle.Width), font, text),
                    PaintToWinUtils.centerTextY(new Vector2(rectangle.Y, rectangle.Y + rectangle.Height), font, text));
            }

            borderButton      = border;
            this.hoverTexture = hoverTexture;
        }
Esempio n. 3
0
        public override void Draw()
        {
            //Posición texto
            textPos = new Vector2(
                PaintToWinUtils.centerTextX(new Vector2(columns[0], columns[0] + columns[1]), font, text),
                PaintToWinUtils.centerTextY(new Vector2(rows[0], rows[0] + rows[1]), font, text));

            Globals.spriteBatch.Begin();

            //Dibuja todos los componentes
            foreach (Component c in components)
            {
                c.draw();
            }

            //Texto
            Globals.spriteBatch.DrawString(Fonts.arial_12, text, textPos, Color.Black);

            Globals.spriteBatch.End();
        }
Esempio n. 4
0
        public Alert(Rectangle rectangle, Texture2D texture, String text, String method, Object[] param) : base(rectangle, texture)
        {
            //fuente
            font = Fonts.arial_12;

            //posicionamiento del alert.
            alertPos = new Vector2(
                PaintToWinUtils.centerArea(new Vector2(0, Globals.gameSize.X), new Vector2(0, rectangle.Width)),
                PaintToWinUtils.centerArea(new Vector2(0, Globals.gameSize.Y), new Vector2(0, rectangle.Height)));

            //texto y posicionamiento del texto del alert.
            this.text = text;
            textPos   = new Vector2(
                PaintToWinUtils.centerTextX(new Vector2(alertPos.X, alertPos.X + rectangle.Width), Fonts.arial_12, text),
                PaintToWinUtils.centerTextY(new Vector2(alertPos.Y, alertPos.Y + rectangle.Height), Fonts.arial_12, text));

            //tamaño, posicionamiento y creacion del boton.
            buttonSize = new Vector2(150, 30);
            Vector2 buttonPos = new Vector2(
                PaintToWinUtils.centerArea(new Vector2(alertPos.X, alertPos.X + rectangle.Width), new Vector2(0, buttonSize.X)),
                rectangle.Height * 0.75f + alertPos.Y);

            button = new Button <T>(new Rectangle((int)buttonPos.X, (int)buttonPos.Y, (int)buttonSize.X, (int)buttonSize.Y), texture, Textures.hoverButton, method, param, "optionsscreen_accept", true);
        }