Fading the screen

 BBS: Inland Empire Archive
Date: 05-17-92 (14:02)             Number: 179
From: MATT PRITCHARD @ 930/21      Refer#: NONE
  To: CORIDON HENSHAW               Recvd: NO  
Subj: Fading the screen              Conf: (2) Quik_Bas
MS>         I'm designing this great new game with VGA/MCGA graphics
MS> and SoundBLASTER support.  So far this is working out perfectly.
MS> However, I need a routine to fade the screen (in mode 13).

CH>Like this:

CH>FOR X=0 to 255
CH>    OUT &H3D7,X
CH>    OUT &H3D9,0
CH>    OUT &H3D9,0
CH>    OUT &H3D9,0
CH>NEXT

CH>This will fade all colors to black.
             ----

Actually, It will set all colors to black in one fell
swoop.  Going directly to the pallette DAC registers is the
way to go!

What I think he wants is to slowly fade the screen image
over a second or so like many commercial games do.  I would
put the RGB values in an array, say Xcolors(0 to 255, 0 to
2), and then make a copy of the array, into TempColors for
example, and then do something like this:

FOR Z = 0 TO 5

   FOR X = 0 TO 255
       OUT &H3D7, X
       OUT &H3D9, Tempcolors(X,0)
       OUT &h3D9, Tempcolors(X,1)
       OUT &h3D9, Tempcolors(X,2)
       TempColors(X,0) = TempColors(X,0) \ 2
       TempColors(X,1) = TempColors(X,1) \ 2
       TempColors(X,2) = TempColors(X,2) \ 2
   NEXT X

   T! = TIMER + 0.15
   DO: LOOP WHILE (T! > TIMER)

NEXT Z

This would go from an instant fade to a gradual fade.

-Matt Pritchard

===
 * SLMR 2.1a * My reality check just bounced.

--- InterPCB 1.50
 # Origin: CENTRAL BBS -Texas' BEST BBS! 214-393-7090 HST  3+GIGs (8:930/21)
 * Origin: Gateway System to/from RBBS-NET (RBBS-PC 1:10/8)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET