Esempio n. 1
0
        void CheckMousePosOnCLick()
        {
            MouseState mouseState = Mouse.GetState();

            if (mouseState.LeftButton == ButtonState.Pressed)
            {
                //start gumb
                if (mouseState.X <= _UI[0].position.X + (_UI[0].texture.Width / 2) * 0.5f && mouseState.X >= _UI[0].position.X - (_UI[0].texture.Width / 2) * 0.5f && mouseState.Y <= _UI[0].position.Y + (_UI[0].texture.Height / 2) * 0.5f && mouseState.Y >= _UI[0].position.Y - (_UI[0].texture.Height / 2) * 0.5f)
                {
                    this.Game.Components.Clear();
                    Scenes.Level level = new Scenes.Level(this.Game);
                    this.Game.Components.Add(level);
                }

                //Leaderboard gumb
                if (mouseState.X <= _UI[1].position.X + (_UI[1].texture.Width / 2) * 0.5f && mouseState.X >= _UI[1].position.X - (_UI[1].texture.Width / 2) * 0.5f && mouseState.Y <= _UI[1].position.Y + (_UI[1].texture.Height / 2) * 0.5f && mouseState.Y >= _UI[1].position.Y - (_UI[1].texture.Height / 2) * 0.5f)
                {
                    this.Game.Components.Clear();
                    Scenes.LeaderBoard level = new Scenes.LeaderBoard(this.Game);
                    this.Game.Components.Add(level);
                }

                //Exit gumb
                if (mouseState.X <= _UI[2].position.X + (_UI[2].texture.Width / 2) * 0.5f && mouseState.X >= _UI[2].position.X - (_UI[2].texture.Width / 2) * 0.5f && mouseState.Y <= _UI[2].position.Y + (_UI[2].texture.Height / 2) * 0.5f && mouseState.Y >= _UI[2].position.Y - (_UI[2].texture.Height / 2) * 0.5f)
                {
                    this.Game.Exit();
                }
            }
        }
Esempio n. 2
0
        void CheckMousePosOnCLick()
        {
            MouseState mouseState = Mouse.GetState();

            if (mouseState.LeftButton == ButtonState.Pressed)
            {
                //main menu gumb
                if (mouseState.X <= _UI[0].position.X + (_UI[0].texture.Width / 2) * 0.5f && mouseState.X >= _UI[0].position.X - (_UI[0].texture.Width / 2) * 0.5f && mouseState.Y <= _UI[0].position.Y + (_UI[0].texture.Height / 2) * 0.5f && mouseState.Y >= _UI[0].position.Y - (_UI[0].texture.Height / 2) * 0.5f)
                {
                    this.Game.Components.Clear();
                    Scenes.MainMenu menu = new Scenes.MainMenu(this.Game);
                    this.Game.Components.Add(menu);
                }

                //save gub
                if (mouseState.X <= _UI[1].position.X + (_UI[1].texture.Width / 2) * 0.5f && mouseState.X >= _UI[1].position.X - (_UI[1].texture.Width / 2) * 0.5f && mouseState.Y <= _UI[1].position.Y + (_UI[1].texture.Height / 2) * 0.5f && mouseState.Y >= _UI[1].position.Y - (_UI[1].texture.Height / 2) * 0.5f)
                {
                    save();
                    this.Game.Components.Clear();
                    Scenes.LeaderBoard leaderBoard = new Scenes.LeaderBoard(this.Game);
                    this.Game.Components.Add(leaderBoard);
                }
            }
        }