Hi Charlie, what you are doing in demo could easily be done by color shifting on a pallet.
The same could be done with text by position shifting start point of display for text.
Here is old demo in QB64:
Of course this can be done without _PutImage by redrawing over same screen area each loop.
Maybe I am missing something?
The same could be done with text by position shifting start point of display for text.
Here is old demo in QB64:
Code: (Select All)
_Title "Color Cycle AKA Palette Shifting?" 'B+ 2019-04-13 trans from SdlBasic code
'color cycle test.sdlbas {B+=MGA 2016-06-04
Randomize Timer
'option qbasic
Const xmax = 400 '<==== drawing area width
Const ymax = 300 '<==== drawing area height
'setdisplay(xmax, ymax, 32, 1)
'setcaption("Color Cycle test.sdlbas") '<===================== screen title
'autoback(-2)
Screen _NewImage(xmax, ymax, 32)
'dim common pal(16), cIndex=0
Dim Shared pal(16) As _Unsigned Long
Dim Shared cIndex As Integer
'QB colors approx
pal(0) = &HFF000000
pal(1) = &HFF000077
pal(2) = &HFFFF8866
pal(3) = &HFF008888
pal(4) = &HFF880000
pal(5) = &HFFFF8800
pal(6) = &HFF008800
pal(7) = &HFFBBBBBB
pal(8) = &HFF666666
pal(9) = &HFF0000FF
pal(10) = &HFF00FF00
pal(11) = &HFF00FFFF
pal(12) = &HFFFF0000
pal(13) = &HFFFF00FF
pal(14) = &HFFFFFF00
pal(15) = &HFFFFFFFF
While 1
Cls
For i = 0 To 15
'simulate a Palette Shift by shifting the indexs to Palette calls
Line (i * 20 + 40, 100)-Step(20, 100), pal((cIndex + i) Mod 16), BF
cText xmax / 2, 50, 16, pal(15), "Index called:"
cText i * 20 + 5 + 40, 70, 16, pal(15), Str$(i)
cText xmax / 2, 220, 16, pal(15), "Shifted Index call:"
cText i * 20 + 5 + 40, 240, 16, pal(15), Str$((cIndex + i) Mod 16)
Next
_Display
_Limit 1
'INPUT "Press enter for Palette shifting +1 "; wate$
cIndex = (cIndex + 1) Mod 16 'color shift
Wend
Function ccycle (cNum)
ccycle = pal((cIndex + cNum) Mod 16)
End Function
Sub cText (x, y, textHeight, K As _Unsigned Long, txt$)
fg = _DefaultColor
'screen snapshot
cur& = _Dest
I& = _NewImage(8 * Len(txt$), 16, 32)
_Dest I&
Color K, _RGBA32(0, 0, 0, 0)
_PrintString (1, 1), txt$
mult = textHeight / 16
xlen = Len(txt$) * 8 * mult
_PutImage (x - .5 * xlen + 1, y - .5 * textHeight + 1)-Step(xlen, textHeight), I&, cur&
Color fg
_FreeImage I&
End Sub
Of course this can be done without _PutImage by redrawing over same screen area each loop.
Maybe I am missing something?
b = b + ...