Example #1
0
        private static bool HandleInputs(CKeys keys, CMouse Mouse)
        {
            KeyEvent   KeyEvent   = new KeyEvent();
            MouseEvent MouseEvent = new MouseEvent();

            bool Resume = true;

            while (keys.PollEvent(ref KeyEvent))
            {
                if (KeyEvent.Key == Keys.Left || KeyEvent.Key == Keys.Right || KeyEvent.Key == Keys.Up || KeyEvent.Key == Keys.Down)
                {
                    CSettings.MouseInacive();
                    _Cursor.FadeOut();
                }

                if (KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.F1))
                {
                    CSettings.GameState = EGameState.EditTheme;
                }
                else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.Enter))
                {
                    CSettings.bFullScreen = !CSettings.bFullScreen;
                }
                else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.P))
                {
                    CDraw.MakeScreenShot();
                }
                else
                {
                    if (!_Fading)
                    {
                        Resume &= Screens[(int)ActualScreen].HandleInput(KeyEvent);
                    }
                }
            }

            while (Mouse.PollEvent(ref MouseEvent))
            {
                if (MouseEvent.Wheel != 0)
                {
                    CSettings.MouseActive();
                    _Cursor.FadeIn();
                }

                UpdateMousePosition(MouseEvent.X, MouseEvent.Y);

                if (!_Fading && (_Cursor.IsActive || MouseEvent.LB || MouseEvent.RB))
                {
                    Resume &= Screens[(int)ActualScreen].HandleMouse(MouseEvent);
                }
            }
            return(Resume);
        }
Example #2
0
        private static bool HandleInputThemeEditor(CKeys keys, CMouse Mouse)
        {
            KeyEvent   KeyEvent   = new KeyEvent();
            MouseEvent MouseEvent = new MouseEvent();

            while (keys.PollEvent(ref KeyEvent))
            {
                if (KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.F1))
                {
                    CSettings.GameState = EGameState.Normal;
                    _Screens[(int)_CurrentScreen].NextInteraction();
                }
                else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.Enter))
                {
                    CSettings.bFullScreen = !CSettings.bFullScreen;
                }
                else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.P))
                {
                    CDraw.MakeScreenShot();
                }
                else
                {
                    if (!_Fading)
                    {
                        _Screens[(int)_CurrentScreen].HandleInputThemeEditor(KeyEvent);
                    }
                }
            }

            while (Mouse.PollEvent(ref MouseEvent))
            {
                if (!_Fading)
                {
                    _Screens[(int)_CurrentScreen].HandleMouseThemeEditor(MouseEvent);
                }

                UpdateMousePosition(MouseEvent.X, MouseEvent.Y);
            }
            return(true);
        }
Example #3
0
        private static bool HandleInputs(CKeys keys, CMouse Mouse)
        {
            KeyEvent   KeyEvent        = new KeyEvent();
            MouseEvent MouseEvent      = new MouseEvent();
            KeyEvent   InputKeyEvent   = new KeyEvent();
            MouseEvent InputMouseEvent = new MouseEvent();

            bool PopupPlayerControlAllowed = _CurrentScreen != EScreens.ScreenOptionsRecord && _CurrentScreen != EScreens.ScreenSing &&
                                             _CurrentScreen != EScreens.ScreenSong && _CurrentScreen != EScreens.ScreenCredits;

            bool PopupVolumeControlAllowed = _CurrentScreen != EScreens.ScreenCredits;

            bool Resume               = true;
            bool EventsAvailable      = false;
            bool InputEventsAvailable = CInput.PollKeyEvent(ref InputKeyEvent);

            while ((EventsAvailable = keys.PollEvent(ref KeyEvent)) || InputEventsAvailable)
            {
                if (!EventsAvailable)
                {
                    KeyEvent = InputKeyEvent;
                }

                if (KeyEvent.Key == Keys.Left || KeyEvent.Key == Keys.Right || KeyEvent.Key == Keys.Up || KeyEvent.Key == Keys.Down)
                {
                    CSettings.MouseInactive();
                    _Cursor.FadeOut();
                }

                if (PopupPlayerControlAllowed && KeyEvent.Key == Keys.Tab)
                {
                    if (_CurrentPopupScreen == EPopupScreens.NoPopup && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON)
                    {
                        ShowPopup(EPopupScreens.PopupPlayerControl);
                    }
                    else
                    {
                        HidePopup(EPopupScreens.PopupPlayerControl);
                    }
                }

                if (KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.F1))
                {
                    CSettings.GameState = EGameState.EditTheme;
                }
                else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.Enter))
                {
                    CSettings.bFullScreen = !CSettings.bFullScreen;
                }
                else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.P))
                {
                    CDraw.MakeScreenShot();
                }
                else
                {
                    if (!_Fading)
                    {
                        bool handled = false;
                        if (_CurrentPopupScreen != EPopupScreens.NoPopup)
                        {
                            handled = _PopupScreens[(int)_CurrentPopupScreen].HandleInput(KeyEvent);
                        }

                        if (!handled)
                        {
                            Resume &= _Screens[(int)_CurrentScreen].HandleInput(KeyEvent);
                        }
                    }
                }

                if (!EventsAvailable)
                {
                    InputEventsAvailable = CInput.PollKeyEvent(ref InputKeyEvent);
                }
            }

            InputEventsAvailable = CInput.PollMouseEvent(ref InputMouseEvent);

            while ((EventsAvailable = Mouse.PollEvent(ref MouseEvent)) || InputEventsAvailable)
            {
                if (!EventsAvailable)
                {
                    MouseEvent = InputMouseEvent;
                }

                if (MouseEvent.Wheel != 0)
                {
                    CSettings.MouseActive();
                    _Cursor.FadeIn();
                }

                UpdateMousePosition(MouseEvent.X, MouseEvent.Y);

                bool isOverPopupPlayerControl = CHelper.IsInBounds(_PopupScreens[(int)EPopupScreens.PopupPlayerControl].ScreenArea, MouseEvent);
                if (PopupPlayerControlAllowed && isOverPopupPlayerControl)
                {
                    if (_CurrentPopupScreen == EPopupScreens.NoPopup && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON)
                    {
                        ShowPopup(EPopupScreens.PopupPlayerControl);
                    }
                }

                if (!isOverPopupPlayerControl && _CurrentPopupScreen == EPopupScreens.PopupPlayerControl)
                {
                    HidePopup(EPopupScreens.PopupPlayerControl);
                }

                bool isOverPopupVolumeControl = CHelper.IsInBounds(_PopupScreens[(int)EPopupScreens.PopupVolumeControl].ScreenArea, MouseEvent);
                if (PopupVolumeControlAllowed && isOverPopupVolumeControl)
                {
                    if (_CurrentPopupScreen == EPopupScreens.NoPopup)
                    {
                        ShowPopup(EPopupScreens.PopupVolumeControl);
                        _VolumePopupTimer.Reset();
                    }
                }

                if (!isOverPopupVolumeControl && _CurrentPopupScreen == EPopupScreens.PopupVolumeControl)
                {
                    HidePopup(EPopupScreens.PopupVolumeControl);
                    _VolumePopupTimer.Reset();
                }

                bool handled = false;
                if (_CurrentPopupScreen != EPopupScreens.NoPopup)
                {
                    handled = _PopupScreens[(int)_CurrentPopupScreen].HandleMouse(MouseEvent);
                }
                if (handled && _CurrentPopupScreen == EPopupScreens.PopupVolumeControl)
                {
                    _Screens[(int)_CurrentScreen].ApplyVolume();
                }


                if (!handled && !_Fading && (_Cursor.IsActive || MouseEvent.LB || MouseEvent.RB || MouseEvent.MB))
                {
                    Resume &= _Screens[(int)_CurrentScreen].HandleMouse(MouseEvent);
                }

                if (!EventsAvailable)
                {
                    InputEventsAvailable = CInput.PollMouseEvent(ref InputMouseEvent);
                }
            }
            return(Resume);
        }
Example #4
0
        private static bool HandleInputThemeEditor(CKeys keys, CMouse Mouse)
        {
            KeyEvent KeyEvent = new KeyEvent();
            MouseEvent MouseEvent = new MouseEvent();

            while (keys.PollEvent(ref KeyEvent))
            {
                if (KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.F1))
                {
                    CSettings.GameState = EGameState.Normal;
                    Screens[(int)ActualScreen].NextInteraction();
                }
                else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.Enter))
                {
                    CSettings.bFullScreen = !CSettings.bFullScreen;
                }
                else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.P))
                {
                    CDraw.MakeScreenShot();
                }
                else
                {
                    if (!_Fading)
                        Screens[(int)ActualScreen].HandleInputThemeEditor(KeyEvent);
                }
            }

            while (Mouse.PollEvent(ref MouseEvent))
            {
                if (!_Fading)
                    Screens[(int)ActualScreen].HandleMouseThemeEditor(MouseEvent);

                UpdateMousePosition(MouseEvent.X, MouseEvent.Y);
            }
            return true;
        }
Example #5
0
        private static bool HandleInputs(CKeys keys, CMouse Mouse)
        {
            KeyEvent KeyEvent = new KeyEvent();
            MouseEvent MouseEvent = new MouseEvent();

            bool Resume = true;
            while (keys.PollEvent(ref KeyEvent))
            {
                if (KeyEvent.Key == Keys.Left || KeyEvent.Key == Keys.Right || KeyEvent.Key == Keys.Up || KeyEvent.Key == Keys.Down)
                {
                    CSettings.MouseInacive();
                    _Cursor.FadeOut();
                }

                if (KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.F1))
                {
                    CSettings.GameState = EGameState.EditTheme;
                }
                else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.Enter ))
                {
                    CSettings.bFullScreen = !CSettings.bFullScreen;
                }
                else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.P))
                {
                    CDraw.MakeScreenShot();
                }
                else
                {
                    if (!_Fading)
                        Resume &= Screens[(int)ActualScreen].HandleInput(KeyEvent);
                }
            }

            while (Mouse.PollEvent(ref MouseEvent))
            {
                UpdateMousePosition(MouseEvent.X, MouseEvent.Y);

                if (!_Fading && (_Cursor.IsActive || MouseEvent.LB || MouseEvent.RB))
                    Resume &= Screens[(int)ActualScreen].HandleMouse(MouseEvent);
            }
            return Resume;
        }
Example #6
0
        private static bool HandleInputs(CKeys keys, CMouse Mouse)
        {
            KeyEvent KeyEvent = new KeyEvent();
            MouseEvent MouseEvent = new MouseEvent();
            KeyEvent InputKeyEvent = new KeyEvent();
            MouseEvent InputMouseEvent = new MouseEvent();

            bool PopupPlayerControlAllowed = _CurrentScreen != EScreens.ScreenOptionsRecord && _CurrentScreen != EScreens.ScreenSing &&
                _CurrentScreen != EScreens.ScreenSong && _CurrentScreen != EScreens.ScreenCredits;

            bool PopupVolumeControlAllowed = _CurrentScreen != EScreens.ScreenCredits;

            bool Resume = true;
            bool EventsAvailable = false;
            bool InputEventsAvailable = CInput.PollKeyEvent(ref InputKeyEvent);

            while ((EventsAvailable = keys.PollEvent(ref KeyEvent)) || InputEventsAvailable)
            {
                if (!EventsAvailable)
                    KeyEvent = InputKeyEvent;

                if (KeyEvent.Key == Keys.Left || KeyEvent.Key == Keys.Right || KeyEvent.Key == Keys.Up || KeyEvent.Key == Keys.Down)
                {
                    CSettings.MouseInactive();
                    _Cursor.FadeOut();
                }
                
                if (PopupPlayerControlAllowed && KeyEvent.Key == Keys.Tab)
                {
                    if (_CurrentPopupScreen == EPopupScreens.NoPopup && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON)
                        ShowPopup(EPopupScreens.PopupPlayerControl);
                    else
                        HidePopup(EPopupScreens.PopupPlayerControl);
                }

                if (KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.F1))
                {
                    CSettings.GameState = EGameState.EditTheme;
                }
                else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.Enter ))
                {
                    CSettings.bFullScreen = !CSettings.bFullScreen;
                }
                else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.P))
                {
                    CDraw.MakeScreenShot();
                }
                else
                {
                    if (!_Fading)
                    {
                        bool handled = false;
                        if (_CurrentPopupScreen != EPopupScreens.NoPopup)
                            handled = _PopupScreens[(int)_CurrentPopupScreen].HandleInput(KeyEvent);
                        
                        if (!handled)
                            Resume &= _Screens[(int)_CurrentScreen].HandleInput(KeyEvent);
                    }
                }

                if (!EventsAvailable)
                    InputEventsAvailable = CInput.PollKeyEvent(ref InputKeyEvent);
            }

            InputEventsAvailable = CInput.PollMouseEvent(ref InputMouseEvent);

            while ((EventsAvailable = Mouse.PollEvent(ref MouseEvent)) || InputEventsAvailable)
            {
                if (!EventsAvailable)
                    MouseEvent = InputMouseEvent;

                if (MouseEvent.Wheel != 0)
                {
                    CSettings.MouseActive();
                    _Cursor.FadeIn();
                }

                UpdateMousePosition(MouseEvent.X, MouseEvent.Y);

                bool isOverPopupPlayerControl = CHelper.IsInBounds(_PopupScreens[(int)EPopupScreens.PopupPlayerControl].ScreenArea, MouseEvent);
                if (PopupPlayerControlAllowed && isOverPopupPlayerControl)
                {
                    if (_CurrentPopupScreen == EPopupScreens.NoPopup && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON)
                        ShowPopup(EPopupScreens.PopupPlayerControl);
                }

                if (!isOverPopupPlayerControl && _CurrentPopupScreen == EPopupScreens.PopupPlayerControl)
                    HidePopup(EPopupScreens.PopupPlayerControl);

                bool isOverPopupVolumeControl = CHelper.IsInBounds(_PopupScreens[(int)EPopupScreens.PopupVolumeControl].ScreenArea, MouseEvent);
                if (PopupVolumeControlAllowed && isOverPopupVolumeControl)
                {
                    if (_CurrentPopupScreen == EPopupScreens.NoPopup)
                    {
                        ShowPopup(EPopupScreens.PopupVolumeControl);
                        _VolumePopupTimer.Reset();
                    }
                }

                if (!isOverPopupVolumeControl && _CurrentPopupScreen == EPopupScreens.PopupVolumeControl)
                {
                    HidePopup(EPopupScreens.PopupVolumeControl);
                    _VolumePopupTimer.Reset();
                }

                bool handled = false;
                if (_CurrentPopupScreen != EPopupScreens.NoPopup)
                    handled = _PopupScreens[(int)_CurrentPopupScreen].HandleMouse(MouseEvent);
                if (handled && _CurrentPopupScreen == EPopupScreens.PopupVolumeControl)
                    _Screens[(int)_CurrentScreen].ApplyVolume();


                if (!handled && !_Fading && (_Cursor.IsActive || MouseEvent.LB || MouseEvent.RB || MouseEvent.MB))
                    Resume &= _Screens[(int)_CurrentScreen].HandleMouse(MouseEvent); 
              
                if (!EventsAvailable)
                    InputEventsAvailable = CInput.PollMouseEvent(ref InputMouseEvent);
            }
            return Resume;
        }