Exemplo n.º 1
0
        public override void Init()
        {
            base.Init();

            this.SetHeight(20);

            cursor = GUIManager.Create<Button>(this);
            cursor.SetWidthHeight(15, 15);
            cursor.SetImage(Resource.GetTexture("gui/slide_cursor.png"));
            cursor.SetColor(33*2, 36*2, 45*2);

            cursor.OnMouseDown += new Action<Panel, OpenTK.Input.MouseButtonEventArgs>(cursor_OnMouseDown);

            Utilities.engine.Mouse.Move += new EventHandler<OpenTK.Input.MouseMoveEventArgs>(Mouse_Move);
            Utilities.engine.Mouse.ButtonUp += new EventHandler<OpenTK.Input.MouseButtonEventArgs>(Mouse_ButtonUp);
            this.PreDraw += new Action<Panel, Vector2, DrawEventArgs>(Slider_PreDraw);
        }
Exemplo n.º 2
0
        public override void Init()
        {
            this.Position = new Vector2(200, 480);
            this.WindowTitle = "Untitled";
            this.Width = 200;
            this.Height = 150;
            this.SetMaterial(Resource.GetTexture("gui/window.png"));
            this.SetColor(20, 24, 33);

            //Create the grabbable title section of the window
            Title = GUIManager.Create<Panel>( this.Parent );
            Title.SetMaterial(Resource.GetTexture("gui/title.png"));
            Title.SetWidthHeight(this.Width, 25);
            Title.SetPos(this.Position - new Vector2(0, Title.Height));
            Title.OnMouseDown += new Action<Panel,OpenTK.Input.MouseButtonEventArgs>(Title_OnMouseDown);
            Title.OnMouseMove += new Action<Panel,OpenTK.Input.MouseMoveEventArgs>(Title_OnMouseMove);
            Title.OnMouseUp += new Action<Panel,OpenTK.Input.MouseButtonEventArgs>(Title_OnMouseUp);
            Title.SetColor(135, 36, 31);

            //Create the text that is overlayed upon the title section
            TitleText = GUIManager.Create<Label>(Title);
            TitleText.SetFont("defaultTitle");
            TitleText.SetPos(0, 0);
            TitleText.SetWidthHeight(this.Width, Title.Height);
            TitleText.SetColor(255, 255, 255);
            TitleText.SetText(this.WindowTitle);
            TitleText.Dock(DockStyle.LEFT);
            TitleText.SetAlignment(Label.TextAlign.MiddleLeft);
            TitleText.DockPadding(10, 10, 0, 0);

            //Create the close button
            closeButton = GUIManager.Create<Button>(Title);
            closeButton.SetImage(Resource.GetTexture("gui/close.png"));
            closeButton.SetWidthHeight(25, 25);
            closeButton.SetColor(26, 30, 38);
            closeButton.Dock(DockStyle.RIGHT);
            closeButton.AlignRight();
            closeButton.OnButtonPress += new Button.OnButtonPressDel(closeButton_OnButtonPress);
            closeButton.PreDraw += new Action<Panel, Vector2, DrawEventArgs>(closeButton_PreDraw);
        }