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
 protected override void ReturnSelf()
 {
     Root.Return(Node);
     Node          = null;
     OnUpdateEvent = null;
     BoxUISystem.Return(this);
 }
Esempio n. 4
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. 5
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. 6
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. 7
0
        static void Main(string[] args)
        {
            Engine.Initialize("CounterExample", 800, 600);

            Engine.AddNode(new CounterNode());

            while (Engine.DoEvents())
            {
                // BoxUIの更新
                BoxUISystem.Update();
                Engine.Update();
            }

            // BoxUIの終了
            BoxUISystem.Terminate();
            Engine.Terminate();
        }
Esempio n. 8
0
        protected override void ReturnSelf()
        {
            switch (collider_)
            {
            case RectangleCollider rect:
                BoxUISystem.Return(rect);
                break;

            case CircleCollider circle:
                BoxUISystem.Return(circle);
                break;

            default:
                break;
            }
            IsActive          = true;
            collider_         = null;
            onFree_           = null;
            onPush_           = null;
            onHold_           = null;
            onRelease_        = null;
            whileNotCollided_ = null;
            BoxUISystem.Return(this);
        }
Esempio n. 9
0
 protected override void ReturnSelf()
 {
     BoxUISystem.Return(this);
 }
Esempio n. 10
0
 public static Empty Create()
 {
     return(BoxUISystem.RentOrNull <Empty>() ?? new Empty());
 }
Esempio n. 11
0
 protected override void ReturnSelf()
 {
     windowSize_ = default;
     BoxUISystem.Return(this);
 }
Esempio n. 12
0
 public static Window Create()
 {
     return(BoxUISystem.RentOrNull <Window>() ?? new Window());
 }