EDIT: The program loops through various scrolling scenarios, incrementing the number of pixels scrolled by 1 every iteration of the loop. Each scroll scenario performs the scroll 20 times. All in fairly slow speed to give an opportunity to see positions of a pixel before and after a scroll statement.
06-27-2023, 12:49 PM (This post was last modified: 06-27-2023, 12:53 PM by bplus.)
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
(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
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.
FOR l = 1 TO 10
IF axis = VERTICAL THEN
SCROLL (this_index,0)-(this_index,15), 0, increment, TRUE
ELSE
SCROLL (0,this_index)-(15,this_index), increment, 0, TRUE
END IF
_DELAY 0.25
NEXT l