My spiffy screen 13 palette fader...
Posted: Fri Nov 30, 2007 5:47 am
Hi, just got back into doing some programming in QB. It's been almost 2 yrs. since I last coded. Anyways, what I was wanting to do first was to improve the quality of my palette fade in/out routines.
What I did was instead of decreasing a colors rgb intensity every cycle,
like most other fading routines, I decreased the colors rgb intensity more
gradually. (This fading effect looks much cleaner!)
Cya, Nemesis.
p.s..I was thinking maybe writing a tutorial or something to explain the code in detail, step by step. What do you guys think?
What I did was instead of decreasing a colors rgb intensity every cycle,
like most other fading routines, I decreased the colors rgb intensity more
gradually. (This fading effect looks much cleaner!)
Code: Select all
'
DEFINT A-Z
'
TYPE PALdata
Red AS INTEGER
Grn AS INTEGER
Blu AS INTEGER
END TYPE
'
DIM SHARED PAL(255) AS PALdata
'
SCREEN 13
'
OUT &H3C7, 0
'
FOR x = 0 TO 255
PAL(x).Red = INP(&H3C9)
PAL(x).Grn = INP(&H3C9)
PAL(x).Blu = INP(&H3C9)
NEXT
'
FOR y = 0 TO 199
FOR x = 0 TO 319
PSET (x, y), INT(RND(1) * 254 + 1)
NEXT
NEXT
'
COLOR 15: LOCATE 13, 12: PRINT "...Press a key..."
'
DO: LOOP UNTIL INKEY$ <> INKEY$
'
OUT &H3C8, 0
'
FOR y = 1 TO 64
FOR x = 0 TO 255
r = PAL(x).Red - (y * (PAL(x).Red / 64))
g = PAL(x).Grn - (y * (PAL(x).Grn / 64))
b = PAL(x).Blu - (y * (PAL(x).Blu / 64))
OUT &H3C9, r
OUT &H3C9, g
OUT &H3C9, b
NEXT
WAIT &H3DA, 8
NEXT
'
FOR y = 1 TO 64
FOR x = 0 TO 255
r = y * (PAL(x).Red / 64)
g = y * (PAL(x).Grn / 64)
b = y * (PAL(x).Blu / 64)
OUT &H3C9, r
OUT &H3C9, g
OUT &H3C9, b
NEXT
WAIT &H3DA, 8
NEXT
'
SYSTEM
'
p.s..I was thinking maybe writing a tutorial or something to explain the code in detail, step by step. What do you guys think?