Beispiel #1
0
 public YnWindow(string title)
     : base()
 {
     _title = title;
     _titlePanel = Add(new YnPanel());
     _titlePanel.Padding = 2;
     _titlePanel.Add(new YnLabel() { Text = title});
     _contentPanel = Add(new YnPanel());
     _contentPanel.Padding = 10;
 }
Beispiel #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();
        }
Beispiel #3
0
 public YnWindow(string title)
     : base()
 {
     _title              = title;
     _titlePanel         = Add(new YnPanel());
     _titlePanel.Padding = 2;
     _titlePanel.Add(new YnLabel()
     {
         Text = title
     });
     _contentPanel         = Add(new YnPanel());
     _contentPanel.Padding = 10;
 }