delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/12/01/07:11:14

From: "Graham Reeds" <grahamr AT dtn DOT ntl DOT com>
Newsgroups: comp.os.msdos.djgpp
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1001129114636 DOT 10519Q-100000 AT is>
Subject: Re: Buffering text...
Lines: 77
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
Message-ID: <xhMV5.3698$0z.50352@news2-win.server.ntlworld.com>
Date: Fri, 1 Dec 2000 11:51:49 -0000
NNTP-Posting-Host: 62.254.81.170
X-Complaints-To: abuse AT ntlworld DOT com
X-Trace: news2-win.server.ntlworld.com 975671517 62.254.81.170 (Fri, 01 Dec 2000 11:51:57 GMT)
NNTP-Posting-Date: Fri, 01 Dec 2000 11:51:57 GMT
Organization: ntlworld News Service
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Okay - it's been a while, but I've finally got round to posting it...

I have a series of debug info (well actually it's the dos output of the a
Tetris clone).  All I'm outputting is the playarea via two for(;;) loops
with the various block type portrayed by different letters with loads of
text below telling me the various states of my variable lists.  My first
problem was smooth update of the screen, which was flickery and head-ache
inducing. That was solved.  I thought that I'd add color to the proceedings
but it wasn't important.  What is important is getting the algorithms to
work - fancy interfaces are secondary.

So colour isn't that important, but would sure make it look more attractive.

The basically function looks as follows (white space removed as well us
chunk of code):

/*
** Function - DrawColorTextPlayArea()
** draws a playarea from chars
*/
void            DrawColorTextPlayArea()
  {
  int           x, y;
  gotoxy(0,0);    /* reposition cursor */
  while (inportb(0x03da) & 0x08);     /* wait for retrace to end */
  while (!(inportb(0x03da) & 0x08));  /* wait for new retrace to start */

  for (y=PLAYAREA_NVHEIGHT; y<PLAYAREA_HEIGHT; y++)
    {
    for (x=0; x<PLAYAREA_WIDTH; x++)
      {
      switch (ucPlayArea[x][y])
        {
        case NO_PIECE:
          textcolor(DARKGRAY);
          cprintf(".");
          break;
        case STRAIGHT:
          textcolor(LIGHTRED);
          cprintf("R");
          break;

          ... more case statements ...

          textcolor(WHITE);
          cprintf("W");
          break;
        default:
          textcolor(DARKGRAY);
          cprintf("\r\n\r\nERROR:  UNKNOWN OUTPUT TYPE\r\n");
          exit(1);
          break;
        }
      }
    cprintf("\r\n");
    }
... more output code ...
  return;
  }

During previous post I used to get coloured bars flickering up and down the
screen until I quit out normally. Then to get text back I'd have to issue a
'mode co80' command.  Now I have rewritten it I just get a blank screen
without any text any flickering or anything - just blank.  Without rewriting
the entirety of the function for me, any pointers?

What I wanted was the text to appear with coloring in a block 7x15 (as
defined by PLAYAREA_xxx #define's).


--

Stay Lucky, Graham "Mournblade" Reeds.
ICQ No.:  30514803
http://homepage.dtn.ntl.com/grahamr


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019