public void FyreKeyWanted(object sender, KeyWantedEventArgs e) { string line; do { line = GetInputLineAsync().Result; }while (line == null || line.Length < 1); e.Char = line[0]; }
void engine_KeyWanted(object sender, KeyWantedEventArgs e) { if (test.CurrentStep.CommandType != CommandType.KeyWanted) { test.CurrentStep.Status = TestStatus.Failed; test.CurrentStep.Message = "Game requested unexpected key press."; engine.Stop(); } else { e.Char = (char)test.CurrentStep.Command[0]; } }
void engine_KeyWanted(object sender, KeyWantedEventArgs e) { keyReady.Reset(); if (WaitHandle.WaitAny(keyEvents) == 0) { e.Char = nextKey; } else { engine.Stop(); } }
private uint glk_select(uint[] args) { DeliverOutput(); if (glkWantLineInput) { string line; if (LineWanted == null) { line = ""; } else { LineWantedEventArgs e = new LineWantedEventArgs(); LineWanted(this, e); line = e.Line; } byte[] bytes = StringToLatin1(line); uint max = Math.Min(glkLineInputBufSize, (uint)bytes.Length); for (uint i = 0; i < max; i++) { image.WriteByte(glkLineInputBuffer + i, bytes[i]); } // return event GlkWriteReference( args[0], GlkConst.evtype_LineInput, 1, max, 0); glkWantLineInput = false; } else if (glkWantCharInput) { char ch; if (KeyWanted == null) { ch = '\0'; } else { KeyWantedEventArgs e = new KeyWantedEventArgs(); KeyWanted(this, e); ch = e.Char; } // return event GlkWriteReference( args[0], GlkConst.evtype_CharInput, 1, ch, 0); glkWantCharInput = false; } else { // no event GlkWriteReference( args[0], GlkConst.evtype_None, 0, 0, 0); } return(0); }
private void vm_KeyWanted(object sender, KeyWantedEventArgs e) { e.Char = entry[0]; }
private void vm_KeyWanted(object sender, KeyWantedEventArgs e) { this.Invoke(new Action(RequestKey)); inputReadyEvent.WaitOne(); e.Char = inputLine[0]; }