Example #1
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        public YnTextButton()
            : base()
        {
            _label           = new YnLabel();
            _label.TextAlign = YnTextAlign.Center; // Default text alignment
            Add(_label);

            // Default width / height
            Width  = 150;
            Height = 40;
        }
Example #2
0
        public void BuildGui()
        {
            YnLabel title = new YnLabel();
            title.Text = "I'm lost";
            title.CustomFont = YnG.Content.Load<SpriteFont>("Fonts/TitleFont");
            //title.Layout(); // Forçage du layout pour avoir la taille du texte
            title.Position = new Vector2(YnG.Width / 2 - title.Width / 2, title.Height);
            _gui.Add(title);

            YnPanel menu = new YnPanel();
            menu.HasBackground = false;
            menu.Position = new Vector2(YnG.Width / 2 - 170 / 2, title.Position.Y + title.Height * 1.5F);
            menu.Padding = 10;
            _gui.Add(menu);

            const int buttonWidth = 150;
            const int buttonHeight = 50;

            SpriteFont menuFont = YnG.Content.Load<SpriteFont>("Fonts/MainMenuFont");
            YnTextButton playButton = menu.Add(new YnTextButton());
            playButton.Text = "Jouer";
            playButton.Width = buttonHeight;
            playButton.Width = buttonWidth;
            playButton.CustomFont = menuFont;
            playButton.MouseClick += delegate(object o, MouseClickEntityEventArgs e)
            {
                // TODO
            };

            YnTextButton settingsButton = menu.Add(new YnTextButton());
            settingsButton.Text = "Options";
            settingsButton.Width = buttonHeight;
            settingsButton.Width = buttonWidth;
            settingsButton.CustomFont = menuFont;
            settingsButton.MouseClick += delegate(object o, MouseClickEntityEventArgs e)
            {
                // TODO
            };

            YnTextButton exitButton = menu.Add(new YnTextButton());
            exitButton.Text = "Quitter";
            exitButton.Width = buttonHeight;
            exitButton.Width = buttonWidth;
            exitButton.CustomFont = menuFont;
            exitButton.MouseClick += delegate(object o, MouseClickEntityEventArgs e)
            {
                YnG.Exit();
            };

            _gui.Initialize();
            //_gui.PrepareWidgets();
        }
Example #3
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 public YnSlider()
     : base()
 {
     _minValue              = 0;
     _maxValue              = 100;
     _dragging              = false;
     _cursor                = Add(new YnTextButton());
     _cursor.MouseClick    += (s, e) => _dragging = true;
     _cursor.MouseReleased += (s, e) => _dragging = false;
     //_cursor.MouseReleasedInside += (s, e) => _dragging = false;
     //_cursor.MouseReleasedOutside += (s, e) => _dragging = false;
     _labelValue = Add(new YnLabel());
 }
Example #4
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 public YnSlider()
     : base()
 {
     _minValue = 0;
     _maxValue = 100;
     _dragging = false;
     _cursor = Add(new YnTextButton());
     _cursor.MouseClick += (s, e) => _dragging = true;
     _cursor.MouseReleased += (s, e) => _dragging = false;
     //_cursor.MouseReleasedInside += (s, e) => _dragging = false;
     //_cursor.MouseReleasedOutside += (s, e) => _dragging = false;
     _labelValue = Add(new YnLabel());
 }
Example #5
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        public YnTextButton()
            : base()
        {
            _label = new YnLabel();
            _label.TextAlign = YnTextAlign.Center; // Default text alignment
            Add(_label);

            // Default width / height
            Width = 150;
            Height = 40;
        }