Esempio n. 1
0
        public UIWindow(Vector2 size, Vector2 position, float scale = 1.0f)
            : base(size, position)
        {
            myScale = scale;

            PaddingLeft   = 4.0f * scale;
            PaddingTop    = 20.0f * scale;
            PaddingRight  = 4.0f * scale;
            PaddingBottom = 4.0f * scale;

            myFrameSprite = new FrameSprite(Res.Get <Texture2D>("images_gui_panels"), scale)
            {
                SubrectSize           = new Vector2(32, 32),
                SubrectOffset         = new Vector2(0, 0),
                FrameTopLeftOffet     = new Vector2(4, 20),
                FrameBottomRightOffet = new Vector2(4, 4),
                Size = size
            };

            myTitleText = new UILabel(Font.Large, scale)
            {
                Position  = new Vector2(6 * scale - PaddingLeft, 4 * scale - PaddingTop),
                IsEnabled = false
            };

            AddChild(myTitleText);

            myCloseButton = new UIWindowCloseButton(new Vector2(size.X - 18.0f * scale - PaddingLeft, 2.0f * scale - PaddingTop), scale);

            myCloseButton.Click += delegate(object sender, OpenTK.Input.MouseButtonEventArgs e)
            {
                Close();
            };

            AddChild(myCloseButton);

            CanBringToFront = true;
            CanClose        = true;
            CanDrag         = true;
        }
Esempio n. 2
0
        public UIWindow( Vector2 size, Vector2 position, float scale = 1.0f )
            : base(size, position)
        {
            myScale = scale;

            PaddingLeft = 4.0f * scale;
            PaddingTop = 20.0f * scale;
            PaddingRight = 4.0f * scale;
            PaddingBottom = 4.0f * scale;

            myFrameSprite = new FrameSprite( Res.Get<Texture2D>( "images_gui_panels" ), scale )
            {
                SubrectSize = new Vector2( 32, 32 ),
                SubrectOffset = new Vector2( 0, 0 ),
                FrameTopLeftOffet = new Vector2( 4, 20 ),
                FrameBottomRightOffet = new Vector2( 4, 4 ),
                Size = size
            };

            myTitleText = new UILabel( Font.Large, scale )
            {
                Position = new Vector2( 6 * scale - PaddingLeft, 4 * scale - PaddingTop ),
                IsEnabled = false
            };

            AddChild( myTitleText );

            myCloseButton = new UIWindowCloseButton( new Vector2( size.X - 18.0f * scale - PaddingLeft, 2.0f * scale - PaddingTop ), scale );

            myCloseButton.Click += delegate( object sender, OpenTK.Input.MouseButtonEventArgs e )
            {
                Close();
            };

            AddChild( myCloseButton );

            CanBringToFront = true;
            CanClose = true;
            CanDrag = true;
        }