Exemplo n.º 1
0
        private void InitializeComponents()
        {
            //
            // ButtonStart
            //
            ButtonStart                 = new Components.Button("ButtonStart");
            ButtonStart.Content         = "Start Game";
            ButtonStart.Size            = new Vector2f(100, 50);
            ButtonStart.Location        = new Vector2f(Application.Game.Window.Size.X - 125, Application.Game.Window.Size.Y * 0.10f);
            ButtonStart.BackgroundColor = Color.Transparent;
            ButtonStart.ForegroundColor = Color.White;
            ButtonStart.FontSize        = 15;
            ButtonStart.OnClicked      += ButtonStart_Clicked;
            ButtonStart.OnMouseEntered += ButtonStart_MouseEntered;
            ButtonStart.OnMouseLeft    += ButtonStart_MouseLeft;
            ButtonStart.SetLayer(1);

            //
            // ButtonQuit
            //
            ButtonQuit                 = new Components.Button("ButtonQuit");
            ButtonQuit.Content         = "Quit Game";
            ButtonQuit.Size            = new Vector2f(100, 50);
            ButtonQuit.Location        = new Vector2f(Application.Game.Window.Size.X - 125, Application.Game.Window.Size.Y * 0.25f);
            ButtonQuit.BackgroundColor = Color.Transparent;
            ButtonQuit.ForegroundColor = Color.White;
            ButtonQuit.FontSize        = 15;
            ButtonQuit.OnClicked      += ButtonQuit_Clicked;
            ButtonQuit.OnMouseEntered += ButtonQuit_MouseEntered;
            ButtonQuit.OnMouseLeft    += ButtonQuit_MouseLeft;
            ButtonQuit.SetLayer(1);

            //
            // ImageBackground
            //
            ImageBackground              = new Components.Image("ImageBackground", @"assets/images/MainMenu_Background.jpg");
            ImageBackground.Size         = new Vector2f(Application.Game.Window.Size.X, Application.Game.Window.Size.Y);
            ImageBackground.Transparency = 100;
            ImageBackground.SetLayer(0);

            //
            // Add Components
            //
            m_Interface.AddChild(new UIElement[]
            {
                ButtonStart,
                ButtonQuit,
                ImageBackground,
            });
        }
Exemplo n.º 2
0
        private void InitializeComponents()
        {
            //
            // ButtonStart
            //
            ButtonResume            = new Components.Button("ButtonResume");
            ButtonResume.Content    = "Resume Game";
            ButtonResume.Size       = new Vector2f(100, 50);
            ButtonResume.Location   = new Vector2f(Application.Game.Window.Size.X / 2 - ButtonResume.Size.X / 2, 50);
            ButtonResume.OnClicked += ButtonResume_Clicked;
            ButtonResume.SetLayer(9999);

            //
            // ButtonQuit
            //
            ButtonQuit            = new Components.Button("ButtonQuitToMainMenu");
            ButtonQuit.Content    = "Quit To Main Menu";
            ButtonQuit.Size       = new Vector2f(100, 50);
            ButtonQuit.Location   = new Vector2f(Application.Game.Window.Size.X / 2 - ButtonQuit.Size.X / 2, 105);
            ButtonQuit.OnClicked += (ButtonQuit_Clicked);
            ButtonQuit.SetLayer(9999);

            //
            // ImageBackgroundBlur
            //
            ImageBackgroundBlur              = new Components.Image("ImageBackgroundBlur", @"assets/images/background_blur.jpg");
            ImageBackgroundBlur.Size         = new Vector2f(Application.Game.Window.Size.X, Application.Game.Window.Size.Y);
            ImageBackgroundBlur.Transparency = 100;
            ImageBackgroundBlur.SetLayer(9998);


            //
            // Add Components
            //
            m_Interface.AddChild(new UIElement[]
            {
                ButtonResume,
                ButtonQuit,
                ImageBackgroundBlur,
            });
        }