示例#1
0
        private void ctrlRenderer_MouseMove(object sender, MouseEventArgs e)
        {
            CursorManager.OnMouseMove(this);

            if (CursorManager.NeedMouseIcon)
            {
                this.Cursor = Cursors.Cross;
            }

            double xPos = (double)e.X / this.Width;
            double yPos = (double)e.Y / this.Height;

            xPos = Math.Max(0.0, Math.Min(1.0, xPos));
            yPos = Math.Max(0.0, Math.Min(1.0, yPos));

            InputApi.SetMousePosition(xPos, yPos);
        }
示例#2
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            ScreenSize size       = EmuApi.GetScreenSize(false);
            int        leftMargin = (this.Width - size.Width) / 2;
            int        topMargin  = (this.Height - size.Height) / 2;

            CursorManager.OnMouseMove(this);

            if (CursorManager.NeedMouseIcon)
            {
                this.Cursor = Cursors.Cross;
            }

            double xPos = (double)(e.X - leftMargin) / size.Width;
            double yPos = (double)(e.Y - topMargin) / size.Height;

            xPos = Math.Max(0.0, Math.Min(1.0, xPos));
            yPos = Math.Max(0.0, Math.Min(1.0, yPos));

            InputApi.SetMousePosition(xPos, yPos);
        }
示例#3
0
        private void OnNotificationReceived(NotificationEventArgs e)
        {
            switch (e.NotificationType)
            {
            case ConsoleNotificationType.GameLoaded:
                CheatCodes.ApplyCheats();

                this.BeginInvoke((Action)(() => {
                    UpdateDebuggerMenu();
                    ctrlRecentGames.Visible = false;
                    SaveStateManager.UpdateStateMenu(mnuLoadState, false);
                    SaveStateManager.UpdateStateMenu(mnuSaveState, true);

                    RomInfo romInfo = EmuApi.GetRomInfo();
                    this.Text = "Mesen-S - " + romInfo.GetRomName();

                    if (DebugWindowManager.HasOpenedWindow)
                    {
                        DebugWorkspaceManager.GetWorkspace();
                    }
                }));
                break;

            case ConsoleNotificationType.BeforeEmulationStop:
                this.Invoke((Action)(() => {
                    DebugWindowManager.CloseAll();
                }));
                break;

            case ConsoleNotificationType.GameResumed:
                this.BeginInvoke((Action)(() => {
                    //Ensure mouse is hidden when game is resumed
                    CursorManager.OnMouseMove(ctrlRenderer);
                }));
                break;

            case ConsoleNotificationType.EmulationStopped:
                this.BeginInvoke((Action)(() => {
                    this.Text = "Mesen-S";
                    UpdateDebuggerMenu();
                    ShowGameScreen(GameScreenMode.RecentGames);
                    ResizeRecentGames();
                    if (_displayManager.ExclusiveFullscreen)
                    {
                        _displayManager.SetFullscreenState(false);
                    }
                }));
                break;

            case ConsoleNotificationType.ResolutionChanged:
                this.BeginInvoke((Action)(() => {
                    _displayManager.UpdateViewerSize();
                }));
                break;

            case ConsoleNotificationType.ExecuteShortcut:
                this.BeginInvoke((Action)(() => {
                    _shortcuts.ExecuteShortcut((EmulatorShortcut)e.Parameter);
                }));
                break;

            case ConsoleNotificationType.MissingFirmware:
                this.Invoke((Action)(() => {
                    MissingFirmwareMessage msg = (MissingFirmwareMessage)Marshal.PtrToStructure(e.Parameter, typeof(MissingFirmwareMessage));
                    FirmwareHelper.RequestFirmwareFile(msg);
                }));
                break;
            }
        }