コード例 #1
0
        public override void HandleInput(InputState input)
        {
            Vector2 son_pos = new Vector2(10, 720);

            foreach (GestureSample gesture in input.Gestures)
            {
                if (gesture.GestureType == GestureType.Tap)
                {
                    if (gesture.Position.X > son_pos.X &&
                        gesture.Position.X < son_pos.X + 150 &&
                        gesture.Position.Y > son_pos.Y &&
                        gesture.Position.Y < son_pos.Y + 100)
                    {
                        song.Change_Mute();
                        if (music)
                        {
                            music = false;
                        }
                        else
                        {
                            music = true;
                        }
                    }
                }
            }

            base.HandleInput(input);
        }
コード例 #2
0
        public void HandleInput(InputState input)
        {
            Vector2 son_pos = new Vector2(10, 720);

            foreach (GestureSample gesture in input.Gestures)
            {
                if (gesture.GestureType == GestureType.Tap)
                {
                    if (gesture.Position.X > position1.X &&
                        gesture.Position.X < position1.X + font.MeasureString(reprendre.ToUpper()).X&&
                        gesture.Position.Y > position1.Y &&
                        gesture.Position.Y < position1.Y + font.MeasureString(reprendre.ToUpper()).Y)
                    {
                        Reprendre();
                    }
                    if (gesture.Position.X > position2.X &&
                        gesture.Position.X < position2.X + font.MeasureString(quitter.ToUpper()).X&&
                        gesture.Position.Y > position2.Y &&
                        gesture.Position.Y < position2.Y + font.MeasureString(quitter.ToUpper()).Y)
                    {
                        foreach (GameScreen screen in _screen.ScreenManager.GetScreens())
                        {
                            screen.ExitScreen();
                        }
                        _screen.ScreenManager.AddScreen(new BackgroundMenuScreen());
                        _screen.ScreenManager.AddScreen(new MainMenuScreen());
                        song = new Song_Management(_screen.ScreenManager);
                        song.Change_Intro();
                    }
                    if (gesture.Position.X > son_pos.X &&
                        gesture.Position.X < son_pos.X + 150 &&
                        gesture.Position.Y > son_pos.Y &&
                        gesture.Position.Y < son_pos.Y + 100)
                    {
                        song.Change_Mute();
                        if (music)
                        {
                            music = false;
                        }
                        else
                        {
                            music = true;
                        }
                    }
                }
            }
        }