Esempio n. 1
0
        public static KeepAspect Create(Vector2F aspect)
        {
            var elem = BoxUISystem.RentOrNull <KeepAspect>() ?? new KeepAspect();

            elem.aspect_ = aspect;
            return(elem);
        }
Esempio n. 2
0
        public static Text Create(
            ulong cameraGroup      = 0,
            Aspect aspect          = Aspect.Fixed,
            bool horizontalFlip    = false,
            bool verticalFlip      = false,
            Color?color            = null,
            int zOrder             = 0,
            Material materialGlyph = null,
            Material materialImage = null,
            string text            = null,
            Font font      = null,
            float fontSize = 32
            )
        {
            var elem = BoxUISystem.RentOrNull <Text>() ?? new Text();

            elem.cameraGroup_    = cameraGroup;
            elem.aspect_         = aspect;
            elem.horizontalFlip_ = horizontalFlip;
            elem.verticalFlip_   = verticalFlip;
            elem.color_          = color ?? new Color(255, 255, 255, 255);
            elem.zOrder_         = zOrder;
            elem.materialGlyph_  = materialGlyph;
            elem.materialImage_  = materialImage;
            elem.text_           = text;
            elem.font_           = font;
            elem.fontSize_       = fontSize;
            return(elem);
        }
Esempio n. 3
0
        public static Sprite Create(
            ulong cameraGroup   = 0,
            Aspect aspect       = Aspect.Keep,
            bool horizontalFlip = false,
            bool verticalFlip   = false,
            Color?color         = null,
            int zOrder          = 0,
            Material material   = null,
            TextureBase texture = null,
            RectF?src           = null
            )
        {
            var elem = BoxUISystem.RentOrNull <Sprite>() ?? new Sprite();

            elem.cameraGroup_    = cameraGroup;
            elem.aspect_         = aspect;
            elem.horizontalFlip_ = horizontalFlip;
            elem.verticalFlip_   = verticalFlip;
            elem.color_          = color ?? new Color(255, 255, 255, 255);
            elem.zOrder_         = zOrder;
            elem.material_       = material;
            elem.texture_        = texture;
            elem.src_            = src ?? new RectF(Vector2FExt.Zero, texture?.Size.To2F() ?? Vector2FExt.Zero);
            return(elem);
        }
Esempio n. 4
0
        public static Column Create(ColumnDir dir)
        {
            if (dir != ColumnDir.X && dir != ColumnDir.Y)
            {
                throw new InvalidEnumArgumentException(nameof(dir), (int)dir, typeof(ColumnDir));
            }

            var elem = BoxUISystem.RentOrNull <Column>() ?? new Column();

            elem.dir_ = dir;
            return(elem);
        }
Esempio n. 5
0
        public static Button Create(Shape shape = Shape.Rectangle)
        {
            var elem = BoxUISystem.RentOrNull <Button>() ?? new Button();

            elem.IsActive  = true;
            elem.collider_ = shape switch
            {
                Shape.Rectangle => BoxUISystem.RentOrNull <RectangleCollider>() ?? new RectangleCollider(),
                Shape.Circle => BoxUISystem.RentOrNull <CircleCollider>() ?? new CircleCollider(),
                _ => throw new InvalidEnumArgumentException(nameof(shape), (int)shape, typeof(Shape)),
            };
            return(elem);
        }
Esempio n. 6
0
 public static Empty Create()
 {
     return(BoxUISystem.RentOrNull <Empty>() ?? new Empty());
 }
Esempio n. 7
0
 public static Window Create()
 {
     return(BoxUISystem.RentOrNull <Window>() ?? new Window());
 }