Пример #1
0
        //Initialize
        private void Initialize()
        {
            this.buttonstate = Buttonstate.Start;
            this.top = 430;
            this.left = 3;
            this.space = 107;
            this.Loadcontent();

        }
Пример #2
0
        //update
        public void Update(GameTime gameTime)
        {
            if (Input.EdgeDetectKeyDown(Keys.Right))
            {
                this.buttonstate++;
                if (this.buttonstate > Buttonstate.Quit)
                {
                    this.buttonstate = Buttonstate.Start;
                }

            }

            if (Input.EdgeDetectKeyDown(Keys.Left))
            {
                this.buttonstate--;
                if (this.buttonstate < Buttonstate.Start)
                {
                    this.buttonstate = Buttonstate.Quit;
                }

            }

            ////////////////////////////////////////////////////////////////////////////////
            /////////////////////////////keyboard buttons///////////////////////////////////
            ////////////////////////////////////////////////////////////////////////////////
            if (Input.EdgeDetectKeyDown(Keys.Enter))
            {
                if (this.buttonstate == Buttonstate.Start)
                {
                    this.game.GameState = new PlayScene(this.game);
                }

                if (this.buttonstate == Buttonstate.Options)
                {
                    this.game.GameState = new OptionScene(this.game);
                }

                if (this.buttonstate == Buttonstate.Leveledit)
                {
                    this.game.GameState = new LevelEditorScene(this.game);
                }

                if (this.buttonstate == Buttonstate.Help)
                {
                    this.game.GameState = new HelpScene(this.game);
                }

                if (this.buttonstate == Buttonstate.Quit)
                {
                    this.game.GameState = new QuitScene(this.game);

                }
            }


            ////////////////////////////////////////////////////////////////////////////////
            /////////////////////////////mouse buttons//////////////////////////////////////
            ////////////////////////////////////////////////////////////////////////////////
            if (Input.MouseEdgeDetectPressLeft())
            {
                if (this.start.Rectangle.Intersects(Input.MouseRectangle()))
                {
                    this.game.GameState = new PlayScene(this.game);
                }

                if (this.options.Rectangle.Intersects(Input.MouseRectangle()))
                {
                    this.game.GameState = new OptionScene(this.game);
                }

                if (this.leveledit.Rectangle.Intersects(Input.MouseRectangle()))
                {
                    this.game.GameState = new LevelEditorScene(this.game);
                }

                if (this.help.Rectangle.Intersects(Input.MouseRectangle()))
                {
                    this.game.GameState = new HelpScene(this.game);
                }

                if (this.quit.Rectangle.Intersects(Input.MouseRectangle()))
                {
                    this.game.GameState = new QuitScene(this.game);

                }

            }
            ////////////////////////////////////////////////////////////////////////////////
            /////////////////////////////buttonstate met muis///////////////////////////////
            ////////////////////////////////////////////////////////////////////////////////
            if (this.start.Rectangle.Intersects(Input.MouseRectangle()))
            {
                this.buttonstate = Buttonstate.Start;
            }

            if (this.options.Rectangle.Intersects(Input.MouseRectangle()))
            {
                this.buttonstate = Buttonstate.Options;
            }

            if (this.leveledit.Rectangle.Intersects(Input.MouseRectangle()))
            {
                this.buttonstate = Buttonstate.Leveledit;
            }

            if (this.help.Rectangle.Intersects(Input.MouseRectangle()))
            {
                this.buttonstate = Buttonstate.Help;
            }

            if (this.quit.Rectangle.Intersects(Input.MouseRectangle()))
            {
                this.buttonstate = Buttonstate.Quit;
            }

        }