delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/08/06/13:17:21

Date: Sun, 6 Aug 2000 13:17:18 -0400 (EDT)
From: "David Witbrodt" <dawitbro AT alpha DOT delta DOT edu>
To: DJGPP mailing list <djgpp AT delorie DOT com>
Subject: Re: Conflict between IOSTREAMs and VGA writes
Message-ID: <Pine.OSF.4.10.10008061316040.20961-100000@alpha.delta.edu>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

Thanks for the help, Manni (and Eli)!  My mistake was so simple I feel
like I should go get my old bib and pacifier from my mom!


> you are half right. The iostream version shows strange behavior. But so
> does the conio version. I guess the problem is that both, cin and getch
> echo the characters they receive, which is of course what they are
> supposed to do (ever tried to press something else then space or
> return?).

> In C++ there is no portable way to read a single character without a
> terminating end of line. And of course neither is there in C. But at
> least you find a lot of C Compilers that offer the conio functions. I
> would try this with some function that does not echo characters, like
> kbhit().

  In the first demo I wrote for these students, I used kbhit().  They said,
"What the h@#l is that?"  So I wanted to try IOSTREAMs.  Bad idea....
  Interesting that CONIO scrolls the screen on your system.  It does not on
mine, or on the machines at work.  I'm not sure that getch() actually does
the screen echo.  I've always used it as if it doesn't, and it seems to
work OK for me in this case.
  But I take your point, and stand thankfully corrected.


> I guess you told your students a fine lesson. Graphics programming
> without a decent library to help you is indeed not that easy. I just
> hope they will not get the idea that the only decent library to work
> with is mfc. If they are interested, introduce them to Allegro.

  Actually, they are more interested in reinventing the wheel -- as in,
producing their own low-level routines from scratch, just for the
experience.  They have only experienced programming in the classroom, for
the most part, and appeared excited just to find out they could do the
sorts of things I was talking about.
  I've tried to explain to them that you can't do this any more, using
direct hardware access.  One of them wants to abandon Windows and go back
to DOS!  He says he wants to make a game using DJGPP, writing our own
low-level code.  So we're going to try it, but if we get stuck I'll
definitely remember your advice about Allegro (which is something I haven't
even tried yet).


Manni Heumann wrote:

> >When wrote a program to draw 1/8 of a circle using Bresenham, the VGA
> >screen started to scroll away after a number of pixels had been
> >drawn!  I tried to find the bug in my routine for several days, and
> >was about to give up when the thought of trying simpler CONIO routines
> >occurred to me.  When I replaced the IOSTREAM functions with CONIO
> >equivalents, the program worked just fine!

- Raw text -


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