home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / rec / games / programm / 5479 < prev    next >
Encoding:
Text File  |  1993-01-21  |  8.4 KB  |  167 lines

  1. Newsgroups: rec.games.programmer
  2. Path: sparky!uunet!brunix!doorknob!scd
  3. From: scd@cs.brown.edu (Steven C. Dollins)
  4. Subject: Re: PC Graphics (animation)
  5. In-Reply-To: ssenkere@zeus.calpoly.edu's message of 21 Jan 93 08:22:35 GMT
  6. Message-ID: <SCD.93Jan21175136@nevar.cs.brown.edu>
  7. Sender: news@cs.brown.edu
  8. Organization: Dept. of Computer Science, Brown University
  9. References: <1993Jan21.082235.505680@zeus.calpoly.edu>
  10. Date: Thu, 21 Jan 1993 22:51:36 GMT
  11. Lines: 154
  12.  
  13. In article <1993Jan21.082235.505680@zeus.calpoly.edu> ssenkere@zeus.calpoly.edu (Scott Senkeresty) writes:
  14.  
  15.    Our main question is how to move the paddles and ball.  We have tried the
  16.    obvious.  Write over the current object in the background color, and redraw
  17.    it at the new location.   Several problems occured...  Flickering,
  18.    Jumpiness, and a slow down of things when the paddles move (ie ball moves
  19.    quickly with no paddle movement, slower with 1 paddle movement, slowest with
  20.    both). 
  21.  
  22.    What is the logical way of doing this!?  We think maybe we need to store the
  23.    whole screen as a bitmap... manipulate our bitmap, and then somehow put it
  24.    on the screen (notice the SOMEHOW, as in... beats us). 
  25.  
  26.    As long as we are at it... there is the problem of the typematic key rates,
  27.    etc.  It would be nice to be able to press several keys at once, and have
  28.    them be DOWN until let up... not repeating...   It is our understanding that
  29.    this would require writing an Int-9 handler.  Any chance of just happening
  30.    to come across some source code!?  :-)  
  31.  
  32.    Oh yes... I forgot something important...  As of now, we are using just C.
  33.    We have experimented with Steven Dollins' mode x library as well.
  34.  
  35.    So... get us going in the right direction at least!  Please ?
  36.  
  37.  
  38. If you are using my mode X library, set the mode using
  39.  
  40.     SetModeX(1);
  41.  
  42. to initialize it in double buffered mode.  In this mode, all graphics
  43. calls write to the hidden page.  To see the changes, swap pages with
  44.  
  45.     SwapPage();
  46.  
  47. Piece of cake.  Storing the screen as a bitmap is not necessary (and
  48. won't work with my library since I don't have support for bitmaps.)
  49.  
  50. On the other hand, XLIB came out after I stopped programming PC's so
  51. chances are that it might be a better library for your purposes.  My
  52. mode X library was written specifically for Xspace/Netspace, not to be
  53. a general purpose library.
  54.  
  55.  
  56. Xspace and Netspace store an array of flags, two for each key.  One
  57. flag has the current state of the key, up or down, and the other is
  58. set only when the key is pressed.  In your game loop, if the second
  59. flag is set, then the key was pressed within the past loop (note that
  60. it need no longer be pressed.)  Act on the keypress and then reset it
  61. with the value of the first key.
  62.  
  63.                     - Steven Dollins
  64. Brown Computer Graphics Group        scd@cs.brown.edu
  65. --
  66.     We have no theology.  We have no philosophy.  We dance.
  67.  
  68.  
  69. Here is the assembly source code used for the keyboard interrupt
  70. (int09) and the timer interrupt (int1C) in our games:
  71.  
  72. begin 644 keyint.zip
  73. M4$L#!!0    (  5_-1J7XR 5(04  ",5   *    2T5924Y4+D%33<58W6_;
  74. M-A!_C@'_#T1?EJ!:8+EPF@\46.KT(UBZ#DL>"@Q%0(F4I546!8J*[/]^1XH4
  75. M25EVD\[I]"**]\'['>^.)QY_^GSU[@;EF"_H>'3\ZO1D/(+WU>7=I1P@_91U
  76. ME&<Q0O??Z/I]CA?5>-0--0N)VO=T=H)(7:+#R9&5-\]XQ'*2%>+LGB5)106(
  77. M-2U%?Q>TD63+5]'%DA:BXX-ORV38PGE?GZ<NG#N,/856G^0:0%S<9?&W*D#W
  78. M27Y+8U80-9PYXT]940NJAK_3]3S%Q8(2<% KV6$GI'U/@)3DDG9P0)J#]K-5
  79. M9S@;EW/FTGQ2N_*@E+7$)VT@O(\Y)9F8L[H0E(]'E5I-?SJRX>G4$&<=U1!G
  80. MX]%2V3(@!V+^&I9VH@R">)M#%,K!Q:_[>4 3>F 90;<-+J\A5@[;3PC)"TEK
  81. MGXYXA.@J5MZJD$@I>J"Q8!QE!>J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X#0.1] $0^T( DG#T$
  114. M0.27 (B<=S0@SWSF[6<D!RB75N36<T42;A)X]2[@-.%T+G&2<*$Y%O.*<I)P
  115. MY:.MC@1.$LX5=G/@D(0K*ZJCC=.$TV<4)PE75H1N<>IPDG#";X*)DX0;!7?Z
  116. M&.P<]E%13A+.\:6(XGT%RD?"%?O,X$7"D2?2K#D^H(_*T*"L4;]W:INRY??%
  117. MECVK-WNS>,J^&KW^MZN&_7Q)5DS^6OQPTMUEJ_JS_3'F%O!FQ.8E?6)IG"R?
  118. M,UV6I#NVWA0W/^7?4BU?TE5QU=.77I*^[M1A2?Y*9'U?I$\J'[/<JE6RLUY>
  119. MTWS %<Y!K+)=/K)5-,7:C+5.6W5[9_E%NZV'2D5&LC\'0]EGUBKFI\VO_NHJ
  120. M:Z,66ZC[;U4'JR*5$=L'5?3.&6]C?5[J9.%699E:U;_1>E?1+F="I:MDS5CQ
  121. M%DG?+<LWR>.C?U!+ P04    " #%AC4:YABX=X$&  "0#@  "0   $M%641%
  122. M34\N0X5776_<-A!\C@#]AZW[8#NY^*,MC 2&'P+':8P@3I$/I'TI0$F\$VN)
  123. M5$C*\B7(?^_L4M*=FS@- N-.(KG#V=G9O<.'>99G[VL3"/\5!=5VC:9S"J[W
  124. MI:;259J6!H]BK2)5NG4V1*^B#E2[@:*C/O!+G6?7>ETXY2M2MJ)H6NW)NSX:
  125. MB[6R6WG-JRLREG?02K5X]6?H%")A4YY=Z2C?#A(J38TIO/)KWA9D3Z/\2E,+
  126. M''C: ETCX;S^U!NO^0J_/CDAY^FW)R?S*3,R8Z/VON\B-G0- @5^=/3T@.C*
  127. M1;V@05/ER+I(9:T TT1^EF?C<GS'4C[2-7(:'3VMF3FK;W#=4C6-3O='R$ =
  128. M$/%]<?$\2TNZ/D[7GU$5_7*)5^"R0'BMFDB#B345:UG7AUXU%/5MS+,:9S?&
  129. MKF9F ><2&=&J$O M0$<&KBBJ FES2UHV:A46% ='2^?S3*NRYN#D[N(8;[9C
  130. M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@[*3([1<((,W[' 0Q4>@U)Y;'$,47N::1AEMJ.9N2QBC! @V
  147. M/M_R=UKS"SA48Y),%NE)"YDJ'G#4.L]N,/E(OAX>\M\\^QGI:'KPN0-!@/N#
  148. M>H<?WSA32=_=(_F(+O0ESXBD*0.A/CM:C$5]C#B="Z>\[? AT>^H;$PV:Q!A
  149. MF2X6M++KL2J$:TD2+;UK$]-$"0YOO[1@!=WI,ZS.JPXJ"#*4+0@#@N*T]26Z
  150. MC4;AZEC.6P'MW: Z]-RG>_NGV]^/S^6!/ +U7\:/^(=PW%A?'"</*6-B>[S7
  151. M@LUG+&\I01&S#C%U/ .5/=AJV1AI?=B:.1A6"H.6N/<>^U[I]1Y=(]K^/J-X
  152. M,/%'?Y_1\2D_.$>F_&;9Z0CRW>B54Y<[VC[]Z^8^=P/!?.=(G#&:HN#$*PRD
  153. M&O? 827'G(UT',M0H*)"-(A"E=?WQ!OYZSM*$X&,^]^=((1+P$M,B3$Q$FDK
  154. M\P@D7 [\V\":4,ON).PT,2=3DW;*>Y/+2ROEX>-^PC_\,=/ .GWT2$AXRQUH
  155. ML^ ^JK<'3N8'!QBQX'L9>>W@5:[X!^84#C;B3"\O/'<M5 -*6PP+7MUB0\77
  156. MK$U5@8$.Q;I]/+8]]VJ8SAR;O/$R(T]XPH\/X%+ %%5I)V^_!?9*9@+\P,)P
  157. MB^R@-KETX2V!69A_ O36P(':Y(.A@X12&N. #D[')Z]??N8?2^%V-TC=G\@3
  158. M_&ZJ;G_9#=N@4O?<6S;ON3^=G=$1<O1U>CL]IJ.I<K]..WYB+<\%?;?&_VL"
  159. MDIE_ 5!+ 0(4 !0    (  5_-1J7XR 5(04  ",5   *          $     
  160. M      !+15E)3E0N05--4$L! A0 %     @ *8 U&F< !$$+ P  DPH   @ 
  161. M         0      204  $M%64E.5"Y(4$L! A0 %     @ Q88U&N88N'>!
  162. M!@  D X   D          0      >@@  $M%641%34\N0U!+!08      P #
  163. + *4    B#P      
  164.  
  165. end
  166.  
  167.