/// <summary> /// This event handler is called when clicking the Map Input menu item. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mapinputToolStripMenuItem_Click(object sender, EventArgs e) { if (InputMapper == null || InputMapper.IsDisposed) //Just in case the input mapper was dismissed with the close button. { InputMapper = new InputMapperForm(Emu.Input); } Emu.IsPaused = true; InputMapper.ShowDialog(); Emu.IsPaused = false; }
public MainForm() { InitializeComponent(); //Emulator component. Emu = new Emulator(); //Register Tick Handler. This event is raised every frame by SDL. SdlDotNet.Core.Events.Tick += new EventHandler <TickEventArgs>(Events_Tick); //Set the FPS that SDL will try to match. TargetRenderFPS = 60; SdlDotNet.Core.Events.Fps = TargetRenderFPS; //Set the FPS at which the Tick event must be raised. SdlDotNet.Core.Events.TargetFps = 60; //This delegate allows the debugger to redraw the output window after every step. (Normally it is just done once a frame) UpdateDisplayDel = new VoidNoParams(UpdateDisplay); //Ready the input handler and attach it to the emulator InpHand = new InputHandler(); Emu.AttachInputHandler(InpHand); this.KeyDown += new KeyEventHandler(InpHand.KeyDown); this.KeyUp += new KeyEventHandler(InpHand.KeyUp); //Attach the input handler to the input mapper form InputMapper = new InputMapperForm(InpHand); //Attach the redraw delegate to the debugger Debugger = new DebuggerForm(Emu, UpdateDisplayDel); //Create a "NumericInput" form. This is used to get the Target FPS when the user wants to change it. NumInp = new NumericInputFrom(); NumInp.Title = "Target FPS"; }