Ejemplo n.º 1
0
        public override void initialize()
        {
            base.initialize();
            var tt = text;

            if (tt == null)
            {
                tt = motion.TextProperties.forText("Button");
                tt.setFontSizeAbsolute(2.00);
            }
            var bgc = backgroundColor;

            if (bgc == null)
            {
                bgc = cave.Color.forRGBA(0, 0, 0, 0);
            }
            boxSprite  = motion.SpriteUtil.addColorSprite((motion.Scene)scene, layer, bgc, 0.10);
            textSprite = layer.addTextSprite(text);
            var th = textSprite.getHeight();

            boxSprite.resize(textSprite.getWidth() + th, th * 2);
            layoutSprites(getX(), getY());
        }
Ejemplo n.º 2
0
 public override void layoutSprites(double x, double y)
 {
     boxSprite.move(x, y);
     textSprite.move(x + boxSprite.getWidth() / 2 - textSprite.getWidth() / 2, y + boxSprite.getHeight() / 2 - textSprite.getHeight() / 2);
 }