void IZMachineIO.PutChar(char ch) { if (lineInputActive) { Glk.glk_cancel_line_event(currentWin, out canceledLineEvent); lineInputActive = false; // glk_cancel_line_event prints a newline if (ch == '\n') { return; } } if (unicode) { Glk.glk_put_char_uni((uint)ch); } else { byte b; encodingChar[0] = ch; int result = Encoding.GetEncoding(Glk.LATIN1).GetBytes(encodingChar, 0, 1, encodedBytes, 0); if (result != 1) { b = (byte)'?'; } else { b = encodedBytes[0]; } Glk.glk_put_char(b); } if (currentWin == upperWin) { xpos++; uint width, height; Glk.glk_window_get_size(upperWin, out width, out height); if (xpos >= width) { xpos = 0; ypos++; if (ypos >= height) { ypos = (int)height - 1; } } } }