Beispiel #1
0
        private void InitializeComponents()
        {
            // ButtonStart
            buttonStart                 = new UI.Components.Button("ButtonStart");
            buttonStart.Content         = "Start Game";
            buttonStart.Size            = new Vector2f(110, 50);
            buttonStart.Location        = new Vector2f(Application.Game.Window.Size.X - 125, Application.Game.Window.Size.Y * 0.10f);
            buttonStart.ForegroundColor = Color.White;
            buttonStart.FontSize        = 13;
            buttonStart.BackgroundImage = new Image(@"assets/images/block_icon.png");
            buttonStart.OnClicked      += ButtonStart_Clicked;
            buttonStart.SetLayer(1);

            // ButtonOptions
            buttonOptions                 = new UI.Components.Button("ButtonOptions");
            buttonOptions.Content         = "Options";
            buttonOptions.Size            = new Vector2f(110, 50);
            buttonOptions.Location        = new Vector2f(Application.Game.Window.Size.X - 125, Application.Game.Window.Size.Y * 0.25f);
            buttonOptions.ForegroundColor = Color.White;
            buttonOptions.FontSize        = 13;
            buttonOptions.BackgroundImage = new Image(@"assets/images/block_icon.png");
            buttonOptions.OnClicked      += ButtonOptions_Clicked;
            buttonOptions.SetLayer(1);

            // ButtonQuit
            buttonQuit                 = new UI.Components.Button("ButtonQuit");
            buttonQuit.Content         = "Quit Game";
            buttonQuit.Size            = new Vector2f(110, 50);
            buttonQuit.Location        = new Vector2f(Application.Game.Window.Size.X - 125, Application.Game.Window.Size.Y * 0.40f);
            buttonQuit.ForegroundColor = Color.White;
            buttonQuit.FontSize        = 13;
            buttonQuit.BackgroundImage = new Image(@"assets/images/block_icon.png");
            buttonQuit.OnClicked      += ButtonQuit_Clicked;
            buttonQuit.SetLayer(1);

            // labelTutorialText
            labelTutorialText          = new UI.Components.Label("labelTutorialText");
            labelTutorialText.Size     = new Vector2f(Application.Game.Window.Size.X * 0.50f, 250);
            labelTutorialText.Location = new Vector2f(Application.Game.Window.Size.X * 0.05f, -30);
            labelTutorialText.Content  = "Tutorial:\n" +
                                         "Bewegen des Tetrisblock \n" +
                                         "mit den Pfeiltasten \n" +
                                         "oder ASD\n\n" +
                                         "Rotieren des Tetrisblocks \n" +
                                         "mit R";
            labelTutorialText.ForegroundColor = Color.White;
            labelTutorialText.BackgroundColor = Color.Transparent;
            labelTutorialText.Alignment       = UI.Components.Alignment.Left;
            labelTutorialText.FontSize        = 18;

            // Add Components
            m_Interface.AddChild(new UIElement[]
            {
                buttonStart,
                buttonOptions,
                buttonQuit,
                labelTutorialText,
            });
        }
Beispiel #2
0
        private void InitializeComponents()
        {
            //
            // ButtonStart
            //
            ButtonResume                 = new UI.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.ForegroundColor = Color.White;
            ButtonResume.BackgroundImage = new Image(@"assets/images/block_icon.png");
            ButtonResume.SetLayer(9999);

            //
            // ButtonQuit
            //
            ButtonQuit                 = new UI.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.ForegroundColor = Color.White;
            ButtonQuit.BackgroundImage = new Image(@"assets/images/block_icon.png");
            ButtonQuit.SetLayer(9999);

            //
            // ImageBlur
            //
            Image img = new Image(Application.Game.Window.Size.X, Application.Game.Window.Size.Y, new Color(54, 50, 41));

            ImageBackgroundBlur              = new UI.Components.Image("ImageBlur", img);
            ImageBackgroundBlur.Size         = new Vector2f(Application.Game.Window.Size.X, Application.Game.Window.Size.Y);
            ImageBackgroundBlur.Transparency = 150;
            ImageBackgroundBlur.SetLayer(9998);


            //
            // Add Components
            //
            m_Interface.AddChild(new UIElement[]
            {
                ButtonResume,
                ButtonQuit,
                ImageBackgroundBlur,
            });
        }
        private void InitializeComponents()
        {
            // buttonBack
            buttonBack                 = new UI.Components.Button("buttonBack");
            buttonBack.Size            = new Vector2f(120, 50);
            buttonBack.Location        = new Vector2f(Application.Game.Window.Size.X * 0.05f, 5);
            buttonBack.Content         = "Back";
            buttonBack.FontSize        = 15;
            buttonBack.ForegroundColor = Color.White;
            buttonBack.BackgroundImage = new Image(@"assets/images/block_icon.png");
            buttonBack.OnClicked      += ButtonBack_Clicked;
            buttonBack.SetLayer(1);


            // labelVolumeText
            labelVolumeText                 = new UI.Components.Label("labelVolumeText");
            labelVolumeText.Location        = new Vector2f(Application.Game.Window.Size.X * 0.05f, Application.Game.Window.Size.Y * 0.15f);
            labelVolumeText.Size            = new Vector2f(120, 50);
            labelVolumeText.Content         = "Volume:";
            labelVolumeText.FontSize        = 18;
            labelVolumeText.Alignment       = UI.Components.Alignment.Center;
            labelVolumeText.BackgroundColor = Color.Transparent;
            labelVolumeText.ForegroundColor = Color.White;
            labelVolumeText.SetLayer(1);

            // textboxVolumeInput
            textboxVolumeInput                 = new UI.Components.TextBox("textboxVolumeInput");
            textboxVolumeInput.Location        = new Vector2f(Application.Game.Window.Size.X * 0.35f, Application.Game.Window.Size.Y * 0.145f);
            textboxVolumeInput.Size            = new Vector2f(120, 50);
            textboxVolumeInput.Content         = Settings.Volume.ToString();
            textboxVolumeInput.FontSize        = 18;
            textboxVolumeInput.BackgroundColor = Color.Transparent;
            textboxVolumeInput.ForegroundColor = Color.White;
            textboxVolumeInput.SetLayer(1);

            // labelScaleText
            labelScaleText                 = new UI.Components.Label("labelScaleText");
            labelScaleText.Location        = new Vector2f(Application.Game.Window.Size.X * 0.05f, Application.Game.Window.Size.Y * 0.3f);
            labelScaleText.Size            = new Vector2f(120, 50);
            labelScaleText.Content         = "Scale:";
            labelScaleText.FontSize        = 18;
            labelScaleText.Alignment       = UI.Components.Alignment.Center;
            labelScaleText.BackgroundColor = Color.Transparent;
            labelScaleText.ForegroundColor = Color.White;
            labelScaleText.SetLayer(1);

            // textboxScaleInput
            textboxScaleInput                 = new UI.Components.TextBox("textboxScaleInput");
            textboxScaleInput.Location        = new Vector2f(Application.Game.Window.Size.X * 0.35f, Application.Game.Window.Size.Y * 0.295f);
            textboxScaleInput.Size            = new Vector2f(120, 50);
            textboxScaleInput.Content         = Settings.Scale.ToString();
            textboxScaleInput.FontSize        = 18;
            textboxScaleInput.BackgroundColor = Color.Transparent;
            textboxScaleInput.ForegroundColor = Color.White;
            textboxScaleInput.SetLayer(1);

            // block
            block.BlockType  = 'T';
            block.BlockArray = BlockInformation.BlockArrays.Where(b => b.Key == block.BlockType).First().Value;
            block.Position   = new Vector2f(Application.Game.Window.Size.X * 0.35f, Application.Game.Window.Size.Y * 0.4f);

            // buttonCancel
            buttonCancel                 = new UI.Components.Button("buttonCancel");
            buttonCancel.Location        = new Vector2f(Application.Game.Window.Size.X * 0.05f, Application.Game.Window.Size.Y * 0.90f);
            buttonCancel.Size            = new Vector2f(150, 50);
            buttonCancel.Content         = "Cancel";
            buttonCancel.FontSize        = 15;
            buttonCancel.ForegroundColor = Color.White;
            buttonCancel.BackgroundImage = new Image(@"assets/images/block_icon.png");
            buttonCancel.OnClicked      += ButtonCancel_Click;
            buttonCancel.SetLayer(1);

            // buttonApply
            buttonApply                 = new UI.Components.Button("buttonCancel");
            buttonApply.Size            = new Vector2f(150, 50);
            buttonApply.Location        = new Vector2f(Application.Game.Window.Size.X * 0.95f - buttonApply.Size.X, Application.Game.Window.Size.Y * 0.90f);
            buttonApply.Content         = "Apply Changes";
            buttonApply.FontSize        = 15;
            buttonApply.ForegroundColor = Color.White;
            buttonApply.BackgroundImage = new Image(@"assets/images/block_icon.png");
            buttonApply.OnClicked      += ButtonApply_Click;
            buttonApply.SetLayer(1);

            // buttonApply

            m_Interface.AddChild(new UIElement[]
            {
                labelVolumeText,
                textboxVolumeInput,
                labelScaleText,
                textboxScaleInput,
                buttonCancel,
                buttonApply,
                buttonBack,
            });
        }
        private void InitializeComponents()
        {
            //
            // ButtonStart
            //
            ButtonRestart                 = new UI.Components.Button("ButtonRestart");
            ButtonRestart.Content         = "Restart";
            ButtonRestart.FontSize        = 12;
            ButtonRestart.ForegroundColor = Color.White;
            ButtonRestart.Size            = new Vector2f(150, 75);
            ButtonRestart.Location        = new Vector2f(Application.Game.Window.Size.X * 0.10f, 250);
            ButtonRestart.BackgroundImage = new Image(@"assets/images/block_icon.png");
            ButtonRestart.OnClicked      += ButtonRestart_Clicked;
            ButtonRestart.OnMouseEntered += ButtonRestart_MouseEntered;
            ButtonRestart.OnMouseLeft    += ButtonRestart_MouseLeft;
            ButtonRestart.SetLayer(1);

            //
            // ButtonQuit
            //
            ButtonQuit                 = new UI.Components.Button("ButtonQuitToMainMenu");
            ButtonQuit.Content         = "Quit To Main Menu";
            ButtonQuit.FontSize        = 12;
            ButtonQuit.ForegroundColor = Color.White;
            ButtonQuit.Size            = new Vector2f(150, 75);
            ButtonQuit.Location        = new Vector2f(Application.Game.Window.Size.X - Application.Game.Window.Size.X * 0.10f - ButtonQuit.Size.X, 250);
            ButtonQuit.BackgroundImage = new Image(@"assets/images/block_icon.png");
            ButtonQuit.OnClicked      += (ButtonQuit_Clicked);
            ButtonQuit.OnMouseEntered += ButtonQuit_MouseEntered;
            ButtonQuit.OnMouseLeft    += ButtonQuit_MouseLeft;
            ButtonQuit.SetLayer(1);

            //
            // LabelGameOver
            //
            LabelGameOver                 = new UI.Components.Label("LabelGameOver");
            LabelGameOver.Content         = $"Game Over";
            LabelGameOver.Size            = new Vector2f(100, 50);
            LabelGameOver.Location        = new Vector2f(Application.Game.Window.Size.X / 2 - LabelGameOver.Size.X * 1.5f, 100);
            LabelGameOver.ForegroundColor = Color.Red;
            LabelGameOver.BackgroundColor = Color.Transparent;
            LabelGameOver.FontSize        = 50;
            LabelGameOver.SetLayer(1);

            //
            // ImageBlur
            //
            Image img = new Image(Application.Game.Window.Size.X, Application.Game.Window.Size.Y, new Color(54, 50, 41));

            ImageBlur              = new UI.Components.Image("ImageBlur", img);
            ImageBlur.Size         = new Vector2f(Application.Game.Window.Size.X, Application.Game.Window.Size.Y);
            ImageBlur.Transparency = 150;
            ImageBlur.SetLayer(0);

            //
            // Add Components
            //
            m_Interface.AddChild(new UIElement[]
            {
                ButtonRestart,
                ButtonQuit,
                LabelGameOver,
                ImageBlur,
            });
        }