win32tty changes

1. Switch to low-level console routines for performance improvements.
2. Instead of moving the cursor around like a real tty, just track the
   destination coordinates of where the cursor should be, and
   defer the movement until user input is expected.

Credit to <Someone> for #2.
This commit is contained in:
nethack.allison
2003-10-05 23:00:05 +00:00
parent 4775dd3cbf
commit bc70857749
7 changed files with 149 additions and 227 deletions

View File

@@ -272,15 +272,23 @@ topl_putsym(c)
ttyDisplay->curx = 0;
ttyDisplay->cury++;
cw->cury = ttyDisplay->cury;
#ifdef WIN32CON
(void) putchar(c);
#endif
break;
default:
if(ttyDisplay->curx == CO-1)
topl_putsym('\n'); /* 1 <= curx <= CO; avoid CO */
#ifdef WIN32CON
(void) putchar(c);
#endif
ttyDisplay->curx++;
}
cw->curx = ttyDisplay->curx;
if(cw->curx == 0) cl_end();
#ifndef WIN32CON
(void) putchar(c);
#endif
}
void

View File

@@ -688,6 +688,9 @@ tty_askname()
if (c == '\b' || c == '\177') {
if(ct) {
ct--;
#ifdef WIN32CON
ttyDisplay->curx--;
#endif
#if defined(MICRO) || defined(WIN32CON)
# if defined(WIN32CON) || defined(MSDOS)
backsp(); /* \b is visible on NT */
@@ -720,6 +723,9 @@ tty_askname()
(void) putchar(c);
#endif
plname[ct++] = c;
#ifdef WIN32CON
ttyDisplay->curx++;
#endif
}
}
plname[ct] = 0;
@@ -1217,8 +1223,13 @@ struct WinDesc *cw;
*/
term_start_attr(curr->attr);
for (n = 0, cp = curr->str;
#ifndef WIN32CON
*cp && (int) ++ttyDisplay->curx < (int) ttyDisplay->cols;
cp++, n++)
#else
*cp && (int) ttyDisplay->curx < (int) ttyDisplay->cols;
cp++, n++, ttyDisplay->curx++)
#endif
if (n == 2 && curr->identifier.a_void != 0 &&
curr->selected) {
if (curr->count == -1L)
@@ -1453,8 +1464,13 @@ struct WinDesc *cw;
}
term_start_attr(attr);
for (cp = &cw->data[i][1];
#ifndef WIN32CON
*cp && (int) ++ttyDisplay->curx < (int) ttyDisplay->cols;
cp++)
#else
*cp && (int) ttyDisplay->curx < (int) ttyDisplay->cols;
cp++, ttyDisplay->curx++)
#endif
(void) putchar(*cp);
term_end_attr(attr);
}