public Level(Form form, LevelDecoder decoder) { Form = form; RendererPanel = new RendererPanel(Render); RendererPanel.Width = 512; RendererPanel.Height = 512; RendererPanel.Location = new Point(0, 0); Player = new Player(RendererPanel, this, RendererPanel.Width / 32, RendererPanel.Height / 32); Pinky = new Pinky(RendererPanel, this, RendererPanel.Width / 32, RendererPanel.Height / 32); Inky = new Inky(RendererPanel, this, RendererPanel.Width / 32, RendererPanel.Height / 32); Blinky = new Blinky(RendererPanel, this, RendererPanel.Width / 32, RendererPanel.Height / 32); Clyde = new Clyde(RendererPanel, this, RendererPanel.Width / 32, RendererPanel.Height / 32); RendererPanel.PlayerRenderAction = Player.Render; RendererPanel.PinkyRenderAction = Pinky.Render; RendererPanel.InkyRenderAction = Inky.Render; RendererPanel.BlinkyRenderAction = Blinky.Render; RendererPanel.ClydeRenderAction = Clyde.Render; RendererPanel.DoRender(); form.Controls.Add(RendererPanel); KeyInputHandler = new KeyInputHandler(form, true, ThreadingMode.None); EventKeyInput eventKeyInput = new EventKeyInput(); eventKeyInput.KeyInput += EventKeyInput_KeyInput; KeyInputHandler.RegisterKeyInput(eventKeyInput); KeyInputHandler.Start(); form.FormClosing += Form_FormClosing; Grid = decoder.DecodeLevel(); Player.Spawn(16, 16); Pinky.Spawn(32, 80); Inky.Spawn(48, 80); Blinky.Spawn(64, 80); Clyde.Spawn(80, 80); }
/// <summary> /// Initializes a new instance of the <see cref="Model" /> class. /// </summary> private Model() { Settings = new Settings(); //retrieve Settings KeyboardInputHandler = new KeyInputHandler(Settings.KeyboardShortcutCharacterTimeout_sec); _translator = new CommandToPlayerTranslator(KeyboardInputHandler); }
/// <summary> /// Initializes a new instance of the <see cref="CommandToPlayerTranslator" /> class. /// </summary> /// <param name="keyboardInputHandler">The keyboard input handler.</param> /// <param name="playerState">State of the player.</param> public CommandToPlayerTranslator(KeyInputHandler keyboardInputHandler) { KeyboardInputHandler = keyboardInputHandler; KeyboardInputHandler.KeySequenceDetected += KeyboardInputHandler_KeySequenceDetected; KeyboardInputHandler.CommandIssued += KeyboardInputHandler_CommandIssued; }
private void Form_FormClosing(object sender, FormClosingEventArgs e) { KeyInputHandler.Stop(); }
public static void Patch() { KeyInputHandler.Patch(); }
public TextBox(GraphicsDevice device, Rectangle bounds, SpriteFont font) : base(device, bounds, font) { inputHandler = new KeyInputHandler(); FlickerStyle = FlickerStyle.Normal; MinimumSize = DefaultMinimumSize; MaximumSize = device.Viewport.Bounds.Size(); FocusChanged += OnFocusChanged; }