public static KeepAspect Create(Vector2F aspect) { var elem = BoxUISystem.RentOrNull <KeepAspect>() ?? new KeepAspect(); elem.aspect_ = aspect; return(elem); }
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); }
protected override void ReturnSelf() { Root.Return(Node); Node = null; OnUpdateEvent = null; BoxUISystem.Return(this); }
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); }
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); }
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); }
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(); }
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); }
protected override void ReturnSelf() { BoxUISystem.Return(this); }
public static Empty Create() { return(BoxUISystem.RentOrNull <Empty>() ?? new Empty()); }
protected override void ReturnSelf() { windowSize_ = default; BoxUISystem.Return(this); }
public static Window Create() { return(BoxUISystem.RentOrNull <Window>() ?? new Window()); }