Article View: rec.games.programmer
Article #1797Re: PC Graphics (animation)
From: Steven C. Dollins
Date: Thu, 21 Jan 1993 22:51
Date: Thu, 21 Jan 1993 22:51
153 lines
8781 bytes
8781 bytes
In article <1993Jan21.082235.505680@zeus.calpoly.edu> ssenkere@zeus.calpoly.edu (Scott Senkeresty) writes:
Our main question is how to move the paddles and ball. We have tried the
obvious. Write over the current object in the background color, and redraw
it at the new location. Several problems occured... Flickering,
Jumpiness, and a slow down of things when the paddles move (ie ball moves
quickly with no paddle movement, slower with 1 paddle movement, slowest with
both).
What is the logical way of doing this!? We think maybe we need to store the
whole screen as a bitmap... manipulate our bitmap, and then somehow put it
on the screen (notice the SOMEHOW, as in... beats us).
As long as we are at it... there is the problem of the typematic key rates,
etc. It would be nice to be able to press several keys at once, and have
them be DOWN until let up... not repeating... It is our understanding that
this would require writing an Int-9 handler. Any chance of just happening
to come across some source code!? :-)
Oh yes... I forgot something important... As of now, we are using just C.
We have experimented with Steven Dollins' mode x library as well.
So... get us going in the right direction at least! Please ?
If you are using my mode X library, set the mode using
SetModeX(1);
to initialize it in double buffered mode. In this mode, all graphics
calls write to the hidden page. To see the changes, swap pages with
SwapPage();
Piece of cake. Storing the screen as a bitmap is not necessary (and
won't work with my library since I don't have support for bitmaps.)
On the other hand, XLIB came out after I stopped programming PC's so
chances are that it might be a better library for your purposes. My
mode X library was written specifically for Xspace/Netspace, not to be
a general purpose library.
Xspace and Netspace store an array of flags, two for each key. One
flag has the current state of the key, up or down, and the other is
set only when the key is pressed. In your game loop, if the second
flag is set, then the key was pressed within the past loop (note that
it need no longer be pressed.) Act on the keypress and then reset it
with the value of the first key.
- Steven Dollins
Brown Computer Graphics Group scd@cs.brown.edu
--
We have no theology. We have no philosophy. We dance.
Here is the assembly source code used for the keyboard interrupt
(int09) and the timer interrupt (int1C) in our games:
begin 644 keyint.zip
M4$L#!!0 ( 5_-1J7XR 5(04 ",5 * 2T5924Y4+D%33<58W6_;
M-A!_C@'_#T1?EJ!:8+EPF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IE_ 5!+ 0(4 !0 ( 5_-1J7XR 5(04 ",5 * $
M !+15E)3E0N05--4$L! A0 % @ *8 U&F< !$$+ P DPH @
M 0 204 $M%64E.5"Y(4$L! A0 % @ Q88U&N88N'>!
M!@ D X D 0 >@@ $M%641%34\N0U!+!08 P #
+ *4 B#P
end
Technical Details
Message-ID:
<SCD.93Jan21175136@nevar.cs.brown.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!brunix!doorknob!scdReferences:
<1993Jan21.082235.505680@zeus.calpoly.edu>Show Full Headers
Complete Article Headers
Newsgroups: rec.games.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!brunix!doorknob!scd From: scd@cs.brown.edu (Steven C. Dollins) Subject: Re: PC Graphics (animation) In-Reply-To: ssenkere@zeus.calpoly.edu's message of 21 Jan 93 08:22:35 GMT Message-ID: <SCD.93Jan21175136@nevar.cs.brown.edu> Sender: news@cs.brown.edu Organization: Dept. of Computer Science, Brown University References: <1993Jan21.082235.505680@zeus.calpoly.edu> Date: Thu, 21 Jan 1993 22:51:36 GMT Lines: 154