Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
BAM: SCROLL statement "super-test"
#3
(06-27-2023, 12:49 PM)bplus Wrote: 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:
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?

That's flying right over my head.  I have no idea where you're going with that.

This is just to test the SCROLL statement to make sure each pixel is scrolling to the correct position, no matter what parameters get thrown at the statement.  Easier to identify the pixels using color.

SCROLL is about scrolling whatever happens to be on the screen.  All text and all graphics.  All pixels.

I think what you are writing about would only ever apply to the specific graphic used in this test case, but would not work with all cases of whatever is on the screen.
Reply


Messages In This Thread
BAM: SCROLL statement "super-test" - by CharlieJV - 06-27-2023, 04:46 AM
RE: BAM: SCROLL statement "super-test" - by bplus - 06-27-2023, 12:49 PM
RE: BAM: SCROLL statement "super-test" - by CharlieJV - 06-27-2023, 02:15 PM
RE: BAM: SCROLL statement "super-test" - by bplus - 06-27-2023, 08:23 PM



Users browsing this thread: 1 Guest(s)