Path: utzoo!utgpu!watmath!clyde!att!ucbvax!hplabs!hpda!hpwala!boba From: boba@hpwala.wal.hp.com (Bob Alexander) Newsgroups: comp.binaries.ibm.pc.d Subject: Re: Making balls move with TC 2.0 graphics, a tough problem HELP Message-ID: <781@hpwala.wal.hp.com> Date: 11 Jan 89 13:35:38 GMT References: <4343@freja.diku.dk> Reply-To: boba@hpwala.wal.hp.com (Bob Alexander) Organization: Hewlett Packard, Waltham, Mass Lines: 28 UUCP-Path: hpwala!boba The EGA, VGA and Hercules graphics boards support 2 graphics pages. You can swap between these using the setactivepage and setvisualpage functions. Graphics functions always write to the active page. The user sees only the visual page. So here's what to do: set the active page to 0 and the visual page to 1. Draw the ball on the active page. Switch the visual page to 0 and active to 1. Now you can see the ball on the screen. Draw the ball's new position on the active page and swap again. Now, you have to erase the ball from its old position (since you're swapping pages, you have to remember where the ball is *on each page* to erase it.) I recommend that you use putimage with COPY_PUT. At initialization time, draw a ball on the screen, then save it with a getimage. Also, save an area of blank screen. Erase the ball by doing a putimage of the blank screen area. I'm currently writing a game, too, and I've found that this animation technique works very well. You won't see any flicker. Alas, it's still too slow for my taste, but it will be fast enough for a breakout game. Have fun, Bob Alexander | *Controversial remark deleted* boba@hpwala.hp.com | -------------------+--------------------------------------------------- Organizations don't have opinions: individuals do. The opinions expressed above do not necessarily reflect those of the stockholders, employees, or directors of Hewlett-Packard.